改进SceneNode/RenderList的Camera相关处理

This commit is contained in:
hyzboy 2019-05-27 22:47:34 +08:00
parent 6f6d2f9524
commit 8ce7bceee0
3 changed files with 3 additions and 20 deletions

View File

@ -78,7 +78,6 @@ namespace hgl
bool ExpendToList(RenderList *rl,Frustum *f) ///<展开到渲染列表(使用平截头裁剪) bool ExpendToList(RenderList *rl,Frustum *f) ///<展开到渲染列表(使用平截头裁剪)
{return ExpendToList(rl,FrustumClipFilter,f);} {return ExpendToList(rl,FrustumClipFilter,f);}
// bool ExpendToList(RenderList *,const Matrix4f &,const Matrix4f &,RenderListCompFunc=nullptr); ///<展开到渲染列表(使用平截头裁剪并排序)
bool ExpendToList(RenderList *,Camera *,RenderListCompFunc=nullptr); ///<展开到渲染列表(使用摄像机平截头裁剪并排序) bool ExpendToList(RenderList *,Camera *,RenderListCompFunc=nullptr); ///<展开到渲染列表(使用摄像机平截头裁剪并排序)
};//class SceneNode };//class SceneNode
}//namespace graph }//namespace graph

View File

@ -30,15 +30,12 @@ namespace hgl
{ {
camera=cam; camera=cam;
MakeCameraMatrix( &ubo_matrix.projection, ubo_matrix.projection=camera.projection;
&ubo_matrix.modelview, ubo_matrix.modelview=camera.modelview;
&camera);
ubo_matrix.mvp =ubo_matrix.projection*ubo_matrix.modelview; ubo_matrix.mvp =ubo_matrix.projection*ubo_matrix.modelview;
ubo_matrix.normal =ubo_matrix.modelview.Float3x3Part(); //法线矩阵为3x3 ubo_matrix.normal =ubo_matrix.modelview.Float3x3Part(); //法线矩阵为3x3
CameraToFrustum(&frustum, frustum=camera.frustum;
&camera);
} }
void RenderList::SetMVP(const Matrix4f &proj,const Matrix4f &mv) void RenderList::SetMVP(const Matrix4f &proj,const Matrix4f &mv)

View File

@ -1,6 +1,5 @@
#include<hgl/graph/SceneNode.h> #include<hgl/graph/SceneNode.h>
#include<hgl/graph/RenderList.h> #include<hgl/graph/RenderList.h>
//#include<hgl/graph/Frustum.h>
namespace hgl namespace hgl
{ {
namespace graph namespace graph
@ -92,13 +91,6 @@ namespace hgl
return(true); return(true);
} }
//bool SceneNode::ExpendToList(RenderList *rl,const Matrix4f &proj,const Matrix4f &mv,RenderListCompFunc comp_func)const
//{
// if(!rl)return(false);
//}
/** /**
* *
* @param rl * @param rl
@ -109,11 +101,6 @@ namespace hgl
{ {
if(!rl||!cam)return(false); if(!rl||!cam)return(false);
// Frustum f;
// MakeCameraFrustum(&f,cam);
// if(!ExpendToList(rl,&f))
if(!ExpendToList(rl)) if(!ExpendToList(rl))
return(false); return(false);