-
-void SpriteModel::LoadRect(
- float w, float h,
- const glm::vec2 &pivot,
- const glm::vec2 &tex_begin,
- const glm::vec2 &tex_end
-) {
- Clear();
- Reserve(4, 6);
-
- vertices.emplace_back( -pivot.x, -pivot.y, 0.0f);
- vertices.emplace_back(w-pivot.x, -pivot.y, 0.0f);
- vertices.emplace_back( -pivot.x, h-pivot.y, 0.0f);
- vertices.emplace_back(w-pivot.x, h-pivot.y, 0.0f);
-
- coords.emplace_back(tex_begin.x, tex_begin.y);
- coords.emplace_back(tex_end.x, tex_begin.y);
- coords.emplace_back(tex_begin.x, tex_end.y);
- coords.emplace_back(tex_end.x, tex_end.y);
-
- indices.assign({ 0, 2, 1, 1, 2, 3 });
-
- Invalidate();
+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]);
+ }