From: Peter Schaefer Date: Wed, 15 Jun 2016 10:59:55 +0000 (+0200) Subject: funktions to push new->old X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=eb25fc8a3f6b5e382ffa4d6d35435e43d3a7c94c;p=cgue_weave.git funktions to push new->old --- diff --git a/Weave/Graphix/Model/Model.cpp b/Weave/Graphix/Model/Model.cpp index 9803deb..a4d7929 100644 --- a/Weave/Graphix/Model/Model.cpp +++ b/Weave/Graphix/Model/Model.cpp @@ -118,6 +118,7 @@ void Model::unbindShader(const Shader* _shader) } + void Model::drawModel() const { glDrawElements(GL_TRIANGLES, numfaces * 3, GL_UNSIGNED_INT, 0); diff --git a/Weave/Graphix/Model/Model.h b/Weave/Graphix/Model/Model.h index bda41f9..4de0ad9 100644 --- a/Weave/Graphix/Model/Model.h +++ b/Weave/Graphix/Model/Model.h @@ -15,7 +15,7 @@ enum drawType { dr_Model = 0, dr_WireT = 1, dr_WireC = 2, - dr_BBox = 3, + dr_BBox = 3 }; class Model diff --git a/Weave/Scene/Camera.cpp b/Weave/Scene/Camera.cpp index c297a02..0982c9d 100644 --- a/Weave/Scene/Camera.cpp +++ b/Weave/Scene/Camera.cpp @@ -50,9 +50,10 @@ void Camera::useProjection() const Shader::getShader(SH_ACTIVE)->setUniformLocation("uInvProjection", glm::inverse(projection)); } -void Camera::useOldInvProjView() const +void Camera::useOldProjView() const { - Shader::getShader(SH_ACTIVE)->setUniformLocation("uOldInvProjView", oldInvProjView); + Shader::getShader(SH_ACTIVE)->setUniformLocation("uOldProjView", oldProjView); + Shader::getShader(SH_ACTIVE)->setUniformLocation("uInvProjView", glm::inverse(projection*lookAt(cCenter, cPosition, cUpVector))); } void Camera::updateView(const vec3& _target) @@ -123,10 +124,9 @@ void Camera::updateProjection(float _yFov, float _xyRatio, float _zNear, float _ projection = perspective(yFov * (float)M_D2R, xyRatio, zNear, zFar); } - -void Camera::saveInvProjView() +void Camera::saveProjView() { - oldInvProjView = glm::inverse(projection*lookAt(cCenter, cPosition, cUpVector)); + oldProjView = projection*lookAt(cCenter, cPosition, cUpVector); } Camera::FC_stat Camera::frustum_sphere(vec3 _center, float _radius) const diff --git a/Weave/Scene/Camera.h b/Weave/Scene/Camera.h index e29231d..1a87ec4 100644 --- a/Weave/Scene/Camera.h +++ b/Weave/Scene/Camera.h @@ -14,7 +14,7 @@ public: void useView() const; void useProjection() const; - void useOldInvProjView() const; + void useOldProjView() const; void updateView(const vec3& target); void updateView_pitch(float); @@ -23,7 +23,7 @@ public: void updateProjection(float xyRatio); void updateProjection(float yFov, float xyRatio, float zNear, float zFar); - void saveInvProjView(); + void saveProjView(); vec3 getDirection() { return cFront;} vec3 getRight() { return cRight; } @@ -52,8 +52,8 @@ protected: float pitch, yaw; float dist; - /*old Projektion * View -> invers */ - mat4 oldInvProjView = mat4(1.f); + /*old Projektion * View */ + mat4 oldProjView = mat4(1.f); /*Frustum*/ float tan_alphaY; diff --git a/Weave/Scene/SceneObject.cpp b/Weave/Scene/SceneObject.cpp index b8d0ab5..4e7d412 100644 --- a/Weave/Scene/SceneObject.cpp +++ b/Weave/Scene/SceneObject.cpp @@ -238,6 +238,9 @@ void SceneObject::draw(drawTarget _target) const { switch (_target) { + case DRAW_ModelMotionBlur: + //upload new->old model + Shader::getShader(SH_ACTIVE)->setUniformLocation("uCur2OldModel", oldModelMat * glm::inverse(modelMat)); case DRAW_Model: default: texture->useTexture(); diff --git a/Weave/Scene/SceneObject.h b/Weave/Scene/SceneObject.h index 2c59533..00c90e6 100644 --- a/Weave/Scene/SceneObject.h +++ b/Weave/Scene/SceneObject.h @@ -25,7 +25,8 @@ enum collisiontypes { enum drawTarget { DRAW_Model = 0, DRAW_Wire = 1, - DRAW_Coll = 2 + DRAW_Coll = 2, + DRAW_ModelMotionBlur = 3 }; //class string;