예제 #1
0
void CC3Billboard::populateAsBoundingRectangle()
{
	CC3Vector* vertices;		// Array of simple vertex location data

	// Start with default initial values
	GLfloat xMin = 0.0f;
	GLfloat xMax = 1.0f;
	GLfloat yMin = 0.0f;
	GLfloat yMax = 1.0f;
	int vCount = 4;
	
	CC3VertexLocations* locArray = CC3VertexLocations::vertexArray();
	locArray->setDrawingMode( GL_TRIANGLE_STRIP );			// Location array will do the drawing as a strip
	locArray->setVertexStride( 0 );							// Tightly packed locations only
	locArray->setElementOffset( 0 );							// Only locations
	locArray->setAllocatedVertexCapacity( vCount );
	vertices = (CC3Vector*)locArray->getVertices();
	
	// Populate vertex locations in the X-Y plane
	vertices[0] = cc3v(xMax, yMax, 0.0f);
	vertices[1] = cc3v(xMin, yMax, 0.0f);
	vertices[2] = cc3v(xMax, yMin, 0.0f);
	vertices[3] = cc3v(xMin, yMin, 0.0f);
	
	// Create mesh with vertex location array
	CC3Mesh* aMesh = CC3Mesh::mesh();
	aMesh->setVertexLocations( locArray );
	setMesh( aMesh );

	updateBoundingMesh();
}
예제 #2
0
void CC3ShadowVolumeMeshNode::createShadowMesh()
{
	GLuint vertexCount = getShadowCaster()->getVertexCount();
	
	// Create vertexLocation array.
	CC3VertexLocations* locArray = CC3VertexLocations::vertexArray();
	locArray->setDrawingMode( GL_TRIANGLES );
	locArray->setElementSize( 4 );						// We're using homogeneous coordinates!
	locArray->setAllocatedVertexCapacity( vertexCount );
	locArray->setVertexCount( 0 );						// Will be populated dynamically
	locArray->setShouldReleaseRedundantContent( false );	// Shadow vertex data is dynamic
	
	CC3Mesh* aMesh = CC3Mesh::mesh();
	aMesh->setVertexLocations( locArray );
	setMesh( aMesh );
}
예제 #3
0
void CC3TouchBox::populateBox( const CC3Box& aBox )
{
	CC3Mesh* mesh = prepareParametricMesh();
	
	// Now update the vertex locations with the box data
	GLuint vIdx = 0;
	CC3Vector bbMin = aBox.minimum;
	CC3Vector bbMax = aBox.maximum;
	mesh->setVertexLocation( cc3v(bbMin.x, bbMin.y, bbMin.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMin.x, bbMin.y, bbMax.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMin.x, bbMax.y, bbMin.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMin.x, bbMax.y, bbMax.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMax.x, bbMin.y, bbMin.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMax.x, bbMin.y, bbMax.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMax.x, bbMax.y, bbMin.z), vIdx++ );
	mesh->setVertexLocation( cc3v(bbMax.x, bbMax.y, bbMax.z), vIdx++ );
	
	mesh->updateVertexLocationsGLBuffer();
	markBoundingVolumeDirty();
}
예제 #4
0
void CC3MeshNode::populateAsHollowConeWithRadius( GLfloat radius, GLfloat height, const CC3Tessellation& angleAndHeightDivs )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsHollowConeWithRadius( radius, height, angleAndHeightDivs );
}
예제 #5
0
void CC3MeshNode::populateAsCubeMappedSolidBox( const CC3Box& box )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsCubeMappedSolidBox( box );
}
예제 #6
0
void CC3MeshNode::populateAsSolidBox( const CC3Box& box, const CCPoint& corner )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsSolidBox( box, corner );
}
예제 #7
0
void CC3MeshNode::populateAsDiskWithRadius( GLfloat radius, const CC3Tessellation& radialAndAngleDivs )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsDiskWithRadius( radius, radialAndAngleDivs );
}
예제 #8
0
void CC3MeshNode::populateAsWireBox( const CC3Box& box )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsWireBox( box );
}
예제 #9
0
void CC3MeshNode::populateAsLineStripWith( GLuint vertexCount, CC3Vector* vertices, bool shouldRetainVertices )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsLineStripWith( vertexCount, vertices, shouldRetainVertices );
}
예제 #10
0
void CC3MeshNode::populateAsRectangleWithSize( const CCSize& rectSize, const CCPoint& origin, const CC3Tessellation& divsPerAxis )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsRectangleWithSize( rectSize, origin, divsPerAxis );
}
예제 #11
0
void CC3MeshNode::populateAsRectangleWithSize( const CCSize& rectSize, const CCPoint& origin )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsRectangleWithSize( rectSize, origin );
}
예제 #12
0
void CC3MeshNode::populateAsCenteredRectangleWithSize( const CCSize& rectSize )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsCenteredRectangleWithSize( rectSize );
}
예제 #13
0
void CC3MeshNode::populateAsSphereWithRadius( GLfloat radius, const CC3Tessellation& divsPerAxis )
{
	CC3Mesh* pMesh = prepareParametricMesh();
	if ( pMesh )
		pMesh->populateAsSphereWithRadius( radius, divsPerAxis );
}