Пример #1
0
CC3Mesh* CC3MeshNode::prepareParametricMesh()
{
	if (getVertexContentTypes() == kCC3VertexContentNone) 
	{
		setVertexContentTypes( (CC3VertexContent)(kCC3VertexContentLocation |
			kCC3VertexContentNormal |
			kCC3VertexContentTextureCoordinates) );
	}

	return _mesh;
}
void CC3MeshParticleEmitter::setParticleTemplateMesh( CC3Mesh* aMesh )
{
	if (aMesh == m_pParticleTemplateMesh) 
		return;
	
	CC_SAFE_RELEASE( m_pParticleTemplateMesh );
	m_pParticleTemplateMesh = aMesh;
	CC_SAFE_RETAIN( aMesh );

	// Add vertex content if not already set, and align the drawing mode
	if ( getVertexContentTypes() == kCC3VertexContentNone )
		setVertexContentTypes( aMesh->getVertexContentTypes() );

	setDrawingMode( aMesh->getDrawingMode() );

	CC3_TRACE( "[ptc]Particle template mesh of CC3MeshParticleEmitter set to %s drawing %s with %d vertices and %d vertex indices",
			 aMesh->fullDescription().c_str(), stringFromGLEnum(getDrawingMode()).c_str(),
			 aMesh->getVertexCount(), aMesh->getVertexIndexCount() );
}
Пример #3
0
/** Overridden because we only need vertex locations, and to allocate and populate indices. */
CC3Mesh* CC3TouchBox::prepareParametricMesh()
{
	if (m_pMesh) 
		return m_pMesh;
	
	if (getVertexContentTypes() == kCC3VertexContentNone)
		setVertexContentTypes( kCC3VertexContentLocation );
	
	// Prepare the vertex content and allocate space for vertices and indices.
	m_pMesh->setAllocatedVertexCapacity( 8 );
	m_pMesh->setAllocatedVertexIndexCapacity( 36 );
	
	GLuint vIdx = 0;
	
	// Front
	m_pMesh->setVertexIndex( 1, vIdx++ );
	m_pMesh->setVertexIndex( 5, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 3, vIdx++ );
	m_pMesh->setVertexIndex( 1, vIdx++ );
						 	 		 
	// Back				 	 		 
	m_pMesh->setVertexIndex( 0, vIdx++ );
	m_pMesh->setVertexIndex( 2, vIdx++ );
	m_pMesh->setVertexIndex( 6, vIdx++ );
	m_pMesh->setVertexIndex( 6, vIdx++ );
	m_pMesh->setVertexIndex( 4, vIdx++ );
	m_pMesh->setVertexIndex( 0, vIdx++ );
						 			 
	// Left				 	 		 
	m_pMesh->setVertexIndex( 0, vIdx++ );
	m_pMesh->setVertexIndex( 1, vIdx++ );
	m_pMesh->setVertexIndex( 3, vIdx++ );
	m_pMesh->setVertexIndex( 3, vIdx++ );
	m_pMesh->setVertexIndex( 2, vIdx++ );
	m_pMesh->setVertexIndex( 0, vIdx++ );
						 			 
	// Right			 	 		 
	m_pMesh->setVertexIndex( 4, vIdx++ );
	m_pMesh->setVertexIndex( 6, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 5, vIdx++ );
	m_pMesh->setVertexIndex( 4, vIdx++ );
							 		 
	// Top					 		 
	m_pMesh->setVertexIndex( 2, vIdx++ );
	m_pMesh->setVertexIndex( 3, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 7, vIdx++ );
	m_pMesh->setVertexIndex( 6, vIdx++ );
	m_pMesh->setVertexIndex( 2, vIdx++ );
									 
	// Bottom				 		 
	m_pMesh->setVertexIndex( 0, vIdx++ );
	m_pMesh->setVertexIndex( 4, vIdx++ );
	m_pMesh->setVertexIndex( 5, vIdx++ );
	m_pMesh->setVertexIndex( 5, vIdx++ );
	m_pMesh->setVertexIndex( 1, vIdx++ );
	m_pMesh->setVertexIndex( 0, vIdx++ );
	
	return m_pMesh;
}