src/gl/vertexprogram.cpp

changeset 120
8c9fff699241
parent 119
24275a4064f4
child 172
50f055543ff6
equal deleted inserted replaced
119:24275a4064f4 120:8c9fff699241
100 this->fragmentStyle = newFragmentStyle; 100 this->fragmentStyle = newFragmentStyle;
101 } 101 }
102 102
103 void VertexProgram::build(const Document *document) 103 void VertexProgram::build(const Document *document)
104 { 104 {
105 constexpr float size = 1;
106 constexpr glm::vec3 color = {0.0, 1.0, 1.0}; 105 constexpr glm::vec3 color = {0.0, 1.0, 1.0};
107 this->data.clear(); 106 this->data.clear();
108 document->applyToVertices([&](const glm::vec3& vertex, const std::set<ldraw::id_t>&) 107 document->applyToVertices([&](const glm::vec3&, const VertexMap::VertexInfo& info)
109 { 108 {
110 reserveMore(this->data, ::countof(::markerGeometry)); 109 reserveMore(this->data, ::countof(::markerGeometry));
111 for (const glm::vec3& point : ::markerGeometry) 110 for (const glm::vec3& point : ::markerGeometry)
112 { 111 {
113 this->data.push_back({vertex + point * size, color}); 112 const glm::vec3 transformed = info.transform * glm::vec4{point, 1};
113 this->data.push_back({transformed, color});
114 } 114 }
115 }); 115 });
116 this->buffer.bind(); 116 this->buffer.bind();
117 this->buffer.allocate(this->vertexData(), this->vertexCount() * this->vertexSize()); 117 this->buffer.allocate(this->vertexData(), this->vertexCount() * this->vertexSize());
118 this->buffer.release(); 118 this->buffer.release();

mercurial