MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / drawBoxImpl

Method drawBoxImpl

Rendering/layers/Box.cpp:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9void RendererWGPU::drawBoxImpl(const glm::vec3& worldSize) {
10 if (worldSize != lineLayer_.cachedBoxSize) {
11 lineLayer_.cachedBoxSize = worldSize;
12 const float x1 = lineLayer_.cachedBoxSize.x;
13 const float y1 = lineLayer_.cachedBoxSize.y;
14 const float z1 = lineLayer_.cachedBoxSize.z;
15 lineLayer_.boxVertices = {
16 0, y1, 0, x1, y1, 0, x1, y1, 0, x1, y1, z1, x1, y1, z1, 0, y1, z1, 0, y1, z1, 0, y1, 0,
17 0, 0, 0, x1, 0, 0, x1, 0, 0, x1, 0, z1, x1, 0, z1, 0, 0, z1, 0, 0, z1, 0, 0, 0,
18 0, 0, 0, 0, y1, 0, x1, 0, 0, x1, y1, 0, x1, 0, z1, x1, y1, z1, 0, 0, z1, 0, y1, z1,
19 };
20 WGPUContext::instance().queue()->writeBuffer(*lineLayer_.boxVb, 0, lineLayer_.boxVertices.data(), sizeof(lineLayer_.boxVertices));
21 }
22
23 currentPass->setPipeline(*pipelines_.box);
24 currentPass->setBindGroup(0, *lineLayer_.bindGroups[lineUniformSlotIndex_ - 1], 0, nullptr);
25 currentPass->setVertexBuffer(0, *lineLayer_.boxVb, 0, sizeof(lineLayer_.boxVertices));
26 currentPass->draw(24, 1, 0, 0);
27}
28
29void RendererWGPU::setLineColor(const glm::vec4& color) {
30 if (lineUniformSlotIndex_ >= kLineUniformSlotCount) {

Callers

nothing calls this directly

Calls 1

drawMethod · 0.45

Tested by

no test coverage detected