定义通用UBO属性

This commit is contained in:
2019-05-25 01:06:33 +08:00
parent 2ab09c6367
commit 962ed65fee
2 changed files with 23 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
#include<hgl/graph/vulkan/VK.h>
#include<hgl/graph/Camera.h>
#include<hgl/type/Color4f.h>
namespace hgl
{
namespace graph
@@ -14,25 +15,30 @@ namespace hgl
Matrix4f projection;
Matrix4f modelview;
Matrix4f mvp;
Matrix3f normal;
};//
struct UBOSkyLight
{
Vector4f sky_color;
{
Color4f sun_color;
Vector3f alignas(16) sun_direction;
};//
class RenderList
{
vulkan::CommandBuffer *cmd_buf;
private:
Camera camera;
Matrix4f projection_matrix,
modelview_matrix,
mvp_matrix;
Frustum frustum;
private:
UBOMatrixData ubo_matrix;
UBOSkyLight ubo_skylight;
private:
List<const SceneNode *> SceneNodeList;
@@ -59,6 +65,11 @@ namespace hgl
void Clear () {SceneNodeList.ClearData();}
void SetCamera(const Camera &);
void SetSkyLightColor(const Color4f &c,const Vector3f &d)
{
ubo_skylight.sun_color=c;
ubo_skylight.sun_direction=d;
}
bool Render();
};//class RenderList