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