add TextLayout,RenderableCreater.cpp/.h
This commit is contained in:
parent
4950a33ae5
commit
b7e2cb7018
6
.gitignore
vendored
6
.gitignore
vendored
@ -8,3 +8,9 @@
|
||||
*.obj
|
||||
.vs
|
||||
/build
|
||||
*.ninja_deps
|
||||
*.ninja_log
|
||||
*.pdb
|
||||
*.lib
|
||||
*.ninja
|
||||
*.check_cache
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 321991587905e07076574f104831bc8457f630b3
|
||||
Subproject commit 7eb1cafe575cc305a9d09fce66494a5445da5305
|
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit 353bdef68b704d92a82adc55e65a0627bc857b54
|
||||
Subproject commit 4035476785e786ce701d0b4434d2916c161d9755
|
49
inc/hgl/graph/RenderableCreater.h
Normal file
49
inc/hgl/graph/RenderableCreater.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef HGL_GRAPH_RENDERABLE_CREATER_INCLUDE
|
||||
#define HGL_GRAPH_RENDERABLE_CREATER_INCLUDE
|
||||
|
||||
#include<hgl/graph/SceneDB.h>
|
||||
#include<hgl/graph/VertexBuffer.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
/**
|
||||
* 可渲染对象创建器
|
||||
*/
|
||||
class RenderableCreater
|
||||
{
|
||||
protected:
|
||||
|
||||
SceneDB *db;
|
||||
vulkan::Material *mtl;
|
||||
|
||||
const vulkan::VertexShaderModule *vsm;
|
||||
|
||||
protected:
|
||||
|
||||
vulkan::Renderable * render_obj;
|
||||
|
||||
uint32 vertices_number;
|
||||
|
||||
VertexBufferCreater * vb_vertex;
|
||||
vulkan::IndexBuffer * ibo;
|
||||
|
||||
Map<AnsiString,VertexBufferCreater *> vb_map;
|
||||
|
||||
public:
|
||||
|
||||
RenderableCreater(SceneDB *sdb,vulkan::Material *m);
|
||||
virtual ~RenderableCreater();
|
||||
|
||||
virtual bool Init(const uint32 count);
|
||||
|
||||
virtual VertexBufferCreater * Bind(const AnsiString &name);
|
||||
|
||||
uint16 * CreateIBO16(uint count,const uint16 *data=nullptr);
|
||||
uint32 * CreateIBO32(uint count,const uint32 *data=nullptr);
|
||||
|
||||
virtual vulkan::Renderable * Finish();
|
||||
};//class GeometryCreater
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_RENDERABLE_CREATER_INCLUDE
|
32
inc/hgl/graph/font/TextLayout.h
Normal file
32
inc/hgl/graph/font/TextLayout.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef HGL_GRAPH_TEXT_LAYOUT_INCLUDE
|
||||
#define HGL_GRAPH_TEXT_LAYOUT_INCLUDE
|
||||
|
||||
#include<hgl/graph/font/FontSource.h>
|
||||
#include<hgl/graph/RenderableInstance.h>
|
||||
#include<hgl/graph/VertexBuffer.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
|
||||
class TextRenderable:public vulkan::Renderable
|
||||
{
|
||||
};//class TextRenderable:public vulkan::Renderable
|
||||
|
||||
/**
|
||||
* 文本排版处理
|
||||
*/
|
||||
class TextLayout
|
||||
{
|
||||
FontSource *source;
|
||||
|
||||
public:
|
||||
|
||||
TextLayout(FontSource *fs):source(fs){}
|
||||
virtual ~TextLayout()=default;
|
||||
|
||||
|
||||
};//class TextLayout
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_TEXT_LAYOUT_INCLUDE
|
@ -42,6 +42,11 @@ SET(SCENE_GRAPH_SOURCE RenderList.cpp
|
||||
#SceneFile.cpp
|
||||
)
|
||||
|
||||
SET(RENDERABLE_FILES ${ROOT_INCLUDE_PATH}/hgl/graph/RenderableCreater.h
|
||||
RenderableCreater.cpp)
|
||||
|
||||
SOURCE_GROUP("Renderable" FILES ${RENDERABLE_FILES})
|
||||
|
||||
file(GLOB FONT_HEADER ${ROOT_INCLUDE_PATH}/hgl/graph/font/*.*)
|
||||
|
||||
SET(FONT_SOURCE font/Font.cpp
|
||||
@ -75,5 +80,7 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
|
||||
|
||||
${SG_VERTEX_SOURCE}
|
||||
|
||||
${RENDERABLE_FILES}
|
||||
|
||||
${FONT_HEADER}
|
||||
${FONT_SOURCE})
|
||||
|
83
src/SceneGraph/RenderableCreater.cpp
Normal file
83
src/SceneGraph/RenderableCreater.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include<hgl/graph/RenderableCreater.h>
|
||||
#include<hgl/graph/vulkan/VKShaderModule.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
RenderableCreater::RenderableCreater(SceneDB *sdb,vulkan::Material *m)
|
||||
{
|
||||
db =sdb;
|
||||
mtl =m;
|
||||
vsm =mtl->GetVertexShaderModule();
|
||||
|
||||
render_obj =nullptr;
|
||||
vertices_number =0;
|
||||
vb_vertex =nullptr;
|
||||
ibo =nullptr;
|
||||
}
|
||||
|
||||
RenderableCreater::~RenderableCreater()
|
||||
{
|
||||
SAFE_CLEAR(render_obj);
|
||||
}
|
||||
|
||||
bool RenderableCreater::Init(const uint32 count)
|
||||
{
|
||||
if(count<=0)return(false);
|
||||
|
||||
vertices_number=count;
|
||||
|
||||
render_obj=mtl->CreateRenderable(vertices_number);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
VertexBufferCreater *RenderableCreater::Bind(const AnsiString &name)
|
||||
{
|
||||
if(!vsm)return(false);
|
||||
|
||||
VertexBufferCreater *vb;
|
||||
|
||||
if(vb_map.Get(name,vb))
|
||||
return vb;
|
||||
|
||||
const vulkan::ShaderStage *ss=vsm->GetStageInput(name);
|
||||
|
||||
if(!ss)
|
||||
return(nullptr);
|
||||
|
||||
vb=CreateVB(ss->base_type,ss->component,vertices_number);
|
||||
|
||||
vb_map.Add(name,vb);
|
||||
|
||||
return vb;
|
||||
}
|
||||
|
||||
uint16 *RenderableCreater::CreateIBO16(uint count,const uint16 *data)
|
||||
{
|
||||
if(!ibo)return(nullptr);
|
||||
|
||||
ibo=db->CreateIBO16(count,data);
|
||||
return (uint16 *)ibo->Map();
|
||||
}
|
||||
|
||||
uint32 *RenderableCreater::CreateIBO32(uint count,const uint32 *data)
|
||||
{
|
||||
if(!ibo)return(nullptr);
|
||||
|
||||
ibo=db->CreateIBO32(count,data);
|
||||
return (uint32 *)ibo->Map();
|
||||
}
|
||||
|
||||
vulkan::Renderable *RenderableCreater::Finish()
|
||||
{
|
||||
const uint si_count=vsm->GetStageInputCount();
|
||||
|
||||
if(vb_map.GetCount()!=si_count)
|
||||
return(nullptr);
|
||||
|
||||
|
||||
}
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
Loading…
x
Reference in New Issue
Block a user