MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / registerCubeShape

Method registerCubeShape

examples/OpenGLWindow/SimpleOpenGL3App.cpp:717–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717int 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
742void SimpleOpenGL3App::registerGrid(int cells_x, int cells_z, float color0[4], float color1[4])
743{

Callers 7

mainFunction · 0.45
TutorialMethod · 0.45
mainFunction · 0.45
BInitMethod · 0.45
CoordinateSystemDemoMethod · 0.45
RenderInstancingDemoMethod · 0.45

Calls 2

resizeMethod · 0.45
registerShapeMethod · 0.45

Tested by

no test coverage detected