| 715 | } |
| 716 | |
| 717 | int SimpleOpenGL3App::registerCubeShape(float halfExtentsX, float halfExtentsY, float halfExtentsZ, int textureIndex, float textureScaling) |
| 718 | { |
| 719 | int strideInBytes = 9 * sizeof(float); |
| 720 | int numVertices = sizeof(cube_vertices_textured) / strideInBytes; |
| 721 | int numIndices = sizeof(cube_indices) / sizeof(int); |
| 722 | |
| 723 | b3AlignedObjectArray<GfxVertexFormat1> verts; |
| 724 | verts.resize(numVertices); |
| 725 | for (int i = 0; i < numVertices; i++) |
| 726 | { |
| 727 | verts[i].x = halfExtentsX * cube_vertices_textured[i * 9]; |
| 728 | verts[i].y = halfExtentsY * cube_vertices_textured[i * 9 + 1]; |
| 729 | verts[i].z = halfExtentsZ * cube_vertices_textured[i * 9 + 2]; |
| 730 | verts[i].w = cube_vertices_textured[i * 9 + 3]; |
| 731 | verts[i].nx = cube_vertices_textured[i * 9 + 4]; |
| 732 | verts[i].ny = cube_vertices_textured[i * 9 + 5]; |
| 733 | verts[i].nz = cube_vertices_textured[i * 9 + 6]; |
| 734 | verts[i].u = cube_vertices_textured[i * 9 + 7] * textureScaling; |
| 735 | verts[i].v = cube_vertices_textured[i * 9 + 8] * textureScaling; |
| 736 | } |
| 737 | |
| 738 | int shapeId = m_instancingRenderer->registerShape(&verts[0].x, numVertices, cube_indices, numIndices, B3_GL_TRIANGLES, textureIndex); |
| 739 | return shapeId; |
| 740 | } |
| 741 | |
| 742 | void SimpleOpenGL3App::registerGrid(int cells_x, int cells_z, float color0[4], float color1[4]) |
| 743 | { |
no test coverage detected