void CCSceneCollideable::renderCollisionBox() { GLPushMatrix(); { GLScalef( collisionBounds.x, collisionBounds.y, collisionBounds.z ); //glColor4f( 1.0f, 1.0f, 0.0f, 0.5f ); //RenderCube( true ); gEngine->textureManager->setTextureIndex( 0 ); GLRotatef( -rotation.y, 0.0f, 1.0f, 0.0f ); static CCColour colour( 1.0f, 0.0f, 0.0f, 0.5f ); CCSetColour( colour ); CCRenderCube( true ); } GLPopMatrix(); }
void CCPathFinderNetwork::view() { if( nodes.length > 0 && connectingNodes == false ) { gEngine->textureManager->setTextureIndex( 1 ); const CCColour nodeColour = CCColour( 1.0f, 0.0f, 0.0f, 1.0f ); const CCColour pathColour = CCColour( 1.0f, 1.0f, 1.0f, 1.0f ); CCSetColour( nodeColour ); for( int i=0; i<nodes.length; ++i ) { const PathNode *node = nodes.list[i]; GLPushMatrix(); GLTranslatef( node->point.x, node->point.y, node->point.z ); CCRenderCube( true ); GLPopMatrix(); } static CCVector3 start, end; { GLVertexPointer( 3, GL_FLOAT, sizeof( PathNode ), &nodes.list[0]->point, nodes.length ); #ifndef DXRENDERER GLDrawArrays( GL_POINTS, 0, nodes.length ); #endif for( int i=0; i<nodes.length; ++i ) { const PathNode *node = nodes.list[i]; const CCList<PathNode::PathConnection> &connections = node->connections; for( int j=0; j<connections.length; ++j ) { const PathNode::PathConnection *connection = connections.list[j]; start.set( node->point.x, 2.0f, node->point.z ); end.set( connection->node->point.x, 2.0f, connection->node->point.z ); CCRenderLine( start, end ); } } } if( pathingFrom != NULL ) { CCRenderer::CCSetDepthRead( false ); CCSetColour( pathColour ); const PathNode *currentNode = pathingFrom; for( int i=0; i<path.endDirection; ++i ) { const int connectionIndex = path.directions[i]; const CCList<PathNode::PathConnection> &connections = currentNode->connections; if( connectionIndex < connections.length ) { const PathNode::PathConnection *connection = connections.list[connectionIndex]; const PathNode *toNode = connection->node; ASSERT( toNode != NULL ); start.set( currentNode->point.x, 5.0f, currentNode->point.z ); end.set( toNode->point.x, 5.0f, toNode->point.z ); CCRenderLine( start, end ); currentNode = toNode; } } CCRenderer::CCSetDepthRead( true ); } } }