34 Ogre::String
const & name,
40 Ogre::String
const& face_material_name,
41 Ogre::String
const& face_material_rg,
42 Ogre::String
const& band_material_name,
43 Ogre::String
const& band_material_rg,
49 , m_gfx_actor(gfx_actor)
63 size_t vertex_count = 4*nrays+2;
66 vertex_count+=2*nrays;
75 for (i=0; i<nrays; i++)
99 const bool odd_num_rays = (nrays % 2 == 0);
100 for (i=0; i<nrays; i++)
103 int band_vert = 2+2*nrays+i*2;
106 if (odd_num_rays && ((i+1) == nrays))
109 m_vertices[band_vert].texcoord=Vector2(0.5, 0.0);
110 m_vertices[band_vert+1].texcoord=Vector2(0.5, 1.0);
114 m_vertices[band_vert].texcoord=Vector2(0.0, 0.0);
115 m_vertices[band_vert+1].texcoord=Vector2(0.0, 1.0);
120 m_vertices[band_vert].texcoord=Vector2(1.0, 0.0);
121 m_vertices[band_vert+1].texcoord=Vector2(1.0, 1.0);
127 m_vertices[2+i*2].texcoord=Vector2(0.5+0.5*rim_ratio*sin((
float)i*2.0*3.14159/nrays), 0.5+0.5*rim_ratio*cos((
float)i*2.0*3.14159/nrays));
129 m_vertices[2+4*nrays+i*2].texcoord=Vector2(0.5+0.5*sin(((
float)i+0.5)*2.0*3.14159/nrays), 0.5+0.5*cos(((
float)i+0.5)*2.0*3.14159/nrays));
133 m_vertices[2+i*2].texcoord=Vector2(0.5+0.5*sin(i*2.0*3.14159/nrays), 0.5+0.5*cos(i*2.0*3.14159/nrays));
140 size_t tiretread_num_indices = 3*2*nrays;
141 size_t wheelface_num_indices = 3*2*nrays;
142 if (
m_is_rimmed) wheelface_num_indices=wheelface_num_indices*3;
145 for (i=0; i<nrays; i++)
166 m_mesh->sharedVertexData =
new VertexData();
167 m_mesh->sharedVertexData->vertexCount = vertex_count;
173 offset += VertexElement::getTypeSize(VET_FLOAT3);
175 offset += VertexElement::getTypeSize(VET_FLOAT3);
178 m_vertex_format->addElement(0, offset, VET_FLOAT2, VES_TEXTURE_COORDINATES, 0);
179 offset += VertexElement::getTypeSize(VET_FLOAT2);
184 HardwareBufferManager::getSingleton().createVertexBuffer(
185 offset,
m_mesh->sharedVertexData->vertexCount, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
191 VertexBufferBinding* bind =
m_mesh->sharedVertexData->vertexBufferBinding;
196 HardwareIndexBufferSharedPtr faceibuf = HardwareBufferManager::getSingleton().
198 HardwareIndexBuffer::IT_16BIT,
199 wheelface_num_indices,
200 HardwareBuffer::HBU_STATIC_WRITE_ONLY);
213 HardwareIndexBufferSharedPtr bandibuf = HardwareBufferManager::getSingleton().
215 HardwareIndexBuffer::IT_16BIT,
216 tiretread_num_indices,
217 HardwareBuffer::HBU_STATIC_WRITE_ONLY);
229 m_mesh->_setBounds(AxisAlignedBox(-1,-1,0,1,1,0),
true);
238 Ogre::MeshManager::getSingleton().remove(
m_mesh->getName());