Beispiel #1
0
void DrawAABox::run(const render::RenderContextPointer& renderContext, const Inputs& box) {
    if (!box.isNull()) {
        static const uint8_t indexData[] = {
            0, 1,
            1, 2,
            2, 3,
            3, 0,
            4, 5,
            5, 6,
            6, 7,
            7, 4,
            0, 4,
            1, 5,
            3, 7,
            2, 6
        };

        if (!_cubeMeshIndices._buffer) {
            auto indices = std::make_shared<gpu::Buffer>(sizeof(indexData), indexData);
            _cubeMeshIndices = gpu::BufferView(indices, gpu::Element(gpu::SCALAR, gpu::UINT8, gpu::INDEX));
        }

        glm::vec3 vertices[8];

        getVertices(box, vertices);

        DrawQuadVolume::run(renderContext, vertices, _cubeMeshIndices, sizeof(indexData) / sizeof(indexData[0]));
    }
}