-
-void OutlineModel::Update() noexcept {
- glBindBuffer(GL_ARRAY_BUFFER, handle[ATTRIB_VERTEX]);
- glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec3), vertices.data(), GL_STATIC_DRAW);
- glEnableVertexAttribArray(ATTRIB_VERTEX);
- glVertexAttribPointer(
- ATTRIB_VERTEX, // location (for shader)
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized
- 0, // stride
- nullptr // offset
- );
-
-#ifndef NDEBUG
- if (colors.size() < vertices.size()) {
- std::cerr << "OutlineModel: not enough colors!" << std::endl;
- colors.resize(vertices.size(), { 1, 0, 1 });
+void Skeletons::Load(const ShapeRegistry &shapes, TextureIndex &tex_index) {
+ LoadHeadless();
+ meshes.resize(4);
+ const Shape &shape = shapes.Get("player_head_block");
+ EntityMesh::Buffer buf;
+ std::vector<float> tex_map;
+ tex_map.push_back(tex_index.GetID("rock-1"));
+ tex_map.push_back(tex_index.GetID("rock-face"));
+ buf.Reserve(shape.VertexCount(), shape.IndexCount());
+ {
+ shape.Fill(buf, tex_map);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 1.0f, 0.0f });
+ meshes[0].Update(buf);
+ skeletons[0]->SetNodeMesh(&meshes[0]);
+ }
+ {
+ buf.Clear();
+ shape.Fill(buf, tex_map);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ meshes[1].Update(buf);
+ skeletons[1]->SetNodeMesh(&meshes[1]);
+ }
+ {
+ buf.Clear();
+ shape.Fill(buf, tex_map);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.0f, 1.0f });
+ meshes[2].Update(buf);
+ skeletons[2]->SetNodeMesh(&meshes[2]);
+ }
+ {
+ buf.Clear();
+ shape.Fill(buf, tex_map);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.25f, 0.5f });
+ meshes[3].Update(buf);
+ skeletons[3]->SetNodeMesh(&meshes[3]);