-
-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() {
+ LoadHeadless();
+ meshes.resize(4);
+ EntityMesh::Buffer buf;
+ {
+ CuboidBounds shape(skeletons[0]->Bounds());
+ shape.Vertices(buf, 3.0f);
+ 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]);
+ }
+ {
+ CuboidBounds shape(skeletons[1]->Bounds());
+ buf.Clear();
+ shape.Vertices(buf, 0.0f);
+ 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]);
+ }
+ {
+ StairBounds shape(skeletons[2]->Bounds(), { 0.4f, 0.4f });
+ buf.Clear();
+ shape.Vertices(buf, 1.0f);
+ 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]);
+ }
+ {
+ CuboidBounds shape(skeletons[3]->Bounds());
+ buf.Clear();
+ shape.Vertices(buf, 2.0f);
+ 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]);