next work: support 3-way coordinate system in VertexColor2D material.
This commit is contained in:
parent
ee061e4a1a
commit
e1c3b95de7
@ -1 +1 @@
|
||||
Subproject commit af89ab168343de511796f400d17c6bc14836f691
|
||||
Subproject commit f207c0b844e4c8474cdd4a94cd276251025f23ed
|
@ -46,7 +46,7 @@ private:
|
||||
if(!material_instance)
|
||||
return(false);
|
||||
|
||||
BindCameraUBO(material_instance);
|
||||
db->BindGlobalDescriptor(material_instance);
|
||||
|
||||
// pipeline=db->CreatePipeline(material_instance,sc_render_target,OS_TEXT("res/pipeline/solid2d"));
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::Triangles); //等同上一行,为Framework重载,默认使用swapchain的render target
|
||||
|
19
inc/hgl/graph/mtl/2d/VertexColor2D.h
Normal file
19
inc/hgl/graph/mtl/2d/VertexColor2D.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
|
||||
#define HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
|
||||
|
||||
#include<hgl/graph/mtl/StdMaterial.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class MaterialCreateInfo;
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
MaterialCreateInfo *CreateVertexColor2D(const CoordinateSystem2D &);
|
||||
}//namespace mtl
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
||||
#endif//HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
|
@ -1,17 +0,0 @@
|
||||
#ifndef HGL_GRAPH_MTL_2D_VERTEX2DNDC_INCLUDE
|
||||
#define HGL_GRAPH_MTL_2D_VERTEX2DNDC_INCLUDE
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class MaterialCreateInfo;
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
MaterialCreateInfo *CreateVertexColor2DNDC();
|
||||
}//namespace mtl
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
||||
#endif//HGL_GRAPH_MTL_2D_VERTEX2DNDC_INCLUDE
|
@ -1,6 +1,19 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#define STD_MTL_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace mtl{
|
||||
#define STD_MTL_NAMESPACE_END }}}
|
||||
|
||||
#define STD_MTL_NAMESPACE_USING using namespace hgl::graph::mtl
|
||||
|
||||
enum class CoordinateSystem2D
|
||||
{
|
||||
NDC,
|
||||
ZeroToOne, //左上角为0,0;右下角为1,1
|
||||
Ortho //左上角为0,0;右下角为(width-1),(height-1)
|
||||
};
|
||||
|
||||
namespace GlobalShaderUBO
|
||||
{
|
||||
constexpr const char ViewportInfo[]="ViewportInfo";
|
||||
constexpr const char CameraInfo[]="CameraInfo";
|
||||
}
|
||||
|
@ -1,15 +1,29 @@
|
||||
#include<hgl/graph/mtl/StdMaterial.h>
|
||||
#include<hgl/graph/mtl/2d/VertexColor2D.h>
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/shadergen/MaterialCreateInfo.h>
|
||||
|
||||
STD_MTL_NAMESPACE_BEGIN
|
||||
MaterialCreateInfo *CreateVertexColor2DNDC()
|
||||
MaterialCreateInfo *CreateVertexColor2D(const CoordinateSystem2D &cs)
|
||||
{
|
||||
MaterialCreateInfo *mci=new MaterialCreateInfo("VertexColor2DNDC", ///<名称,随便起
|
||||
AnsiString mtl_name="VertexColor2D";
|
||||
|
||||
if(cs==CoordinateSystem2D::NDC)mtl_name+="NDC";else
|
||||
if(cs==CoordinateSystem2D::ZeroToOne)mtl_name+="ZeroToOne";else
|
||||
if(cs==CoordinateSystem2D::Ortho)mtl_name+="Ortho";else
|
||||
return(nullptr);
|
||||
|
||||
|
||||
MaterialCreateInfo *mci=new MaterialCreateInfo( mtl_name, ///<名称
|
||||
1, ///<最终一个RT输出
|
||||
false); ///<无深度输出
|
||||
|
||||
if(cs==CoordinateSystem2D::Ortho)
|
||||
{
|
||||
mci->AddStruct(GlobalShaderUBO::ViewportInfo,"");
|
||||
}
|
||||
|
||||
//vertex部分
|
||||
{
|
||||
ShaderCreateInfoVertex *vsc=mci->GetVS();
|
@ -39,8 +39,8 @@ set(STD_MTL_HEADER_PATH ${ROOT_INCLUDE_PATH}/hgl/graph/mtl)
|
||||
|
||||
SET(STD_MTL_2D_HEADER_PATH ${STD_MTL_HEADER_PATH}/2d)
|
||||
|
||||
SET(STD_MTL_2D_SOURCE_FILES ${STD_MTL_2D_HEADER_PATH}/VertexColor2DNDC.h
|
||||
2d/VertexColor2DNDC.cpp)
|
||||
SET(STD_MTL_2D_SOURCE_FILES ${STD_MTL_2D_HEADER_PATH}/VertexColor2D.h
|
||||
2d/VertexColor2D.cpp)
|
||||
|
||||
SET(STANDARD_MATERIAL_SOURCE ${STD_MTL_HEADER_PATH}/StdMaterial.h)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user