Compare commits
6 Commits
devel_27_D
...
devel_28_G
Author | SHA1 | Date | |
---|---|---|---|
b48ef1ac30 | |||
c363a6fa51 | |||
c873271f6e | |||
68ff8a472c | |||
60ba3e4df2 | |||
35b7c9651f |
Submodule CMAssetsManage updated: 9582bfafcc...4b880eb50f
2
CMCore
2
CMCore
Submodule CMCore updated: 2f93a1bb00...003bae2c24
Submodule CMPlatform updated: c9a1298e02...8d091ebfb0
Submodule CMSceneGraph updated: 0c9bdb9fcd...c302137467
2
CMUtil
2
CMUtil
Submodule CMUtil updated: 953ecf8079...39faf8b475
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
PROJECT(ULRE)
|
PROJECT(ULRE)
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ SET(ULRE CMCore
|
|||||||
ULRE.Util
|
ULRE.Util
|
||||||
ULRE.ShaderGen
|
ULRE.ShaderGen
|
||||||
ULRE.SceneGraph
|
ULRE.SceneGraph
|
||||||
${HGL_GLM_LIB}
|
${HGL_MATH_LIB}
|
||||||
${RENDER_LIBRARY}
|
${RENDER_LIBRARY}
|
||||||
${Vulkan_LIBRARIES})
|
${Vulkan_LIBRARIES})
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ private:
|
|||||||
{
|
{
|
||||||
Add(material_instance,scale(PLANE_SIZE,PLANE_SIZE,1));
|
Add(material_instance,scale(PLANE_SIZE,PLANE_SIZE,1));
|
||||||
|
|
||||||
camera->pos=Vector3f(PLANE_SIZE/2,PLANE_SIZE/2,PLANE_SIZE/4);
|
camera->pos=Vector3f(PLANE_SIZE/4,PLANE_SIZE/2,PLANE_SIZE/4);
|
||||||
camera_control->SetTarget(Vector3f(0,0,0));
|
camera_control->SetTarget(Vector3f(0,0,0));
|
||||||
camera_control->Refresh();
|
camera_control->Refresh();
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ private:
|
|||||||
Material * material =nullptr;
|
Material * material =nullptr;
|
||||||
Pipeline * pipeline =nullptr;
|
Pipeline * pipeline =nullptr;
|
||||||
|
|
||||||
Primitive * prim_plane_grid =nullptr;
|
Primitive * prim_plane_grid =nullptr;
|
||||||
MaterialInstance * material_instance[3]{};
|
MaterialInstance * material_instance[3]{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||||
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
||||||
#include<hgl/graph/mtl/BlinnPhong.h>
|
#include<hgl/graph/mtl/BlinnPhong.h>
|
||||||
|
#include<hgl/color/Color.h>
|
||||||
|
|
||||||
using namespace hgl;
|
using namespace hgl;
|
||||||
using namespace hgl::graph;
|
using namespace hgl::graph;
|
||||||
@@ -24,6 +25,58 @@ static mtl::blinnphong::SunLight sun_light=
|
|||||||
Vector4f(1,0.95,0.9,1) //color
|
Vector4f(1,0.95,0.9,1) //color
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr const COLOR AxisColor[4]=
|
||||||
|
{
|
||||||
|
COLOR::Red, //X轴颜色
|
||||||
|
COLOR::Green, //Y轴颜色
|
||||||
|
COLOR::Blue, //Z轴颜色
|
||||||
|
COLOR::White //全局颜色
|
||||||
|
};
|
||||||
|
|
||||||
|
class VertexDataManager
|
||||||
|
{
|
||||||
|
uint vi_count; ///<顶点输入流数量
|
||||||
|
const VertexInputFormat * vif_list; ///<顶点输入格式列表
|
||||||
|
|
||||||
|
VkDeviceSize vbo_max_size; ///<顶点缓冲区分配空间大小
|
||||||
|
VkDeviceSize vbo_cur_size; ///<顶点缓冲区当前使用大小
|
||||||
|
VBO ** vbo; ///<顶点缓冲区列表
|
||||||
|
|
||||||
|
VkDeviceSize ibo_cur_size; ///<索引缓冲区当前使用大小
|
||||||
|
IndexBuffer * ibo; ///<索引缓冲区
|
||||||
|
|
||||||
|
struct DataOffset
|
||||||
|
{
|
||||||
|
VkDeviceSize vbo_start;
|
||||||
|
VkDeviceSize vbo_size;
|
||||||
|
|
||||||
|
VkDeviceSize ibo_start;
|
||||||
|
VkDeviceSize ibo_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VertexDataManager(const VIL &_vil)
|
||||||
|
{
|
||||||
|
vi_count=_vil.GetCount();
|
||||||
|
vif_list=_vil.GetVIFList();
|
||||||
|
|
||||||
|
vbo_max_size=0;
|
||||||
|
vbo_cur_size=0;
|
||||||
|
vbo=hgl_zero_new<VBO *>(vi_count);
|
||||||
|
|
||||||
|
ibo_cur_size=0;
|
||||||
|
ibo=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VkDeviceSize GetVBOMaxCount()const{return vbo_max_size;} ///<取得顶点缓冲区分配的空间最大数量
|
||||||
|
const VkDeviceSize GetVBOCurCount()const{return vbo_cur_size;} ///<取得顶点缓冲区当前数量
|
||||||
|
|
||||||
|
const IndexType GetIBOType ()const{return ibo?ibo->GetType():IndexType::ERR;} ///<取得索引缓冲区类型
|
||||||
|
const VkDeviceSize GetIBOMaxCount ()const{return ibo?ibo->GetCount():-1;} ///<取得索引缓冲区分配的空间最大数量
|
||||||
|
const VkDeviceSize GetIBOCurCount ()const{return ibo?ibo_cur_size:-1;} ///<取得索引缓冲区当前数量
|
||||||
|
};//class VertexDataManager
|
||||||
|
|
||||||
class TestApp:public SceneAppFramework
|
class TestApp:public SceneAppFramework
|
||||||
{
|
{
|
||||||
private: //plane grid
|
private: //plane grid
|
||||||
@@ -40,7 +93,7 @@ private:
|
|||||||
private: //sphere
|
private: //sphere
|
||||||
|
|
||||||
Material * mtl_blinnphong =nullptr;
|
Material * mtl_blinnphong =nullptr;
|
||||||
MaterialInstance * mi_blinnphong =nullptr;
|
MaterialInstance * mi_blinnphong[4]{};
|
||||||
Pipeline * p_blinnphong =nullptr;
|
Pipeline * p_blinnphong =nullptr;
|
||||||
|
|
||||||
Primitive * prim_sphere =nullptr;
|
Primitive * prim_sphere =nullptr;
|
||||||
@@ -89,14 +142,14 @@ private:
|
|||||||
mtl_blinnphong->BindUBO(DescriptorSetType::Global,"sun",ubo_sun);
|
mtl_blinnphong->BindUBO(DescriptorSetType::Global,"sun",ubo_sun);
|
||||||
mtl_blinnphong->Update();
|
mtl_blinnphong->Update();
|
||||||
|
|
||||||
float mi_data[4]=
|
Color4f mi_data;
|
||||||
|
for(uint i=0;i<4;i++)
|
||||||
{
|
{
|
||||||
1,0,0, //color
|
mi_data=GetColor4f(AxisColor[i],4);
|
||||||
4 //gloss
|
|
||||||
};
|
|
||||||
|
|
||||||
mi_blinnphong=db->CreateMaterialInstance(mtl_blinnphong,nullptr,&mi_data);
|
mi_blinnphong[i]=db->CreateMaterialInstance(mtl_blinnphong,nullptr,&mi_data);
|
||||||
if(!mi_blinnphong)return(false);
|
if(!mi_blinnphong[i])return(false);
|
||||||
|
}
|
||||||
|
|
||||||
p_blinnphong=CreatePipeline(mtl_blinnphong,InlinePipeline::Solid3D,Prim::Triangles);
|
p_blinnphong=CreatePipeline(mtl_blinnphong,InlinePipeline::Solid3D,Prim::Triangles);
|
||||||
|
|
||||||
@@ -124,7 +177,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Sphere
|
//Sphere
|
||||||
prim_sphere=CreateSphere(db,mi_blinnphong->GetVIL(),16);
|
prim_sphere=CreateSphere(db,mi_blinnphong[0]->GetVIL(),16);
|
||||||
|
|
||||||
//Cone
|
//Cone
|
||||||
{
|
{
|
||||||
@@ -135,7 +188,7 @@ private:
|
|||||||
cci.numberSlices=16; //圆锥底部分割数
|
cci.numberSlices=16; //圆锥底部分割数
|
||||||
cci.numberStacks=8; //圆锥高度分割数
|
cci.numberStacks=8; //圆锥高度分割数
|
||||||
|
|
||||||
prim_cone=CreateCone(db,mi_blinnphong->GetVIL(),&cci);
|
prim_cone=CreateCone(db,mi_blinnphong[1]->GetVIL(),&cci);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Cyliner
|
//Cyliner
|
||||||
@@ -146,13 +199,13 @@ private:
|
|||||||
cci.numberSlices=16; //圆柱底部分割数
|
cci.numberSlices=16; //圆柱底部分割数
|
||||||
cci.radius =0.25f; //圆柱半径
|
cci.radius =0.25f; //圆柱半径
|
||||||
|
|
||||||
prim_cylinder=CreateCylinder(db,mi_blinnphong->GetVIL(),&cci);
|
prim_cylinder=CreateCylinder(db,mi_blinnphong[2]->GetVIL(),&cci);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderable *Add(Primitive *r,MaterialInstance *mi,Pipeline *p,const Matrix4f &mat)
|
Renderable *Add(Primitive *r,MaterialInstance *mi,Pipeline *p,const Matrix4f &mat=Identity4f)
|
||||||
{
|
{
|
||||||
Renderable *ri=db->CreateRenderable(r,mi,p);
|
Renderable *ri=db->CreateRenderable(r,mi,p);
|
||||||
|
|
||||||
@@ -171,9 +224,10 @@ private:
|
|||||||
{
|
{
|
||||||
Add(prim_plane_grid,mi_plane_grid,p_line,Identity4f);
|
Add(prim_plane_grid,mi_plane_grid,p_line,Identity4f);
|
||||||
|
|
||||||
Add(prim_sphere, mi_blinnphong,p_blinnphong,translate(Vector3f(0,0,2)));
|
Add(prim_sphere, mi_blinnphong[0],p_blinnphong,translate(Vector3f(0,0,2)));
|
||||||
Add(prim_cone, mi_blinnphong,p_blinnphong,Identity4f);
|
|
||||||
Add(prim_cylinder, mi_blinnphong,p_blinnphong,translate(Vector3f(0,0,-5)));
|
Add(prim_cone, mi_blinnphong[1],p_blinnphong);
|
||||||
|
Add(prim_cylinder, mi_blinnphong[2],p_blinnphong,translate(Vector3f(0,0,-5)));
|
||||||
|
|
||||||
camera->pos=Vector3f(32,32,32);
|
camera->pos=Vector3f(32,32,32);
|
||||||
camera_control->SetTarget(Vector3f(0,0,0));
|
camera_control->SetTarget(Vector3f(0,0,0));
|
||||||
|
@@ -460,6 +460,7 @@ public:
|
|||||||
{
|
{
|
||||||
camera=wc;
|
camera=wc;
|
||||||
cur_time=0;
|
cur_time=0;
|
||||||
|
last_time=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vector2f &GetMouseCoord()const{return mouse_pos;}
|
const Vector2f &GetMouseCoord()const{return mouse_pos;}
|
||||||
|
@@ -144,6 +144,8 @@ enum IndexType:uint
|
|||||||
U16=0,
|
U16=0,
|
||||||
U32,
|
U32,
|
||||||
U8=VK_INDEX_TYPE_UINT8_EXT,
|
U8=VK_INDEX_TYPE_UINT8_EXT,
|
||||||
|
|
||||||
|
ERR=VK_INDEX_TYPE_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
//Push Constant max-lengths:
|
//Push Constant max-lengths:
|
||||||
|
@@ -38,13 +38,10 @@ void RenderCmdBuffer::SetFBO(Framebuffer *fb)
|
|||||||
clear_values[cv_count-1].depthStencil.depth = 1.0f;
|
clear_values[cv_count-1].depthStencil.depth = 1.0f;
|
||||||
clear_values[cv_count-1].depthStencil.stencil = 0;
|
clear_values[cv_count-1].depthStencil.stencil = 0;
|
||||||
}
|
}
|
||||||
else
|
else if(clear_values)
|
||||||
{
|
{
|
||||||
if(clear_values)
|
hgl_free(clear_values);
|
||||||
{
|
clear_values=nullptr;
|
||||||
hgl_free(clear_values);
|
|
||||||
clear_values=nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render_area.offset.x=0;
|
render_area.offset.x=0;
|
||||||
|
@@ -161,6 +161,8 @@ Texture2DArray *RenderResource::CreateTexture2DArray(const AnsiString &name,cons
|
|||||||
|
|
||||||
if(ta)
|
if(ta)
|
||||||
Add(ta);
|
Add(ta);
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugUtils *du=device->GetDebugUtils();
|
DebugUtils *du=device->GetDebugUtils();
|
||||||
|
@@ -9,9 +9,13 @@ namespace hgl
|
|||||||
default_source=fs;
|
default_source=fs;
|
||||||
|
|
||||||
if(fs)
|
if(fs)
|
||||||
|
{
|
||||||
fs->RefAcquire(this);
|
fs->RefAcquire(this);
|
||||||
|
|
||||||
max_char_height=fs->GetCharHeight();
|
max_char_height=fs->GetCharHeight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
max_char_height=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSourceMulti::~FontSourceMulti()
|
FontSourceMulti::~FontSourceMulti()
|
||||||
|
@@ -120,6 +120,8 @@ namespace
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
UBOParse()=default;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
hgl_zero(ubo_data);
|
hgl_zero(ubo_data);
|
||||||
|
Reference in New Issue
Block a user