| 23 | using namespace Ogre; |
| 24 | |
| 25 | void GeomUtils::createSphere( const String& strName |
| 26 | , float radius |
| 27 | , int nRings, int nSegments |
| 28 | , bool bNormals |
| 29 | , bool bTexCoords) |
| 30 | { |
| 31 | MeshPtr pSphere = MeshManager::getSingleton().createManual(strName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); |
| 32 | SubMesh *pSphereVertex = pSphere->createSubMesh(); |
| 33 | pSphere->createVertexData(); |
| 34 | |
| 35 | createSphere(pSphere->sharedVertexData, pSphereVertex->indexData |
| 36 | , radius |
| 37 | , nRings, nSegments |
| 38 | , bNormals // need normals |
| 39 | , bTexCoords // need texture co-ordinates |
| 40 | ); |
| 41 | |
| 42 | // Generate face list |
| 43 | pSphereVertex->useSharedVertices = true; |
| 44 | |
| 45 | // the original code was missing this line: |
| 46 | pSphere->_setBounds( AxisAlignedBox( Vector3(-radius, -radius, -radius), Vector3(radius, radius, radius) ), false ); |
| 47 | pSphere->_setBoundingSphereRadius(radius); |
| 48 | // this line makes clear the mesh is loaded (avoids memory leaks) |
| 49 | pSphere->load(); |
| 50 | } |
| 51 | |
| 52 | void GeomUtils::createSphere(VertexData*& vertexData, IndexData*& indexData |
| 53 | , float radius |
nothing calls this directly
no test coverage detected