]> git.localhorst.tv Git - blank.git/blobdiff - src/model/model.cpp
apply pitch to head instead of body
[blank.git] / src / model / model.cpp
index 63187b863033569af1da8f1e446ac3ec54607d69..cad62ac2ec0cea30c99e39685adbef0729b6f3a8 100644 (file)
@@ -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 <iostream>
 #include <glm/gtx/quaternion.hpp>
@@ -27,6 +27,14 @@ Instance::~Instance() {
 
 }
 
+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 +43,8 @@ void Instance::Render(const glm::mat4 &M, DirectionalLighting &prog) {
 Model::Model()
 : id(0)
 , root()
-, part() {
+, part()
+, eyes_id(0) {
 
 }
 
@@ -101,7 +110,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;