static GpuMaterialPass GetMaterialPass() { if (materialPass == null) { //generate compile arguments var generalDefines = new List <(string, string)>(); //vertex program GpuProgram vertexProgram = GpuProgramManager.GetProgram($"Skybox_Vertex_", GpuProgramType.Vertex, $@"Base\Shaders\Skybox_vs.sc", generalDefines, out var error); if (!string.IsNullOrEmpty(error)) { Log.Warning(error); return(null); } //fragment program GpuProgram fragmentProgram = GpuProgramManager.GetProgram($"Skybox_Fragment_", GpuProgramType.Fragment, $@"Base\Shaders\Skybox_fs.sc", generalDefines, out error); if (!string.IsNullOrEmpty(error)) { Log.Warning(error); return(null); } var pass = new GpuMaterialPass(vertexProgram, fragmentProgram); pass.CullingMode = CullingMode.None; pass.DepthCheck = true; pass.DepthWrite = false; materialPass = pass; } return(materialPass); }
static GpuMaterialPass GetMaterialPass(bool cube) { if (cube && materialPassCube == null || !cube && materialPass2D == null) { //generate compile arguments var generalDefines = new List <(string, string)>(); if (!cube) { generalDefines.Add(("USE_2D", "")); } //vertex program GpuProgram vertexProgram = GpuProgramManager.GetProgram($"Skybox_Vertex_", GpuProgramType.Vertex, $@"Base\Shaders\Skybox_vs.sc", generalDefines, out var error); if (!string.IsNullOrEmpty(error)) { Log.Warning(error); return(null); } //fragment program GpuProgram fragmentProgram = GpuProgramManager.GetProgram($"Skybox_Fragment_", GpuProgramType.Fragment, $@"Base\Shaders\Skybox_fs.sc", generalDefines, out error); if (!string.IsNullOrEmpty(error)) { Log.Warning(error); return(null); } var pass = new GpuMaterialPass(vertexProgram, fragmentProgram); pass.CullingMode = CullingMode.None; pass.DepthCheck = true; pass.DepthWrite = false; if (cube) { materialPassCube = pass; } else { materialPass2D = pass; } } return(cube ? materialPassCube : materialPass2D); }