X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2Fmodel.cpp;h=db44cbf21c0e351c757dcb484027c93dedd81672;hb=e4a1425dccd0ba9b106e415dd02809f4308a85ee;hp=63187b863033569af1da8f1e446ac3ec54607d69;hpb=7e782291e0ce39eb2d4e8c1df28f682c313e6f8d;p=blank.git diff --git a/src/model/model.cpp b/src/model/model.cpp index 63187b8..db44cbf 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -5,10 +5,10 @@ #include "Shape.hpp" #include "ShapeRegistry.hpp" -#include "../app/TextureIndex.hpp" #include "../io/TokenStreamReader.hpp" #include "../graphics/DirectionalLighting.hpp" #include "../graphics/EntityMesh.hpp" +#include "../shared/ResourceIndex.hpp" #include #include @@ -27,6 +27,22 @@ Instance::~Instance() { } +Part::State &Instance::BodyState() noexcept { + return state[model->GetBodyPart().ID()]; +} + +glm::mat4 Instance::BodyTransform() const noexcept { + return model->GetBodyPart().GlobalTransform(*this); +} + +Part::State &Instance::EyesState() noexcept { + return state[model->GetEyesPart().ID()]; +} + +glm::mat4 Instance::EyesTransform() const noexcept { + return model->GetEyesPart().GlobalTransform(*this); +} + void Instance::Render(const glm::mat4 &M, DirectionalLighting &prog) { model->RootPart().Render(M, *this, prog); } @@ -35,7 +51,9 @@ void Instance::Render(const glm::mat4 &M, DirectionalLighting &prog) { Model::Model() : id(0) , root() -, part() { +, part() +, body_id(0) +, eyes_id(0) { } @@ -101,7 +119,7 @@ Part::~Part() { } -void Part::Read(TokenStreamReader &in, TextureIndex &tex_index, const ShapeRegistry &shapes) { +void Part::Read(TokenStreamReader &in, ResourceIndex &tex_index, const ShapeRegistry &shapes) { std::string name; std::string shape_name; std::string tex_name;