AxisCreateInfo/CubeCreateInfo增加新的构造函数,直接支持AABB

This commit is contained in:
hyzboy 2020-06-03 17:39:36 +08:00
parent 51780a68ee
commit 043d5608d0
3 changed files with 36 additions and 19 deletions

View File

@ -131,20 +131,14 @@ private:
}
{
AxisCreateInfo aci;
aci.root=model_data->bounding_box.CenterPoint().xyz();
aci.size=model_data->bounding_box.HalfSize().xyz();
AxisCreateInfo aci(model_data->bounding_box);
axis_renderable=CreateRenderableAxis(db,material,&aci);
axis_renderable_instance=db->CreateRenderableInstance(pipeline_lines,material_instance,axis_renderable);
}
{
CubeCreateInfo cci;
cci.center=model_data->bounding_box.CenterPoint().xyz();
cci.size=model_data->bounding_box.Size().xyz();
CubeCreateInfo cci(model_data->bounding_box);
bbox_renderable=CreateRenderableBoundingBox(db,material,&cci);
bbox_renderable_instance=db->CreateRenderableInstance(pipeline_lines,material_instance,bbox_renderable);

View File

@ -130,20 +130,14 @@ private:
}
{
AxisCreateInfo aci;
aci.root=model_data->bounding_box.CenterPoint().xyz();
aci.size=model_data->bounding_box.HalfSize().xyz();
AxisCreateInfo aci(model_data->bounding_box);
axis_renderable=CreateRenderableAxis(db,material,&aci);
axis_renderable_instance=db->CreateRenderableInstance(pipeline_lines,material_instance,axis_renderable);
}
{
CubeCreateInfo cci;
cci.center=model_data->bounding_box.CenterPoint().xyz();
cci.size=model_data->bounding_box.Size().xyz();
CubeCreateInfo cci(model_data->bounding_box);
bbox_renderable=CreateRenderableBoundingBox(db,material,&cci);
bbox_renderable_instance=db->CreateRenderableInstance(pipeline_lines,material_instance,bbox_renderable);

View File

@ -95,6 +95,12 @@ namespace hgl
Vector2f tile;
public:
void Set(const AABB &box)
{
center=box.CenterPoint().xyz();
size=box.HalfSize().xyz();
}
CubeCreateInfo()
{
@ -102,6 +108,12 @@ namespace hgl
size.Set(1,1,1);
tile.Set(1,1);
}
CubeCreateInfo(const AABB &box)
{
Set(box);
tile.Set(1,1);
}
};//struct CubeCreateInfo
/**
@ -177,13 +189,30 @@ namespace hgl
public:
void RestartColor()
{
color[0].Set(1,0,0,1);
color[1].Set(0,1,0,1);
color[2].Set(0,0,1,1);
}
void Set(const AABB &box)
{
root=box.CenterPoint().xyz();
size=box.HalfSize().xyz();
}
AxisCreateInfo()
{
root.Set(0,0,0);
size.Set(1,1,1);
color[0].Set(1,0,0,1);
color[1].Set(0,1,0,1);
color[2].Set(0,0,1,1);
RestartColor();
}
AxisCreateInfo(const AABB &box)
{
Set(box);
RestartColor();
}
};//struct AxisCreateInfo