| 302 | } |
| 303 | |
| 304 | void TinyRenderObjectData::registerMeshShape(const float* vertices, int numVertices, const int* indices, int numIndices, const float rgbaColor[4], |
| 305 | unsigned char* textureImage, int textureWidth, int textureHeight) |
| 306 | { |
| 307 | if (0 == m_model) |
| 308 | { |
| 309 | { |
| 310 | B3_PROFILE("setColorRGBA"); |
| 311 | |
| 312 | m_model = new Model(); |
| 313 | m_model->setColorRGBA(rgbaColor); |
| 314 | } |
| 315 | if (textureImage) |
| 316 | { |
| 317 | { |
| 318 | B3_PROFILE("setDiffuseTextureFromData"); |
| 319 | m_model->setDiffuseTextureFromData(textureImage, textureWidth, textureHeight); |
| 320 | } |
| 321 | } |
| 322 | else |
| 323 | { |
| 324 | /*char relativeFileName[1024]; |
| 325 | if (b3ResourcePath::findResourcePath("floor_diffuse.tga", relativeFileName, 1024)) |
| 326 | { |
| 327 | m_model->loadDiffuseTexture(relativeFileName); |
| 328 | } |
| 329 | */ |
| 330 | } |
| 331 | { |
| 332 | B3_PROFILE("reserveMemory"); |
| 333 | m_model->reserveMemory(numVertices, numIndices); |
| 334 | } |
| 335 | { |
| 336 | B3_PROFILE("addVertex"); |
| 337 | for (int i = 0; i < numVertices; i++) |
| 338 | { |
| 339 | m_model->addVertex(vertices[i * 9], |
| 340 | vertices[i * 9 + 1], |
| 341 | vertices[i * 9 + 2], |
| 342 | vertices[i * 9 + 4], |
| 343 | vertices[i * 9 + 5], |
| 344 | vertices[i * 9 + 6], |
| 345 | vertices[i * 9 + 7], |
| 346 | vertices[i * 9 + 8]); |
| 347 | } |
| 348 | } |
| 349 | { |
| 350 | B3_PROFILE("addTriangle"); |
| 351 | for (int i = 0; i < numIndices; i += 3) |
| 352 | { |
| 353 | m_model->addTriangle(indices[i], indices[i], indices[i], |
| 354 | indices[i + 1], indices[i + 1], indices[i + 1], |
| 355 | indices[i + 2], indices[i + 2], indices[i + 2]); |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | void TinyRenderObjectData::registerMesh2(btAlignedObjectArray<btVector3>& vertices, btAlignedObjectArray<btVector3>& normals, btAlignedObjectArray<int>& indices, CommonFileIOInterface* fileIO) |
no test coverage detected