| 539 | } |
| 540 | |
| 541 | int SimpleOpenGL2App::registerCubeShape(float halfExtentsX, float halfExtentsY, float halfExtentsZ, int textureIndex, float textureScaling) |
| 542 | { |
| 543 | int strideInBytes = 9 * sizeof(float); |
| 544 | int numVertices = sizeof(cube_vertices_textured) / strideInBytes; |
| 545 | int numIndices = sizeof(cube_indices) / sizeof(int); |
| 546 | |
| 547 | b3AlignedObjectArray<GLInstanceVertex> verts; |
| 548 | verts.resize(numVertices); |
| 549 | for (int i = 0; i < numVertices; i++) |
| 550 | { |
| 551 | verts[i].xyzw[0] = halfExtentsX * cube_vertices_textured[i * 9]; |
| 552 | verts[i].xyzw[1] = halfExtentsY * cube_vertices_textured[i * 9 + 1]; |
| 553 | verts[i].xyzw[2] = halfExtentsZ * cube_vertices_textured[i * 9 + 2]; |
| 554 | verts[i].xyzw[3] = cube_vertices_textured[i * 9 + 3]; |
| 555 | verts[i].normal[0] = cube_vertices_textured[i * 9 + 4]; |
| 556 | verts[i].normal[1] = cube_vertices_textured[i * 9 + 5]; |
| 557 | verts[i].normal[2] = cube_vertices_textured[i * 9 + 6]; |
| 558 | verts[i].uv[0] = cube_vertices_textured[i * 9 + 7] * textureScaling; |
| 559 | verts[i].uv[1] = cube_vertices_textured[i * 9 + 8] * textureScaling; |
| 560 | } |
| 561 | |
| 562 | int shapeId = m_renderer->registerShape(&verts[0].xyzw[0], numVertices, cube_indices, numIndices, B3_GL_TRIANGLES, textureIndex); |
| 563 | return shapeId; |
| 564 | } |
nothing calls this directly
no test coverage detected