ULRE/inc/hgl/graph/InlineGeometry.h

237 lines
6.7 KiB
C
Raw Normal View History

2019-05-24 19:28:27 +08:00
#ifndef HGL_GRAPH_INLINE_GEOMETRY_INCLUDE
#define HGL_GRAPH_INLINE_GEOMETRY_INCLUDE
#include<hgl/graph/VK.h>
2019-05-24 19:28:27 +08:00
#include<hgl/math/Vector.h>
#include<hgl/type/RectScope.h>
#include<hgl/type/Color4f.h>
2021-09-24 01:53:44 +08:00
#include<hgl/graph/AABB.h>
2019-05-24 19:28:27 +08:00
namespace hgl
{
namespace graph
{
/**
* (/)
2019-05-24 19:28:27 +08:00
*/
struct RectangleCreateInfo
{
RectScope2f scope;
2019-05-27 22:48:01 +08:00
};//struct RectangleCreateInfo
2019-05-24 19:28:27 +08:00
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableRectangle(RenderResource *db,const VAB *vab,const RectangleCreateInfo *rci);
2019-05-24 19:28:27 +08:00
/**
*
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableGBufferComposition(RenderResource *db,const VAB *vab);
2019-05-24 19:28:27 +08:00
/**
* (/线)
2019-05-24 19:28:27 +08:00
*/
struct RoundRectangleCreateInfo:public RectangleCreateInfo
{
2019-05-27 22:48:01 +08:00
float radius; ///<圆角半径
uint32_t round_per; ///<圆角精度
};//struct RoundRectangleCreateInfo:public RectangleCreateInfo
2019-05-24 19:28:27 +08:00
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableRoundRectangle(RenderResource *db,const VAB *vab,const RoundRectangleCreateInfo *rci);
2019-05-24 19:28:27 +08:00
/**
*
*/
2019-05-27 22:48:01 +08:00
struct CircleCreateInfo
{
Vector2f center; ///<圆心坐标
Vector2f radius; ///<半径
2020-10-19 22:24:00 +08:00
uint field_count=8; ///<分段次数
bool has_color =false;
Vector4f center_color; ///<圆心颜色
Vector4f border_color; ///<边缘颜色
2019-05-27 22:48:01 +08:00
};//struct CircleCreateInfo
/**
* 2D圆形(/线)
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableCircle(RenderResource *db,const VAB *vab,const CircleCreateInfo *cci);
2019-05-27 22:48:01 +08:00
/**
*
*/
struct PlaneGridCreateInfo
{
Vector3f coord[4];
Vector2u step;
Vector2u side_step; //到边界的步数
Color4f color; //一般线条颜色
Color4f side_color; //边界线条颜色
2019-05-27 22:48:01 +08:00
};//struct PlaneGridCreateInfo
/**
* (线)
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderablePlaneGrid(RenderResource *db,const VAB *vab,const PlaneGridCreateInfo *pgci);
2019-05-27 22:48:01 +08:00
struct PlaneCreateInfo
{
Vector2f tile;
public:
PlaneCreateInfo()
{
2021-09-24 01:53:44 +08:00
tile.x=1.0f;
tile.y=1.0f;
}
2019-05-27 22:48:01 +08:00
};//struct PlaneCreateInfo
/**
* ()
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderablePlane(RenderResource *db,const VAB *vab,const PlaneCreateInfo *pci);
2019-05-27 22:48:01 +08:00
struct CubeCreateInfo
{
bool normal;
bool tangent;
bool tex_coord;
enum class ColorType
{
NoColor=0, ///<没有颜色
SameColor, ///<一个颜色
FaceColor, ///<每个面一个颜色(请写入6个颜色值)
VertexColor, ///<每个顶点一个颜色(请写入24个颜色值)
ENUM_CLASS_RANGE(NoColor,VertexColor)
};
ColorType color_type;
Vector4f color[24];
public:
2021-09-24 01:53:44 +08:00
CubeCreateInfo()
{
normal=false;
tangent=false;
tex_coord=false;
2021-09-24 01:53:44 +08:00
color_type=ColorType::NoColor;
}
2019-05-27 22:48:01 +08:00
};//struct CubeCreateInfo
/**
* ()
2019-05-27 22:48:01 +08:00
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableCube(RenderResource *db,const VAB *vab,const CubeCreateInfo *cci);
2021-09-24 01:53:44 +08:00
struct BoundingBoxCreateInfo
{
bool normal;
enum class ColorType
{
NoColor=0, ///<没有颜色
SameColor, ///<一个颜色
VertexColor, ///<每个顶点一个颜色(请写入8个颜色值)
ENUM_CLASS_RANGE(NoColor,VertexColor)
};
ColorType color_type;
Vector4f color[8];
public:
BoundingBoxCreateInfo()
{
normal=false;
color_type=ColorType::NoColor;
}
};//struct BoundingBoxCreateInfo
2019-05-27 22:48:01 +08:00
/**
* (线)
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableBoundingBox(RenderResource *db,const VAB *vab,const BoundingBoxCreateInfo *cci);
2021-09-24 01:53:44 +08:00
/**
* 0,0,01()
2019-05-27 22:48:01 +08:00
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableSphere(RenderResource *db,const VAB *vab,const uint numberSlices);
2019-06-17 20:25:44 +08:00
/**
* ()
2019-06-17 20:25:44 +08:00
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableDome(RenderResource *db,const VAB *vab, const uint numberSlices);
2019-06-17 20:25:44 +08:00
struct TorusCreateInfo
{
float innerRadius,
outerRadius;
uint numberSlices,
numberStacks;
2020-10-22 21:23:35 +08:00
Vector2f uv_scale={1.0,1.0};
2019-06-17 20:25:44 +08:00
};//struct TorusCreateInfo
2021-09-24 01:53:44 +08:00
2019-06-17 20:25:44 +08:00
/**
* ()
2019-06-17 20:25:44 +08:00
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableTorus(RenderResource *db,const VAB *vab,const TorusCreateInfo *tci);
2019-06-17 20:25:44 +08:00
struct CylinderCreateInfo
{
float halfExtend, //高度
radius; //半径
uint numberSlices;
};//struct CylinderCreateInfo
/**
* ()
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableCylinder(RenderResource *db,const VAB *vab,const CylinderCreateInfo *cci);
2019-06-17 20:25:44 +08:00
struct ConeCreateInfo
{
float halfExtend, //高度
radius; //半径
uint numberSlices, //圆切分精度
numberStacks; //柱高层数
};//struct ConeCreateInfo
/**
* ()
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableCone(RenderResource *db,const VAB *vab,const ConeCreateInfo *cci);
2021-09-24 01:53:44 +08:00
struct AxisCreateInfo
{
2020-10-21 18:24:00 +08:00
float size;
Color4f color[3];
public:
2020-10-21 18:24:00 +08:00
AxisCreateInfo()
{
2020-10-21 18:24:00 +08:00
size=1.0f;
color[0].Set(1,0,0,1);
color[1].Set(0,1,0,1);
color[2].Set(0,0,1,1);
}
};//struct AxisCreateInfo
/**
* 线(线)
*/
2022-06-24 17:51:05 +08:00
Primitive *CreateRenderableAxis(RenderResource *db,const VAB *vab,const AxisCreateInfo *aci);
2019-05-24 19:28:27 +08:00
}//namespace graph
};//namespace hgl
#endif//HGL_GRAPH_INLINE_GEOMETRY_INCLUDE