src/gl/compiler.cpp

changeset 50
0f80a2e5e42b
parent 49
d56cc7387dad
child 51
1a9eac27698d
equal deleted inserted replaced
49:d56cc7387dad 50:0f80a2e5e42b
164 } 164 }
165 constexpr int stride = sizeof(gl::Vertex); 165 constexpr int stride = sizeof(gl::Vertex);
166 object.program->setAttributeBuffer(0, GL_FLOAT, offsetof(gl::Vertex, position), 3, stride); 166 object.program->setAttributeBuffer(0, GL_FLOAT, offsetof(gl::Vertex, position), 3, stride);
167 object.program->setAttributeBuffer(1, GL_FLOAT, offsetof(gl::Vertex, color), 4, stride); 167 object.program->setAttributeBuffer(1, GL_FLOAT, offsetof(gl::Vertex, color), 4, stride);
168 object.program->setAttributeBuffer(2, GL_FLOAT, offsetof(gl::Vertex, normal), 3, stride); 168 object.program->setAttributeBuffer(2, GL_FLOAT, offsetof(gl::Vertex, normal), 3, stride);
169 glVertexAttribIPointer(3, 1, GL_INT, stride, (void*)offsetof(gl::Vertex, id)); 169 glVertexAttribIPointer(3, 1, GL_INT, stride, reinterpret_cast<void*>(offsetof(gl::Vertex, id)));
170 object.vertexArray.release(); 170 object.vertexArray.release();
171 object.buffer.release(); 171 object.buffer.release();
172 object.program->release(); 172 object.program->release();
173 } 173 }
174 this->initialized = true; 174 this->initialized = true;
264 glm::vec3 gl::Compiler::modelCenter() const 264 glm::vec3 gl::Compiler::modelCenter() const
265 { 265 {
266 return boxCenter(this->boundingBox); 266 return boxCenter(this->boundingBox);
267 } 267 }
268 268
269 double gl::Compiler::modelDistance() const 269 float gl::Compiler::modelDistance() const
270 { 270 {
271 return longestMeasure(this->boundingBox); 271 return longestMeasure(this->boundingBox);
272 } 272 }
273 273
274 void gl::Compiler::bindVertexArray(gl::ArrayClass arrayClass) 274 void gl::Compiler::bindVertexArray(gl::ArrayClass arrayClass)

mercurial