code Flashcards

也没啥

1
Q

Model matrix transformation

A

// Model matrix : set based on parameters in the models file
float angle = glm:: radians(model.ra); // convert from degrees to radians
glm::mat4 I = glm::mat4(1.0f); // Identity Matrix
glm::mat4 Ms = glm::scale(I, glm::vec3(model.sx, model.sy,
model.sz));
glm::mat4 Mr = glm::rotate(I, angle, glm::vec3(model.rx, model.ry, model.rz) );
gim::mat4 Mt = glm::translate(I, glm::vec3(model.tx, model.ty,
model.tz));
gim::mat4 Model = Mt * Mr * Ms;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly