fixed params at create function of inline geometry

This commit is contained in:
hyzboy 2022-02-08 12:29:35 +08:00
parent 5712efd7a5
commit e6282b31d0
5 changed files with 29 additions and 32 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 3c047a6803801c9f76be5774cf2ea7622751dc77
Subproject commit e4eae3eef65cd5be96198aac3c2ab08dd4070252

View File

@ -86,7 +86,6 @@ private:
pgci.color.Set(0,0,0.5,1);
pgci.side_color.Set(0,0,1,1);
ro_plane_grid[2]=CreateRenderablePlaneGrid(db,vab,&pgci);
}
bool InitScene()

View File

@ -159,9 +159,9 @@ private:
{
struct CubeCreateInfo cci;
cci.has_normal=true;
cci.has_tangent=true;
cci.has_tex_coord=true;
cci.normal=true;
cci.tangent=true;
cci.tex_coord=true;
cci.color_type=CubeCreateInfo::ColorType::SameColor;
cci.color[0]=Vector4f(1,1,1,1);
ro_cube=CreateRenderableCube(db,vab,&cci);

View File

@ -95,9 +95,9 @@ namespace hgl
struct CubeCreateInfo
{
bool has_normal;
bool has_tangent;
bool has_tex_coord;
bool normal;
bool tangent;
bool tex_coord;
enum class ColorType
{
@ -116,9 +116,9 @@ namespace hgl
CubeCreateInfo()
{
has_normal=false;
has_tangent=false;
has_tex_coord=false;
normal=false;
tangent=false;
tex_coord=false;
color_type=ColorType::NoColor;
}
@ -131,7 +131,7 @@ namespace hgl
struct BoundingBoxCreateInfo
{
bool has_normal;
bool normal;
enum class ColorType
{
@ -149,7 +149,7 @@ namespace hgl
BoundingBoxCreateInfo()
{
has_normal=false;
normal=false;
color_type=ColorType::NoColor;
}

View File

@ -241,7 +241,7 @@ namespace hgl
xy_tex_coord[2]=xy_tex_coord[4]=pci->tile.x;
xy_tex_coord[5]=xy_tex_coord[7]=pci->tile.y;
tex_coord->GPUBufferData(xy_tex_coord);
tex_coord->Write(xy_tex_coord);
}
}
@ -266,21 +266,19 @@ namespace hgl
* cubemap纹理坐标系依然遵循OpenGL时代定下的坐标系position虽然使用vulkan坐标系shader中当做cubemap纹理坐标使用时shader中转换为opengl坐标系(yz即可)
*/
// Points of a cube.
constexpr float points[]={ -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, -0.5f,
-0.5f, +0.5f, -0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f, +0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f,
+0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f};
constexpr float positions[]={ -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, -0.5f,
-0.5f, +0.5f, -0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f, +0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, -0.5f, +0.5f, -0.5f,
+0.5f, -0.5f, -0.5f, +0.5f, -0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, +0.5f, -0.5f};
// Normals of a cube.
constexpr float normals[]={ +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f,
+0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f,
+0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f,
+0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f,
-1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f,
+1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f};
constexpr float normals[]={ +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, +0.0f,
+0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f, +0.0f, -1.0f, +0.0f,
+0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f, +0.0f, -0.0f, -1.0f,
+0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f, +0.0f, -0.0f, +1.0f,
-1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f, -1.0f, -0.0f, +0.0f,
+1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f, +1.0f, -0.0f, +0.0f};
constexpr float tangents[] = { +1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f,
+1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f, +1.0f, 0.0f, 0.0f,
@ -308,15 +306,15 @@ namespace hgl
if(!rc.Init(24))
return(nullptr);
rc.WriteVAD(VAN::Position,points,sizeof(points));
rc.WriteVAD(VAN::Position,positions,sizeof(positions));
if(cci->has_normal)
if(cci->normal)
rc.WriteVAD(VAN::Normal,normals,sizeof(normals));
if(cci->has_tangent)
if(cci->tangent)
rc.WriteVAD(VAN::Tangent,tangents,sizeof(tangents));
if(cci->has_tex_coord)
if(cci->tex_coord)
rc.WriteVAD(VAN::TexCoord,tex_coords,sizeof(tex_coords));
if(cci->color_type!=CubeCreateInfo::ColorType::NoColor)