optimized to get normal in AutoShader

This commit is contained in:
hyzboy 2024-03-12 23:29:38 +08:00
parent c469fde84a
commit b9f5c69f85
3 changed files with 16 additions and 14 deletions

View File

@ -42,7 +42,7 @@ Code
void main() void main()
{ {
Output.Normal =GetNormal(GetNormalMatrix(),Normal); Output.Normal =GetNormal();
Output.Position =GetPosition3D(); Output.Position =GetPosition3D();
HandoverMI(); HandoverMI();

View File

@ -122,18 +122,18 @@ private:
{ {
using namespace inline_geometry; using namespace inline_geometry;
//Plane Grid ////Plane Grid
{ //{
struct PlaneGridCreateInfo pgci; // struct PlaneGridCreateInfo pgci;
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.5; // pgci.lum=0.5;
pgci.sub_lum=0.75; // pgci.sub_lum=0.75;
prim_plane_grid=CreatePlaneGrid(db,mtl_vertex_lum->GetDefaultVIL(),&pgci); // prim_plane_grid=CreatePlaneGrid(db,mtl_vertex_lum->GetDefaultVIL(),&pgci);
} //}
//Sphere //Sphere
{ {
@ -145,7 +145,7 @@ private:
bool InitScene() bool InitScene()
{ {
Add(prim_plane_grid,mi_plane_grid,p_line); //Add(prim_plane_grid,mi_plane_grid,p_line);
Add(prim_sphere,mi_sphere,p_sphere); Add(prim_sphere,mi_sphere,p_sphere);
camera->pos=Vector3f(32,32,32); camera->pos=Vector3f(32,32,32);
@ -165,8 +165,8 @@ public:
if(!SceneAppFramework::Init(w,h)) if(!SceneAppFramework::Init(w,h))
return(false); return(false);
if(!InitVertexLumMP()) //if(!InitVertexLumMP())
return(false); // return(false);
if(!CreateBlinnPhongUBO()) if(!CreateBlinnPhongUBO())
return(false); return(false);

View File

@ -35,7 +35,9 @@ bool Std3DMaterial::CustomVertexShader(ShaderCreateInfoVertex *vsc)
{ {
vsc->AddFunction(func::GetNormalMatrix); vsc->AddFunction(func::GetNormalMatrix);
vsc->AddFunction(func::GetNormal); vsc->AddFunction(func::GetNormal);
// vsc->AddFunction(func::GetNormalVS);
if(vsc->hasInput(VAN::Normal))
vsc->AddFunction(func::GetNormalVS);
} }
mci->AddStruct(SBS_ViewportInfo); mci->AddStruct(SBS_ViewportInfo);