add color support in CreateRenderableBoundingBox()
This commit is contained in:
parent
ccec02c58b
commit
0d6f7758ec
@ -194,6 +194,9 @@ private:
|
|||||||
{
|
{
|
||||||
CubeCreateInfo cci(model_data->bounding_box);
|
CubeCreateInfo cci(model_data->bounding_box);
|
||||||
|
|
||||||
|
cci.has_color=true;
|
||||||
|
cci.color.Set(1,1,1,1);
|
||||||
|
|
||||||
bbox_renderable=CreateRenderableBoundingBox(db,mp_line.material,&cci);
|
bbox_renderable=CreateRenderableBoundingBox(db,mp_line.material,&cci);
|
||||||
bbox_renderable_instance=CreateRenderableInstance(mp_line,bbox_renderable);
|
bbox_renderable_instance=CreateRenderableInstance(mp_line,bbox_renderable);
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,15 @@ namespace hgl
|
|||||||
Vector3f size;
|
Vector3f size;
|
||||||
Vector2f tile;
|
Vector2f tile;
|
||||||
|
|
||||||
|
bool has_color;
|
||||||
|
Vector4f color;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void Set(const AABB &box)
|
void Set(const AABB &box)
|
||||||
{
|
{
|
||||||
center=box.CenterPoint().xyz();
|
center=box.CenterPoint().xyz();
|
||||||
size=box.HalfSize().xyz();
|
size=box.Size().xyz();
|
||||||
}
|
}
|
||||||
|
|
||||||
CubeCreateInfo()
|
CubeCreateInfo()
|
||||||
@ -107,12 +110,16 @@ namespace hgl
|
|||||||
center.Set(0,0,0);
|
center.Set(0,0,0);
|
||||||
size.Set(1,1,1);
|
size.Set(1,1,1);
|
||||||
tile.Set(1,1);
|
tile.Set(1,1);
|
||||||
|
|
||||||
|
has_color=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CubeCreateInfo(const AABB &box)
|
CubeCreateInfo(const AABB &box)
|
||||||
{
|
{
|
||||||
Set(box);
|
Set(box);
|
||||||
tile.Set(1,1);
|
tile.Set(1,1);
|
||||||
|
|
||||||
|
has_color=false;
|
||||||
}
|
}
|
||||||
};//struct CubeCreateInfo
|
};//struct CubeCreateInfo
|
||||||
|
|
||||||
|
@ -1263,6 +1263,20 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(cci->has_color)
|
||||||
|
{
|
||||||
|
float *color_pointer=gc.GetColorPointer();
|
||||||
|
|
||||||
|
if(color_pointer)
|
||||||
|
{
|
||||||
|
for(uint i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
memcpy(color_pointer,&(cci->color),4*sizeof(float));
|
||||||
|
color_pointer+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gc.CreateIBO16(24,indices);
|
gc.CreateIBO16(24,indices);
|
||||||
|
|
||||||
return gc.Finish();
|
return gc.Finish();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user