upgraded InlineGeometry, removed RenderResource::CreatePrimitive.
This commit is contained in:
parent
299d3bd019
commit
6de3cf789a
@ -40,7 +40,7 @@ private: //plane grid
|
|||||||
Material * mtl_vertex_lum =nullptr;
|
Material * mtl_vertex_lum =nullptr;
|
||||||
MaterialInstance * mi_plane_grid =nullptr;
|
MaterialInstance * mi_plane_grid =nullptr;
|
||||||
Pipeline * p_line =nullptr;
|
Pipeline * p_line =nullptr;
|
||||||
Primitive * prim_plane_grid =nullptr;
|
AutoDelete<Primitive> prim_plane_grid =nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ private: //sphere
|
|||||||
MaterialInstance * mi_blinnphong[4]{};
|
MaterialInstance * mi_blinnphong[4]{};
|
||||||
Pipeline * p_blinnphong =nullptr;
|
Pipeline * p_blinnphong =nullptr;
|
||||||
|
|
||||||
Primitive * prim_sphere =nullptr;
|
AutoDelete<Primitive> prim_sphere =nullptr;
|
||||||
Primitive * prim_cone =nullptr;
|
AutoDelete<Primitive> prim_cone =nullptr;
|
||||||
Primitive * prim_cylinder =nullptr;
|
AutoDelete<Primitive> prim_cylinder =nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -135,11 +135,11 @@ private:
|
|||||||
pgci.lum=0.5;
|
pgci.lum=0.5;
|
||||||
pgci.sub_lum=0.75;
|
pgci.sub_lum=0.75;
|
||||||
|
|
||||||
prim_plane_grid=CreatePlaneGrid(db,mtl_vertex_lum->GetDefaultVIL(),&pgci);
|
prim_plane_grid=CreatePlaneGrid(device,mtl_vertex_lum->GetDefaultVIL(),&pgci);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sphere
|
//Sphere
|
||||||
prim_sphere=CreateSphere(db,mi_blinnphong[0]->GetVIL(),16);
|
prim_sphere=CreateSphere(device,mi_blinnphong[0]->GetVIL(),16);
|
||||||
|
|
||||||
//Cone
|
//Cone
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ private:
|
|||||||
cci.numberSlices=16; //圆锥底部分割数
|
cci.numberSlices=16; //圆锥底部分割数
|
||||||
cci.numberStacks=8; //圆锥高度分割数
|
cci.numberStacks=8; //圆锥高度分割数
|
||||||
|
|
||||||
prim_cone=CreateCone(db,mi_blinnphong[1]->GetVIL(),&cci);
|
prim_cone=CreateCone(device,mi_blinnphong[1]->GetVIL(),&cci);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Cyliner
|
//Cyliner
|
||||||
@ -161,7 +161,7 @@ private:
|
|||||||
cci.numberSlices=16; //圆柱底部分割数
|
cci.numberSlices=16; //圆柱底部分割数
|
||||||
cci.radius =0.25f; //圆柱半径
|
cci.radius =0.25f; //圆柱半径
|
||||||
|
|
||||||
prim_cylinder=CreateCylinder(db,mi_blinnphong[2]->GetVIL(),&cci);
|
prim_cylinder=CreateCylinder(device,mi_blinnphong[2]->GetVIL(),&cci);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -21,12 +21,12 @@ namespace hgl
|
|||||||
RectScope2f scope;
|
RectScope2f scope;
|
||||||
};//struct RectangleCreateInfo
|
};//struct RectangleCreateInfo
|
||||||
|
|
||||||
Primitive *CreateRectangle(RenderResource *db,const VIL *vil,const RectangleCreateInfo *rci);
|
Primitive *CreateRectangle(GPUDevice *device,const VIL *vil,const RectangleCreateInfo *rci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建延迟渲染用全屏平面
|
* 创建延迟渲染用全屏平面
|
||||||
*/
|
*/
|
||||||
Primitive *CreateGBufferCompositionRectangle(RenderResource *db,const VIL *vil);
|
Primitive *CreateGBufferCompositionRectangle(GPUDevice *device,const VIL *vil);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 圆角矩形创建信息(扇形/线圈)
|
* 圆角矩形创建信息(扇形/线圈)
|
||||||
@ -37,7 +37,7 @@ namespace hgl
|
|||||||
uint32_t round_per; ///<圆角精度
|
uint32_t round_per; ///<圆角精度
|
||||||
};//struct RoundRectangleCreateInfo:public RectangleCreateInfo
|
};//struct RoundRectangleCreateInfo:public RectangleCreateInfo
|
||||||
|
|
||||||
Primitive *CreateRoundRectangle(RenderResource *db,const VIL *vil,const RoundRectangleCreateInfo *rci);
|
Primitive *CreateRoundRectangle(GPUDevice *device,const VIL *vil,const RoundRectangleCreateInfo *rci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 圆形创建信息
|
* 圆形创建信息
|
||||||
@ -57,7 +57,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个2D圆形(扇形/线圈)
|
* 创建一个2D圆形(扇形/线圈)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateCircle(RenderResource *db,const VIL *vil,const CircleCreateInfo *cci);
|
Primitive *CreateCircle(GPUDevice *device,const VIL *vil,const CircleCreateInfo *cci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平面网格创建信息<br>
|
* 平面网格创建信息<br>
|
||||||
@ -76,12 +76,12 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个平面网格(线条)
|
* 创建一个平面网格(线条)
|
||||||
*/
|
*/
|
||||||
Primitive *CreatePlaneGrid(RenderResource *db,const VIL *vil,const PlaneGridCreateInfo *pgci);
|
Primitive *CreatePlaneGrid(GPUDevice *device,const VIL *vil,const PlaneGridCreateInfo *pgci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个平面(三角形)
|
* 创建一个平面(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil);
|
Primitive *CreatePlane(GPUDevice *device,const VIL *vil);
|
||||||
|
|
||||||
struct CubeCreateInfo
|
struct CubeCreateInfo
|
||||||
{
|
{
|
||||||
@ -117,7 +117,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个立方体(三角形)
|
* 创建一个立方体(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateCube(RenderResource *db,const VIL *vil,const CubeCreateInfo *cci);
|
Primitive *CreateCube(GPUDevice *device,const VIL *vil,const CubeCreateInfo *cci);
|
||||||
|
|
||||||
struct BoundingBoxCreateInfo
|
struct BoundingBoxCreateInfo
|
||||||
{
|
{
|
||||||
@ -148,17 +148,17 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个绑定盒(线条)
|
* 创建一个绑定盒(线条)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateBoundingBox(RenderResource *db,const VIL *vil,const BoundingBoxCreateInfo *cci);
|
Primitive *CreateBoundingBox(GPUDevice *device,const VIL *vil,const BoundingBoxCreateInfo *cci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个球心坐标为0,0,0,半径为1的球体(三角形)
|
* 创建一个球心坐标为0,0,0,半径为1的球体(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateSphere(RenderResource *db,const VIL *vil,const uint numberSlices);
|
Primitive *CreateSphere(GPUDevice *device,const VIL *vil,const uint numberSlices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个穹顶(三角形)
|
* 创建一个穹顶(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateDome(RenderResource *db,const VIL *vil, const uint numberSlices);
|
Primitive *CreateDome(GPUDevice *device,const VIL *vil, const uint numberSlices);
|
||||||
|
|
||||||
struct TorusCreateInfo
|
struct TorusCreateInfo
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个圆环(三角形)
|
* 创建一个圆环(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateTorus(RenderResource *db,const VIL *vil,const TorusCreateInfo *tci);
|
Primitive *CreateTorus(GPUDevice *device,const VIL *vil,const TorusCreateInfo *tci);
|
||||||
|
|
||||||
struct CylinderCreateInfo
|
struct CylinderCreateInfo
|
||||||
{
|
{
|
||||||
@ -186,7 +186,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个圆柱(三角形)
|
* 创建一个圆柱(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateCylinder(RenderResource *db,const VIL *vil,const CylinderCreateInfo *cci);
|
Primitive *CreateCylinder(GPUDevice *device,const VIL *vil,const CylinderCreateInfo *cci);
|
||||||
|
|
||||||
struct ConeCreateInfo
|
struct ConeCreateInfo
|
||||||
{
|
{
|
||||||
@ -199,7 +199,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个圆锥(三角形)
|
* 创建一个圆锥(三角形)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateCone(RenderResource *db,const VIL *vil,const ConeCreateInfo *cci);
|
Primitive *CreateCone(GPUDevice *device,const VIL *vil,const ConeCreateInfo *cci);
|
||||||
|
|
||||||
struct AxisCreateInfo
|
struct AxisCreateInfo
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 创建一个坐标线(线条)
|
* 创建一个坐标线(线条)
|
||||||
*/
|
*/
|
||||||
Primitive *CreateAxis(RenderResource *db,const VIL *vil,const AxisCreateInfo *aci);
|
Primitive *CreateAxis(GPUDevice *device,const VIL *vil,const AxisCreateInfo *aci);
|
||||||
}//namespace inline_geometry
|
}//namespace inline_geometry
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
};//namespace hgl
|
};//namespace hgl
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
virtual ~RenderResource()=default;
|
virtual ~RenderResource()=default;
|
||||||
|
|
||||||
public: //Add
|
public: //添加数据到管理器(如果指针为nullptr会返回-1)
|
||||||
|
|
||||||
MaterialID Add(Material * mtl ){return rm_material.Add(mtl);}
|
MaterialID Add(Material * mtl ){return rm_material.Add(mtl);}
|
||||||
MaterialInstanceID Add(MaterialInstance * mi ){return rm_material_instance.Add(mi);}
|
MaterialInstanceID Add(MaterialInstance * mi ){return rm_material_instance.Add(mi);}
|
||||||
@ -147,9 +147,6 @@ public: //Material
|
|||||||
|
|
||||||
MaterialInstance * CreateMaterialInstance(const mtl::MaterialCreateInfo *,const VILConfig *vil_cfg=nullptr);
|
MaterialInstance * CreateMaterialInstance(const mtl::MaterialCreateInfo *,const VILConfig *vil_cfg=nullptr);
|
||||||
|
|
||||||
Primitive * CreatePrimitive( const AnsiString &,PrimitiveData *);
|
|
||||||
Primitive * CreatePrimitive(VertexDataManager *,const AnsiString &,PrimitiveData *);
|
|
||||||
|
|
||||||
Renderable * CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
Renderable * CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
||||||
|
|
||||||
Sampler * CreateSampler(VkSamplerCreateInfo *sci=nullptr);
|
Sampler * CreateSampler(VkSamplerCreateInfo *sci=nullptr);
|
||||||
|
2
res
2
res
@ -1 +1 @@
|
|||||||
Subproject commit 008dbd5353e6afe7add287333cbda1b5c5fffdec
|
Subproject commit 5e5814c15e936fd6e865c344b98f5ce79f364079
|
@ -5,7 +5,6 @@
|
|||||||
#include<hgl/graph/VertexAttribDataAccess.h>
|
#include<hgl/graph/VertexAttribDataAccess.h>
|
||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
#include<hgl/graph/VKShaderModule.h>
|
#include<hgl/graph/VKShaderModule.h>
|
||||||
#include<hgl/graph/VKRenderResource.h>
|
|
||||||
#include<hgl/graph/PrimitiveCreater.h>
|
#include<hgl/graph/PrimitiveCreater.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
@ -14,9 +13,9 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
namespace inline_geometry
|
namespace inline_geometry
|
||||||
{
|
{
|
||||||
Primitive *CreateRectangle(RenderResource *db,const VIL *vil,const RectangleCreateInfo *rci)
|
Primitive *CreateRectangle(GPUDevice *device,const VIL *vil,const RectangleCreateInfo *rci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Rectangle");
|
PrimitiveCreater rc(device,vil,"Rectangle");
|
||||||
|
|
||||||
if(!rc.Init(4,0))
|
if(!rc.Init(4,0))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -28,21 +27,21 @@ namespace hgl
|
|||||||
|
|
||||||
vertex->WriteRectFan(rci->scope);
|
vertex->WriteRectFan(rci->scope);
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateGBufferCompositionRectangle(RenderResource *db,const VIL *vil)
|
Primitive *CreateGBufferCompositionRectangle(GPUDevice *device,const VIL *vil)
|
||||||
{
|
{
|
||||||
RectangleCreateInfo rci;
|
RectangleCreateInfo rci;
|
||||||
|
|
||||||
rci.scope.Set(-1,-1,2,2);
|
rci.scope.Set(-1,-1,2,2);
|
||||||
|
|
||||||
return CreateRectangle(db,vil,&rci);
|
return CreateRectangle(device,vil,&rci);
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateRoundRectangle(RenderResource *db,const VIL *vil,const RoundRectangleCreateInfo *rci)
|
Primitive *CreateRoundRectangle(GPUDevice *device,const VIL *vil,const RoundRectangleCreateInfo *rci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"RoundRectangle");
|
PrimitiveCreater rc(device,vil,"RoundRectangle");
|
||||||
|
|
||||||
if(rci->radius==0||rci->round_per<=1) //这是要画矩形
|
if(rci->radius==0||rci->round_per<=1) //这是要画矩形
|
||||||
{
|
{
|
||||||
@ -111,12 +110,12 @@ namespace hgl
|
|||||||
delete[] coord;
|
delete[] coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateCircle(RenderResource *db,const VIL *vil,const CircleCreateInfo *cci)
|
Primitive *CreateCircle(GPUDevice *device,const VIL *vil,const CircleCreateInfo *cci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Circle");
|
PrimitiveCreater rc(device,vil,"Circle");
|
||||||
|
|
||||||
uint edge;
|
uint edge;
|
||||||
|
|
||||||
@ -159,12 +158,12 @@ namespace hgl
|
|||||||
color->Write(cci->border_color);
|
color->Write(cci->border_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePlaneGrid(RenderResource *db,const VIL *vil,const PlaneGridCreateInfo *pgci)
|
Primitive *CreatePlaneGrid(GPUDevice *device,const VIL *vil,const PlaneGridCreateInfo *pgci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"PlaneGrid");
|
PrimitiveCreater rc(device,vil,"PlaneGrid");
|
||||||
|
|
||||||
if(!rc.Init(((pgci->grid_size.Width()+1)+(pgci->grid_size.Height()+1))*2,0))
|
if(!rc.Init(((pgci->grid_size.Width()+1)+(pgci->grid_size.Height()+1))*2,0))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -210,17 +209,17 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil)
|
Primitive *CreatePlane(GPUDevice *device,const VIL *vil)
|
||||||
{
|
{
|
||||||
const float xy_vertices [] = { -0.5f,-0.5f,0.0f, +0.5f,-0.5f,0.0f, +0.5f,+0.5f,0.0f, -0.5f,+0.5f,0.0f };
|
const float xy_vertices [] = { -0.5f,-0.5f,0.0f, +0.5f,-0.5f,0.0f, +0.5f,+0.5f,0.0f, -0.5f,+0.5f,0.0f };
|
||||||
float xy_tex_coord[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f };
|
float xy_tex_coord[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f };
|
||||||
const Vector3f xy_normal(0.0f,0.0f,1.0f);
|
const Vector3f xy_normal(0.0f,0.0f,1.0f);
|
||||||
const Vector3f xy_tangent(1.0f,0.0f,0.0f);
|
const Vector3f xy_tangent(1.0f,0.0f,0.0f);
|
||||||
|
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Plane");
|
PrimitiveCreater rc(device,vil,"Plane");
|
||||||
|
|
||||||
if(!rc.Init(4,8))
|
if(!rc.Init(4,8))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -249,10 +248,10 @@ namespace hgl
|
|||||||
tex_coord->Write(xy_tex_coord,4);
|
tex_coord->Write(xy_tex_coord,4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateCube(RenderResource *db,const VIL *vil,const CubeCreateInfo *cci)
|
Primitive *CreateCube(GPUDevice *device,const VIL *vil,const CubeCreateInfo *cci)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 4 5
|
* 4 5
|
||||||
@ -305,7 +304,7 @@ namespace hgl
|
|||||||
16, 17, 18, 16, 18, 19,
|
16, 17, 18, 16, 18, 19,
|
||||||
20, 23, 22, 20, 22, 21};
|
20, 23, 22, 20, 22, 21};
|
||||||
|
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Cube");
|
PrimitiveCreater rc(device,vil,"Cube");
|
||||||
|
|
||||||
if(!rc.Init(24,6*2*3,IndexType::U16))
|
if(!rc.Init(24,6*2*3,IndexType::U16))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -351,7 +350,7 @@ namespace hgl
|
|||||||
|
|
||||||
//rc.CreateIBO16(6*2*3,indices);
|
//rc.CreateIBO16(6*2*3,indices);
|
||||||
rc.WriteIBO(indices);
|
rc.WriteIBO(indices);
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -453,9 +452,9 @@ namespace hgl
|
|||||||
* @param numberSlices 切片数
|
* @param numberSlices 切片数
|
||||||
* @return 可渲染数据
|
* @return 可渲染数据
|
||||||
*/
|
*/
|
||||||
Primitive *CreateSphere(RenderResource *db,const VIL *vil,const uint numberSlices)
|
Primitive *CreateSphere(GPUDevice *device,const VIL *vil,const uint numberSlices)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Sphere");
|
PrimitiveCreater rc(device,vil,"Sphere");
|
||||||
|
|
||||||
uint numberParallels = (numberSlices+1) / 2;
|
uint numberParallels = (numberSlices+1) / 2;
|
||||||
uint numberVertices = (numberParallels + 1) * (numberSlices + 1);
|
uint numberVertices = (numberParallels + 1) * (numberSlices + 1);
|
||||||
@ -534,12 +533,12 @@ namespace hgl
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateDome(RenderResource *db,const VIL *vil,const uint numberSlices)
|
Primitive *CreateDome(GPUDevice *device,const VIL *vil,const uint numberSlices)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Dome");
|
PrimitiveCreater rc(device,vil,"Dome");
|
||||||
|
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
@ -628,7 +627,7 @@ namespace hgl
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -669,9 +668,9 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
Primitive *CreateTorus(RenderResource *db,const VIL *vil,const TorusCreateInfo *tci)
|
Primitive *CreateTorus(GPUDevice *device,const VIL *vil,const TorusCreateInfo *tci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Torus");
|
PrimitiveCreater rc(device,vil,"Torus");
|
||||||
|
|
||||||
// s, t = parametric values of the equations, in the range [0,1]
|
// s, t = parametric values of the equations, in the range [0,1]
|
||||||
float s = 0;
|
float s = 0;
|
||||||
@ -779,7 +778,7 @@ namespace hgl
|
|||||||
if(index_type==IndexType::U8 )CreateTorusIndices<uint8 >(&rc,tci->numberSlices,tci->numberStacks);else
|
if(index_type==IndexType::U8 )CreateTorusIndices<uint8 >(&rc,tci->numberSlices,tci->numberStacks);else
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -834,14 +833,14 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
Primitive *CreateCylinder(RenderResource *db,const VIL *vil,const CylinderCreateInfo *cci)
|
Primitive *CreateCylinder(GPUDevice *device,const VIL *vil,const CylinderCreateInfo *cci)
|
||||||
{
|
{
|
||||||
uint numberIndices = cci->numberSlices * 3 * 2 + cci->numberSlices * 6;
|
uint numberIndices = cci->numberSlices * 3 * 2 + cci->numberSlices * 6;
|
||||||
|
|
||||||
if(numberIndices<=0)
|
if(numberIndices<=0)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Cylinder");
|
PrimitiveCreater rc(device,vil,"Cylinder");
|
||||||
|
|
||||||
uint numberVertices = (cci->numberSlices + 2) * 2 + (cci->numberSlices + 1) * 2;
|
uint numberVertices = (cci->numberSlices + 2) * 2 + (cci->numberSlices + 1) * 2;
|
||||||
|
|
||||||
@ -1018,7 +1017,7 @@ namespace hgl
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -1064,9 +1063,9 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
Primitive *CreateCone(RenderResource *db,const VIL *vil,const ConeCreateInfo *cci)
|
Primitive *CreateCone(GPUDevice *device,const VIL *vil,const ConeCreateInfo *cci)
|
||||||
{
|
{
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Cone");
|
PrimitiveCreater rc(device,vil,"Cone");
|
||||||
|
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
@ -1195,14 +1194,14 @@ namespace hgl
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateAxis(RenderResource *db,const VIL *vil,const AxisCreateInfo *aci)
|
Primitive *CreateAxis(GPUDevice *device,const VIL *vil,const AxisCreateInfo *aci)
|
||||||
{
|
{
|
||||||
if(!db||!vil||!aci)return(nullptr);
|
if(!device||!vil||!aci)return(nullptr);
|
||||||
|
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"Axis");
|
PrimitiveCreater rc(device,vil,"Axis");
|
||||||
|
|
||||||
if(!rc.Init(6,0))
|
if(!rc.Init(6,0))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -1222,10 +1221,10 @@ namespace hgl
|
|||||||
vertex->Write(0,0,0);color->Write(aci->color[2]);
|
vertex->Write(0,0,0);color->Write(aci->color[2]);
|
||||||
vertex->Write(0,0,s);color->Write(aci->color[2]);
|
vertex->Write(0,0,s);color->Write(aci->color[2]);
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateBoundingBox(RenderResource *db,const VIL *vil,const BoundingBoxCreateInfo *cci)
|
Primitive *CreateBoundingBox(GPUDevice *device,const VIL *vil,const BoundingBoxCreateInfo *cci)
|
||||||
{
|
{
|
||||||
// Points of a cube.
|
// Points of a cube.
|
||||||
/* 4 5 */ const float points[]={ -0.5,-0.5, 0.5, 0.5,-0.5,0.5, 0.5,-0.5,-0.5, -0.5,-0.5,-0.5,
|
/* 4 5 */ const float points[]={ -0.5,-0.5, 0.5, 0.5,-0.5,0.5, 0.5,-0.5,-0.5, -0.5,-0.5,-0.5,
|
||||||
@ -1247,7 +1246,7 @@ namespace hgl
|
|||||||
0,4, 1,5, 2,6, 3,7
|
0,4, 1,5, 2,6, 3,7
|
||||||
};
|
};
|
||||||
|
|
||||||
PrimitiveCreater rc(db->GetDevice(),vil,"BoundingBox");
|
PrimitiveCreater rc(device,vil,"BoundingBox");
|
||||||
|
|
||||||
if(!rc.Init(8,24,IndexType::U16))
|
if(!rc.Init(8,24,IndexType::U16))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -1273,7 +1272,7 @@ namespace hgl
|
|||||||
|
|
||||||
rc.WriteIBO<uint16>(indices);
|
rc.WriteIBO<uint16>(indices);
|
||||||
|
|
||||||
return rc.Finish(db);
|
return rc.Create();
|
||||||
}
|
}
|
||||||
}//namespace inline_geometry
|
}//namespace inline_geometry
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
|
@ -80,36 +80,6 @@ MaterialInstance *RenderResource::CreateMaterialInstance(const mtl::MaterialCrea
|
|||||||
return CreateMaterialInstance(mtl,vil_cfg);
|
return CreateMaterialInstance(mtl,vil_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePrimitivePrivate(const AnsiString &,PrimitiveData *);
|
|
||||||
|
|
||||||
Primitive *RenderResource::CreatePrimitive(const AnsiString &name,PrimitiveData *pd)
|
|
||||||
{
|
|
||||||
if(!pd)return(nullptr);
|
|
||||||
|
|
||||||
Primitive *prim=CreatePrimitivePrivate(name,pd);
|
|
||||||
|
|
||||||
if(prim)
|
|
||||||
Add(prim);
|
|
||||||
|
|
||||||
return prim;
|
|
||||||
}
|
|
||||||
|
|
||||||
Primitive *CreatePrimitivePrivate(VertexDataManager *,const AnsiString &,PrimitiveData *);
|
|
||||||
|
|
||||||
Primitive *RenderResource::CreatePrimitive(VertexDataManager *vdm,const AnsiString &name,PrimitiveData *pd)
|
|
||||||
{
|
|
||||||
if(!vdm)return(nullptr);
|
|
||||||
if(!pd)return(nullptr);
|
|
||||||
if(name.IsEmpty())return(nullptr);
|
|
||||||
|
|
||||||
Primitive *prim=CreatePrimitivePrivate(vdm,name,pd);
|
|
||||||
|
|
||||||
if(prim)
|
|
||||||
Add(prim);
|
|
||||||
|
|
||||||
return prim;
|
|
||||||
}
|
|
||||||
|
|
||||||
Renderable *RenderResource::CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p)
|
Renderable *RenderResource::CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p)
|
||||||
{
|
{
|
||||||
if(!p||!mi||!r)
|
if(!p||!mi||!r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user