updated MVPMatrix struct
This commit is contained in:
parent
92770495a7
commit
b7714d8a83
@ -1 +1 @@
|
||||
Subproject commit 3b1520f5617dee4d34821d4dd7c34121d0c3f8ed
|
||||
Subproject commit 729f752d7cd93593ec59b5adaa2f981571253dc2
|
@ -1,4 +1,4 @@
|
||||
#ifndef HGL_GRAPH_SCENE_INFO_INCLUDE
|
||||
#ifndef HGL_GRAPH_SCENE_INFO_INCLUDE
|
||||
#define HGL_GRAPH_SCENE_INFO_INCLUDE
|
||||
|
||||
#include<hgl/math/Matrix.h>
|
||||
@ -8,25 +8,25 @@ namespace hgl
|
||||
namespace graph
|
||||
{
|
||||
/**
|
||||
* MVP¾ØÕó
|
||||
* MVP矩阵
|
||||
*/
|
||||
struct MVPMatrix
|
||||
{
|
||||
Matrix4f l2w; ///< Local to World
|
||||
Matrix4f inverse_l2w;
|
||||
//Matrix4f normal; ///<transpose(inverse(mat3(l2w)));
|
||||
Matrix3x4f normal; ///<这里用3x4,在Shader中是3x3(但实际它是3x4保存)
|
||||
|
||||
Matrix4f mv; ///< view * local_to_world
|
||||
Matrix4f mvp; ///< projection * view * local_to_world
|
||||
Matrix4f inverse_mvp;
|
||||
|
||||
public:
|
||||
|
||||
void Set(const Matrix4f &w,const Matrix4f &vp)
|
||||
void Set(const Matrix4f &w,const Matrix4f &vp,const Matrix4f &v)
|
||||
{
|
||||
l2w=w;
|
||||
inverse_l2w=inverse(l2w);
|
||||
|
||||
normal=transpose(inverse(l2w));
|
||||
mv=v*l2w;
|
||||
mvp=vp*l2w;
|
||||
inverse_mvp=inverse(mvp);
|
||||
}
|
||||
|
||||
CompOperatorMemcmp(const MVPMatrix &);
|
||||
|
@ -171,7 +171,7 @@ namespace hgl
|
||||
{
|
||||
RenderNode *rn=new RenderNode;
|
||||
|
||||
rn->matrix.Set(sn->GetLocalToWorldMatrix(),camera_info.vp);
|
||||
rn->matrix.Set(sn->GetLocalToWorldMatrix(),camera_info.vp,camera_info.view);
|
||||
|
||||
rn->WorldCenter=sn->GetWorldCenter();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user