Luminance change to ufloat8 instead of float in VertexLum material
This commit is contained in:
parent
9121ebd11b
commit
cfc3ac8250
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit a82810d58aa2dab60360a278038aa31ab7bcb116
|
Subproject commit 538d19781a7818e1333d9ee5a8c165dcff072a25
|
@ -1 +1 @@
|
|||||||
Subproject commit 3bc0658d28e30457907003d85151b3b46083af53
|
Subproject commit 3e2f129abf1b0480133010830b97f6eb902f960b
|
@ -14,6 +14,6 @@ CreateProject(01_PlaneGrid3D PlaneGrid3D.cpp)
|
|||||||
CreateProject(02_RayPicking RayPicking.cpp)
|
CreateProject(02_RayPicking RayPicking.cpp)
|
||||||
CreateProject(03_MetricCellsGrid MetricCellsGrid.cpp)
|
CreateProject(03_MetricCellsGrid MetricCellsGrid.cpp)
|
||||||
|
|
||||||
CreateProject(04_Gizmo3DMove Gizmo3DMove.cpp Gizmo.h Gizmo.cpp)
|
CreateProject(04_Gizmo3DMove Gizmo3DMove.cpp Gizmo.h GizmoResource.cpp)
|
||||||
|
|
||||||
#CreateProject(03_BlenderAxis BlenderAxis.cpp)
|
#CreateProject(03_BlenderAxis BlenderAxis.cpp)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
#include<hgl/graph/VKRenderResource.h>
|
#include<hgl/graph/VKRenderResource.h>
|
||||||
#include<hgl/color/Color.h>
|
#include<hgl/color/Color.h>
|
||||||
|
#include<hgl/graph/InlineGeometry.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -130,10 +131,25 @@ bool InitGizmoResource(RenderResource *rr)
|
|||||||
|
|
||||||
if(!prim_creater)
|
if(!prim_creater)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using namespace inline_geometry;
|
||||||
|
|
||||||
|
{
|
||||||
|
struct PlaneGridCreateInfo pgci;
|
||||||
|
|
||||||
|
pgci.grid_size.Set(32,32);
|
||||||
|
pgci.sub_count.Set(8,8);
|
||||||
|
|
||||||
|
pgci.lum=0.75;
|
||||||
|
pgci.sub_lum=1.0;
|
||||||
|
|
||||||
|
PrimitiveCreater pc(device,material->GetDefaultVIL());
|
||||||
|
|
||||||
|
prim[size_t(GizmoShape::Plane)]=CreatePlaneGrid(prim_creater,&pgci);
|
||||||
|
}
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include<hgl/graph/RenderList.h>
|
#include<hgl/graph/RenderList.h>
|
||||||
#include<hgl/graph/Camera.h>
|
#include<hgl/graph/Camera.h>
|
||||||
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
||||||
|
#include<hgl/graph/VKVertexInputConfig.h>
|
||||||
|
|
||||||
using namespace hgl;
|
using namespace hgl;
|
||||||
using namespace hgl::graph;
|
using namespace hgl::graph;
|
||||||
@ -33,6 +34,10 @@ private:
|
|||||||
material=db->LoadMaterial("Std3D/VertexLum3D",&cfg);
|
material=db->LoadMaterial("Std3D/VertexLum3D",&cfg);
|
||||||
if(!material)return(false);
|
if(!material)return(false);
|
||||||
|
|
||||||
|
VILConfig vil_config;
|
||||||
|
|
||||||
|
vil_config.Add(VAN::Luminance,VF_V1UN8);
|
||||||
|
|
||||||
Color4f GridColor;
|
Color4f GridColor;
|
||||||
COLOR ce=COLOR::BlenderAxisRed;
|
COLOR ce=COLOR::BlenderAxisRed;
|
||||||
|
|
||||||
@ -40,12 +45,12 @@ private:
|
|||||||
{
|
{
|
||||||
GridColor=GetColor4f(ce,1.0);
|
GridColor=GetColor4f(ce,1.0);
|
||||||
|
|
||||||
material_instance[i]=db->CreateMaterialInstance(material,nullptr,&GridColor);
|
material_instance[i]=db->CreateMaterialInstance(material,&vil_config,&GridColor);
|
||||||
|
|
||||||
ce=COLOR((int)ce+1);
|
ce=COLOR((int)ce+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline=CreatePipeline(material,InlinePipeline::Solid3D,Prim::Lines);
|
pipeline=CreatePipeline(material_instance[0],InlinePipeline::Solid3D,Prim::Lines);
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
@ -59,12 +64,12 @@ private:
|
|||||||
pgci.grid_size.Set(32,32);
|
pgci.grid_size.Set(32,32);
|
||||||
pgci.sub_count.Set(8,8);
|
pgci.sub_count.Set(8,8);
|
||||||
|
|
||||||
pgci.lum=0.75;
|
pgci.lum=180;
|
||||||
pgci.sub_lum=1.0;
|
pgci.sub_lum=255;
|
||||||
|
|
||||||
PrimitiveCreater pc(device,material->GetDefaultVIL());
|
PrimitiveCreater pc(device,material_instance[0]->GetVIL());
|
||||||
|
|
||||||
prim_plane_grid=CreatePlaneGrid(&pc,&pgci);
|
prim_plane_grid=CreatePlaneGrid2D(&pc,&pgci);
|
||||||
|
|
||||||
return prim_plane_grid;
|
return prim_plane_grid;
|
||||||
}
|
}
|
||||||
|
@ -71,14 +71,16 @@ namespace hgl
|
|||||||
|
|
||||||
Size2u sub_count; ///<细分格子数量
|
Size2u sub_count; ///<细分格子数量
|
||||||
|
|
||||||
float lum; ///<一般线条颜色
|
uint8 lum; ///<一般线条亮度
|
||||||
float sub_lum; ///<细分及边界线条颜色
|
uint8 sub_lum; ///<细分及边界线条亮度
|
||||||
};//struct PlaneGridCreateInfo
|
};//struct PlaneGridCreateInfo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个平面网格(线条)
|
* 创建一个平面网格(线条)
|
||||||
*/
|
*/
|
||||||
Primitive *CreatePlaneGrid(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci);
|
Primitive *CreatePlaneGrid2D(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci); //创建一个平面网格(线条)
|
||||||
|
|
||||||
|
Primitive *CreatePlaneGrid3D(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个平面(三角形)
|
* 创建一个平面(三角形)
|
||||||
|
@ -163,8 +163,8 @@ namespace hgl
|
|||||||
|
|
||||||
return pc->Create();
|
return pc->Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePlaneGrid(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci)
|
Primitive *CreatePlaneGrid2D(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci)
|
||||||
{
|
{
|
||||||
if(!pc->Init("PlaneGrid",((pgci->grid_size.Width()+1)+(pgci->grid_size.Height()+1))*2,0))
|
if(!pc->Init("PlaneGrid",((pgci->grid_size.Width()+1)+(pgci->grid_size.Height()+1))*2,0))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -192,7 +192,59 @@ namespace hgl
|
|||||||
Vector2f(left+col,bottom));
|
Vector2f(left+col,bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
VABMap1f lum(pc->GetVABMap(VAN::Luminance));
|
VABMap1uf8 lum(pc->GetVABMap(VAN::Luminance));
|
||||||
|
|
||||||
|
if(lum.IsValid())
|
||||||
|
{
|
||||||
|
for(uint row=0;row<=pgci->grid_size.Height();row++)
|
||||||
|
{
|
||||||
|
if((row%pgci->sub_count.Height())==0)
|
||||||
|
lum->RepeatWrite(pgci->sub_lum,2);
|
||||||
|
else
|
||||||
|
lum->RepeatWrite(pgci->lum,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint col=0;col<=pgci->grid_size.Width();col++)
|
||||||
|
{
|
||||||
|
if((col%pgci->sub_count.Width())==0)
|
||||||
|
lum->RepeatWrite(pgci->sub_lum,2);
|
||||||
|
else
|
||||||
|
lum->RepeatWrite(pgci->lum,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pc->Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
Primitive *CreatePlaneGrid3D(PrimitiveCreater *pc,const PlaneGridCreateInfo *pgci)
|
||||||
|
{
|
||||||
|
if(!pc->Init("PlaneGrid",((pgci->grid_size.Width()+1)+(pgci->grid_size.Height()+1))*2,0))
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
VABMap3f vertex(pc->GetVABMap(VAN::Position));
|
||||||
|
|
||||||
|
if(!vertex.IsValid())
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
const float right=float(pgci->grid_size.Width())/2.0f;
|
||||||
|
const float left =-right;
|
||||||
|
|
||||||
|
const float bottom=float(pgci->grid_size.Height())/2.0f;
|
||||||
|
const float top =-bottom;
|
||||||
|
|
||||||
|
for(uint row=0;row<=pgci->grid_size.Height();row++)
|
||||||
|
{
|
||||||
|
vertex->WriteLine( Vector3f(left ,top+row,0),
|
||||||
|
Vector3f(right,top+row,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint col=0;col<=pgci->grid_size.Width();col++)
|
||||||
|
{
|
||||||
|
vertex->WriteLine(Vector3f(left+col,top ,0),
|
||||||
|
Vector3f(left+col,bottom,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
VABMap1uf8 lum(pc->GetVABMap(VAN::Luminance));
|
||||||
|
|
||||||
if(lum.IsValid())
|
if(lum.IsValid())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user