309 shader.buffer.allocate(shader.cachedData.data(), bytes); |
309 shader.buffer.allocate(shader.cachedData.data(), bytes); |
310 shader.buffer.release(); |
310 shader.buffer.release(); |
311 } |
311 } |
312 } |
312 } |
313 |
313 |
314 ldraw::id_t gl::idFromColor(const std::array<GLubyte, 3>& data) |
314 ModelId gl::idFromColor(const std::array<GLubyte, 3>& data) |
315 { |
315 { |
316 return {data[0] * std::int32_t{0x10000} + data[1] * std::int32_t{0x100} + data[2]}; |
316 return {data[0] * std::int32_t{0x10000} + data[1] * std::int32_t{0x100} + data[2]}; |
317 } |
317 } |
318 |
318 |
319 void gl::bindModelShaderVertexArray(gl::ModelShaders* shaders, gl::ArrayClass arrayClass) |
319 void gl::bindModelShaderVertexArray(gl::ModelShaders* shaders, gl::ArrayClass arrayClass) |
328 ModelShaders::ShaderObject& shaderObject = shaders->shaderObjects[static_cast<int>(arrayClass)]; |
328 ModelShaders::ShaderObject& shaderObject = shaders->shaderObjects[static_cast<int>(arrayClass)]; |
329 shaderObject.program->release(); |
329 shaderObject.program->release(); |
330 shaderObject.vertexArray.release(); |
330 shaderObject.vertexArray.release(); |
331 } |
331 } |
332 |
332 |
333 void gl::setModelShaderSelectedObjects(gl::ModelShaders* shaders, const QSet<ldraw::id_t>& ids) |
333 void gl::setModelShaderSelectedObjects(gl::ModelShaders* shaders, const QSet<ModelId> &ids) |
334 { |
334 { |
335 for (ModelShaders::ShaderObject& object : shaders->shaderObjects) |
335 for (ModelShaders::ShaderObject& object : shaders->shaderObjects) |
336 { |
336 { |
337 std::vector<ModelShaders::Vertex>& vector = object.cachedData; |
337 std::vector<ModelShaders::Vertex>& vector = object.cachedData; |
338 for (ModelShaders::Vertex& vertex : vector) |
338 for (ModelShaders::Vertex& vertex : vector) |