changed CubeCreateInfo and function
This commit is contained in:
parent
3bdf9bbb77
commit
f35d8ab9af
@ -46,7 +46,6 @@ private:
|
|||||||
Material * axis_material =nullptr;
|
Material * axis_material =nullptr;
|
||||||
MaterialInstance * axis_mi =nullptr;
|
MaterialInstance * axis_mi =nullptr;
|
||||||
|
|
||||||
PipelineData * pipeline_data =nullptr;
|
|
||||||
Pipeline * axis_pipeline =nullptr;
|
Pipeline * axis_pipeline =nullptr;
|
||||||
Pipeline * pipeline_solid =nullptr;
|
Pipeline * pipeline_solid =nullptr;
|
||||||
|
|
||||||
@ -140,10 +139,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline_data=GetPipelineData(InlinePipeline::Solid3D);
|
pipeline_solid=CreatePipeline(material_instance,InlinePipeline::Solid3D,Prim::Triangles);
|
||||||
if(!pipeline_data)return(false);
|
|
||||||
|
|
||||||
pipeline_solid=CreatePipeline(material_instance,pipeline_data,Prim::Triangles);
|
|
||||||
if(!pipeline_solid)return(false);
|
if(!pipeline_solid)return(false);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
@ -163,6 +159,9 @@ private:
|
|||||||
|
|
||||||
{
|
{
|
||||||
struct CubeCreateInfo cci;
|
struct CubeCreateInfo cci;
|
||||||
|
cci.has_normal=true;
|
||||||
|
cci.has_tangent=true;
|
||||||
|
cci.has_tex_coord=true;
|
||||||
cci.has_color=true;
|
cci.has_color=true;
|
||||||
cci.color=Vector4f(1,1,1,1);
|
cci.color=Vector4f(1,1,1,1);
|
||||||
ro_cube=CreateRenderableCube(db,vab,&cci);
|
ro_cube=CreateRenderableCube(db,vab,&cci);
|
||||||
|
@ -95,34 +95,20 @@ namespace hgl
|
|||||||
|
|
||||||
struct CubeCreateInfo
|
struct CubeCreateInfo
|
||||||
{
|
{
|
||||||
Vector3f center;
|
bool has_normal;
|
||||||
Vector3f size;
|
bool has_tangent;
|
||||||
Vector2f tile;
|
bool has_tex_coord;
|
||||||
|
|
||||||
bool has_color;
|
bool has_color;
|
||||||
Vector4f color;
|
Vector4f color;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void Set(const AABB &box)
|
|
||||||
{
|
|
||||||
center=box.center;
|
|
||||||
size=box.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
CubeCreateInfo()
|
CubeCreateInfo()
|
||||||
{
|
{
|
||||||
center=Vector3f(0,0,0);
|
has_normal=false;
|
||||||
size=Vector3f(1,1,1);
|
has_tangent=false;
|
||||||
tile=Vector2f(1,1);
|
has_tex_coord=false;
|
||||||
|
|
||||||
has_color=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CubeCreateInfo(const AABB &box)
|
|
||||||
{
|
|
||||||
Set(box);
|
|
||||||
tile=Vector2f(1,1);
|
|
||||||
|
|
||||||
has_color=false;
|
has_color=false;
|
||||||
}
|
}
|
||||||
|
@ -276,49 +276,16 @@ namespace hgl
|
|||||||
if(!rc.Init(24))
|
if(!rc.Init(24))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
if(cci->center ==Vector3f(0,0,0)
|
rc.WriteVAD(VAN::Position,points,sizeof(points));
|
||||||
&&cci->size ==Vector3f(1,1,1))
|
|
||||||
{
|
|
||||||
rc.WriteVAD(VAN::Position,points,sizeof(points));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const float *sp=points;
|
|
||||||
AutoDelete<VB3f> vertex=rc.CreateVADA<VB3f>(VAN::Position);
|
|
||||||
float *vp=vertex->Get();
|
|
||||||
|
|
||||||
for(uint i=0;i<24;i++)
|
|
||||||
{
|
|
||||||
*vp=cci->center.x+(*sp)*cci->size.x; ++vp;++sp;
|
|
||||||
*vp=cci->center.y+(*sp)*cci->size.y; ++vp;++sp;
|
|
||||||
*vp=cci->center.z+(*sp)*cci->size.z; ++vp;++sp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(cci->has_normal)
|
||||||
rc.WriteVAD(VAN::Normal,normals,sizeof(normals));
|
rc.WriteVAD(VAN::Normal,normals,sizeof(normals));
|
||||||
|
|
||||||
|
if(cci->has_tangent)
|
||||||
rc.WriteVAD(VAN::Tangent,tangents,sizeof(tangents));
|
rc.WriteVAD(VAN::Tangent,tangents,sizeof(tangents));
|
||||||
|
|
||||||
if(cci->tile.x==1&&cci->tile.y==1)
|
if(cci->has_tex_coord)
|
||||||
{
|
rc.WriteVAD(VAN::TexCoord,tex_coords,sizeof(tex_coords));
|
||||||
rc.WriteVAD(VAN::TexCoord,tex_coords,sizeof(tex_coords));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AutoDelete<VB2f> tex_coord=rc.CreateVADA<VB2f>(VAN::TexCoord);
|
|
||||||
|
|
||||||
if(tex_coord)
|
|
||||||
{
|
|
||||||
float *tcp=tex_coord->Get();
|
|
||||||
|
|
||||||
const float *tcs=tex_coords;
|
|
||||||
|
|
||||||
for(uint i=0;i<24;i++)
|
|
||||||
{
|
|
||||||
*tcp=(*tcs)*cci->tile.x;++tcs;++tcp;
|
|
||||||
*tcp=(*tcs)*cci->tile.y;++tcs;++tcp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cci->has_color)
|
if(cci->has_color)
|
||||||
{
|
{
|
||||||
@ -1181,23 +1148,7 @@ namespace hgl
|
|||||||
|
|
||||||
if(!vertex)return(nullptr);
|
if(!vertex)return(nullptr);
|
||||||
|
|
||||||
if(cci->center ==Vector3f(0,0,0)
|
rc.WriteVAD(VAN::Position,points,sizeof(points));
|
||||||
&&cci->size ==Vector3f(1,1,1))
|
|
||||||
{
|
|
||||||
rc.WriteVAD(VAN::Position,points,sizeof(points));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const float *sp=points;
|
|
||||||
float *vp=vertex->Get();
|
|
||||||
|
|
||||||
for(uint i=0;i<8;i++)
|
|
||||||
{
|
|
||||||
*vp=cci->center.x+(*sp)*cci->size.x; ++vp;++sp;
|
|
||||||
*vp=cci->center.y+(*sp)*cci->size.y; ++vp;++sp;
|
|
||||||
*vp=cci->center.z+(*sp)*cci->size.z; ++vp;++sp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cci->has_color)
|
if(cci->has_color)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user