本文整理汇总了C++中Ptr::AddBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::AddBox方法的具体用法?C++ Ptr::AddBox怎么用?C++ Ptr::AddBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ptr
的用法示例。
在下文中一共展示了Ptr::AddBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateCubeFieldScene
// Creates a grid of cubes.
void PopulateCubeFieldScene(Scene* scene, Fill* fill,
int cubeCountX, int cubeCountY, int cubeCountZ, Vector3f offset,
float cubeSpacing = 0.5f, float cubeSize = 0.1f)
{
Vector3f corner(-(((cubeCountX-1) * cubeSpacing) + cubeSize) * 0.5f,
-(((cubeCountY-1) * cubeSpacing) + cubeSize) * 0.5f,
-(((cubeCountZ-1) * cubeSpacing) + cubeSize) * 0.5f);
corner += offset;
Vector3f pos = corner;
for (int i = 0; i < cubeCountX; i++)
{
// Create a new model for each 'plane' of cubes so we don't exceed
// the vert size limit.
Ptr<Model> model = *new Model();
scene->World.Add(model);
if (fill)
model->Fill = fill;
for (int j = 0; j < cubeCountY; j++)
{
for (int k = 0; k < cubeCountZ; k++)
{
model->AddBox(0xFFFFFFFF, pos, Vector3f(cubeSize, cubeSize, cubeSize));
pos.z += cubeSpacing;
}
pos.z = corner.z;
pos.y += cubeSpacing;
}
pos.y = corner.y;
pos.x += cubeSpacing;
}
}