src/gl/vertexprogram.cpp

changeset 214
8e1fe64ce4e3
parent 200
ca23936b455b
equal deleted inserted replaced
213:ee5758ddb6d2 214:8e1fe64ce4e3
118 void VertexProgram::setFragmentStyle(const FragmentStyle newFragmentStyle) 118 void VertexProgram::setFragmentStyle(const FragmentStyle newFragmentStyle)
119 { 119 {
120 this->fragmentStyle = newFragmentStyle; 120 this->fragmentStyle = newFragmentStyle;
121 } 121 }
122 122
123 void VertexProgram::build(const EditorTabWidget *document) 123 void VertexProgram::build(const VertexMap* vertexMap)
124 { 124 {
125 constexpr glm::vec3 color = {0.0, 1.0, 1.0}; 125 constexpr glm::vec3 color = {0.0, 1.0, 1.0};
126 this->data.clear(); 126 this->data.clear();
127 const std::vector<glm::vec3> sphere = ::sphere(8 / 2); 127 const std::vector<glm::vec3> sphere = ::sphere(8 / 2);
128 document->applyToVertices([&](const glm::vec3&, const VertexMap::VertexInfo& info) 128 vertexMap->apply([&](const glm::vec3&, const VertexMap::VertexInfo& info)
129 { 129 {
130 reserveMore(this->data, sphere.size()); 130 reserveMore(this->data, sphere.size());
131 for (const glm::vec3& point : sphere) 131 for (const glm::vec3& point : sphere)
132 { 132 {
133 const glm::vec3 transformed = glm::scale(info.transform, glm::vec3{0.5, 0.5, 0.5}) * glm::vec4{point, 1}; 133 const glm::vec3 transformed = glm::scale(info.transform, glm::vec3{0.5, 0.5, 0.5}) * glm::vec4{point, 1};

mercurial