last one
This commit is contained in:
+8
-1
@@ -48,6 +48,11 @@ Character::Character() {
|
||||
|
||||
void Character::Render(Shader& shader) {
|
||||
if (!body || !body->rig || !body->animator) return;
|
||||
if (skin) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, skin->ID);
|
||||
shader.SetInt("tex", 1);
|
||||
}
|
||||
if (body->animator->m_CurrentAnimation == nullptr) {
|
||||
for (int i = 0; i < 100; i++)
|
||||
shader.SetMat4(("finalBonesMatrices[" + std::to_string(i) + "]").c_str(), glm::mat4(1.0f));
|
||||
@@ -58,5 +63,7 @@ void Character::Render(Shader& shader) {
|
||||
for (int i = 0; i < transforms.size(); i++)
|
||||
shader.SetMat4(("finalBonesMatrices[" + std::to_string(i) + "]").c_str(), transforms[i]);
|
||||
}
|
||||
body->rig->Render(shader, body->t.GetTranslationMatrix() * body->t.GetRotationMatrix());
|
||||
// body->t's scale is the hitbox only; the rig is drawn at visualScale so it fills that hitbox
|
||||
body->rig->Render(shader, body->t.GetTranslationMatrix() * body->t.GetRotationMatrix()
|
||||
* glm::scale(glm::mat4(1.0f), glm::vec3(visualScale)));
|
||||
}
|
||||
Reference in New Issue
Block a user