change sequence of model * rotation

This commit is contained in:
ayachi3 2022-12-13 20:25:16 +08:00
parent cef83fe19e
commit 95c899f546
2 changed files with 7 additions and 9 deletions

View File

@ -43,12 +43,10 @@ inline glm::mat4 Renderable::modelMatrix() const {
glm::mat4 model = glm::mat4(1.0f);
model = glm::translate(model, _position);
// 左乘与右乘应该是不一样的,但是这里的表现相同
model = model * _rotation;
//model = _rotation * model;
//model = model * _rotation;
model = _rotation * model;
model = glm::scale(model, _scale);
return model;
}
inline glm::vec3 Renderable::get_lower_boundary()const {

View File

@ -86,11 +86,11 @@ void SceneViewer::initializeGL() {
Renderable renderable(backpackModel);
_objects.push_back(backpackModel);
//renderable.scale(1);
//renderable.rotate(glm::vec3(1, 0, 0), 2);
//renderable.check_boundary();
//auto t1 = renderable.get_lower_boundary();
//auto t2 = renderable.get_upper_boundary();
renderable.move(glm::vec3(100.0f, 0.0f, 0.0f));
renderable.rotate(glm::vec3(0, 1, 0), 3.1415926f/2);
renderable.check_boundary();
auto t1 = renderable.get_lower_boundary();
auto t2 = renderable.get_upper_boundary();
_camera.setPosition(glm::vec3(0.0f, 15.0f, 8.0f));
_camera.setYaw(-90.0f);