1.add resolution in WorldMatrix

2.add object_position/object_size in PushConstant
This commit is contained in:
hyzboy 2020-01-19 21:53:44 +08:00
parent 625dde9ca7
commit d532e0d04c
4 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace hgl
Matrix4f inverse_map; Matrix4f inverse_map;
Vector4f view_pos; ///<眼睛坐标 Vector4f view_pos; ///<眼睛坐标
Vector2f resolution; ///<画布尺寸
};//struct WorldMatrix };//struct WorldMatrix
}//namespace graph }//namespace graph
}//namespace hgl }//namespace hgl

View File

@ -75,6 +75,8 @@ struct PushConstant
{ {
Matrix4f local_to_world; Matrix4f local_to_world;
Matrix3f normal; Matrix3f normal;
Vector3f object_position;
Vector3f object_size;
}; };
inline void copy(VkExtent3D &e3d,const VkExtent2D &e2d) inline void copy(VkExtent3D &e3d,const VkExtent2D &e2d)

View File

@ -49,6 +49,8 @@ namespace hgl
matrix.ortho=ortho(width,height,znear,zfar); matrix.ortho=ortho(width,height,znear,zfar);
matrix.view_pos=eye; matrix.view_pos=eye;
matrix.resolution.x=width;
matrix.resolution.y=height;
frustum.SetVerticalFovAndAspectRatio(DegToRad(fov),width/height); frustum.SetVerticalFovAndAspectRatio(DegToRad(fov),width/height);
frustum.SetViewPlaneDistances(znear,zfar); frustum.SetViewPlaneDistances(znear,zfar);

View File

@ -33,6 +33,8 @@ namespace hgl
pc.local_to_world =LocalToWorldMatrix; pc.local_to_world =LocalToWorldMatrix;
pc.normal =pc.local_to_world.Float3x3Part(); pc.normal =pc.local_to_world.Float3x3Part();
// pc.object_position =;
// pc.object_size =;
return LocalToWorldMatrix; return LocalToWorldMatrix;
} }