X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2Fmodel.cpp;h=ed443138e23e0d5746a551c25fd7e1f6956cf198;hb=f071bb512a09cece895e65ca48eba2a7155d6593;hp=451433bc7e8296d38b37c551883598553ab13248;hpb=f430ad789fe620ad2e8b2b2b99af868372791295;p=blank.git diff --git a/src/model/model.cpp b/src/model/model.cpp index 451433b..ed44313 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -27,6 +27,18 @@ 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); } @@ -40,6 +52,7 @@ Model::Model() : id(0) , root() , part() +, body_id(0) , eyes_id(0) { } @@ -96,8 +109,8 @@ Part::Part() , tex_map() , mesh() , initial() -, hsl_mod(0.0f, 1.0f, 1.0f) -, rgb_mod(1.0f, 1.0f, 1.0f) +, hsl_mod(0, 255, 255) +, rgb_mod(255, 255, 255) , id(0) { } @@ -110,6 +123,7 @@ void Part::Read(TokenStreamReader &in, ResourceIndex &tex_index, const ShapeRegi std::string name; std::string shape_name; std::string tex_name; + glm::vec3 color_conv; in.Skip(Token::ANGLE_BRACKET_OPEN); while (in.HasMore() && in.Peek().type != Token::ANGLE_BRACKET_CLOSE) { in.ReadIdentifier(name); @@ -122,9 +136,11 @@ void Part::Read(TokenStreamReader &in, ResourceIndex &tex_index, const ShapeRegi } else if (name == "orientation") { in.ReadQuat(initial.orientation); } else if (name == "hsl_mod") { - in.ReadVec(hsl_mod); + in.ReadVec(color_conv); + hsl_mod = glm::tvec3(color_conv * 255.0f); } else if (name == "rgb_mod") { - in.ReadVec(rgb_mod); + in.ReadVec(color_conv); + rgb_mod = glm::tvec3(color_conv * 255.0f); } else if (name == "textures") { in.Skip(Token::BRACKET_OPEN); while (in.HasMore() && in.Peek().type != Token::BRACKET_CLOSE) {