本文整理汇总了C++中BoundingBox::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::draw方法的具体用法?C++ BoundingBox::draw怎么用?C++ BoundingBox::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderGroup
BoundingBox RenderGroup(SceneGroup *i, vec3 color, int lod, int depth)
{
int ii;
BoundingBox bbox;
// if this is a terminal node
if (i->getChildCount() == 0) {
// set the correct color for the polygon
glColor3f(color[0],color[1],color[2]);
// draw the polygon if LOD == 3
if (lod == 3)
i->getPolygon()->draw(GL_POLYGON);
// draw the polygon outline if LOD == 2
else if (lod == 2)
i->getPolygon()->draw(GL_LINE_LOOP);
// draw the bounding box
setColor(depth);
i->getPolygon()->getBoundingBox().draw();
// return the polygon's bounding box
return i->getPolygon()->getBoundingBox();
} else {
// expand and traverse this node
for(ii=0; ii<i->getChildCount();ii++)
bbox.expand(RenderInstance(i->getChild(ii), color, lod, depth+1));
// draw this group's bounding box
setColor(depth);
bbox.draw();
}
return bbox;
}
示例2: buildMap
void LevelRenderer::buildMap()
{
GrassModel::teamNumber = false;
TextureManager::getInstance()->toggleTextures(true);
TextureManager::getInstance()->toggleSkins(0);
//SKIN1 W/OUT TEAM NUMBER ----------------------------------------------------------------------------------------
glNewList(2, GL_COMPILE);
/*for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
glPushMatrix();
glTranslatef((GLfloat)j, (GLfloat)0, (GLfloat)i);
models[ level[i][j] ]->draw();
glPopMatrix();
}
}*/
for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
glPushMatrix();
if (level[i][j]==0 || level[i][j]==11)
{
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glStencilFunc(GL_ALWAYS, 10, ~0);
}
glTranslatef((GLfloat)j, (GLfloat)0, (GLfloat)i);
models[ level[i][j] ]->draw();
//also draw a grass tile under models
if(level[i][j] >=11) {
models[0]->draw();
}
glDisable(GL_STENCIL_TEST);
glPopMatrix();
}
}
//SHADOWS-----------------------------------
//glDisable(GL_LIGHTING);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_COLOR_MATERIAL);
glEnable(GL_BLEND);
for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
if(level[i][j]!=0 && level[i][j]!=3 && level[i][j]!= 8 && level[i][j]!= 9 && level[i][j]!= 10) {
glPushMatrix();
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_EQUAL, 10, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
//glColor4f(0.0, 0.0, 0.0, 0.5f);
glTranslatef((GLfloat)j, (GLfloat)0.02, (GLfloat)i);
if(i < rows/2 && j < columns/2) {
shadowMatrix(light1->getPosX()-j, light1->getPosY()*2, light1->getPosZ()-i, 1.0f);
glColor4f(0.0f, 0.0f, 0.0f, calculateAlpha((GLfloat)j, (GLfloat)i, 0.0f, 0.0f, (GLfloat)rows, (GLfloat)columns));
}
else if(i< rows/2 && j <= columns) {
shadowMatrix(light2->getPosX()-j, light2->getPosY()*2, light2->getPosZ()-i, 1.0f);
glColor4f(0.0f, 0.0f, 0.0f, calculateAlpha((GLfloat)j, (GLfloat)i, (GLfloat)columns, 0.0f, (GLfloat)rows, (GLfloat)columns));
}
else if(i<= rows && j < columns/2) {
shadowMatrix(light4->getPosX()-j, light4->getPosY()*2, light4->getPosZ()-i, 1.0f);
glColor4f(0.0, 0.0, 0.0, calculateAlpha((GLfloat)j, (GLfloat)i, 0.0f, (GLfloat)rows, (GLfloat)rows, (GLfloat)columns));
}
else if(i<= rows && j <= columns) {
shadowMatrix(light3->getPosX()-j, light3->getPosY()*2, light3->getPosZ()-i, 1.0f);
glColor4f(0.0, 0.0, 0.0, calculateAlpha((GLfloat)j, (GLfloat)i, (GLfloat)columns, (GLfloat)rows, (GLfloat)rows, (GLfloat)columns));
}
models[ level[i][j] ]->draw();
glDisable(GL_STENCIL_TEST);
glPopMatrix();
}
}
}
//glEnable(GL_DEPTH_TEST);
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
//-------------------------------------------
glEndList();
//SKIN2 W/OUT TEAM NUMBER ----------------------------------------------------------------------------------------
glNewList(6, GL_COMPILE);
TextureManager::getInstance()->toggleSkins(1);
for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
glPushMatrix();
if (level[i][j]==0 || level[i][j]==11)
//.........这里部分代码省略.........