public Shader Generate( GenFlags flags ) { string pp = ""; if (flags.HasFlag(GenFlags.ColorMap)) { pp += "#define HAS_COLOR_MAP\n"; } if (flags.HasFlag(GenFlags.VertexColor)) { pp += "#define HAS_VERTEX_COLOR\n"; } if (flags.HasFlag(GenFlags.PhongSpecularShading)) { pp += "#define HAS_PHONG_SPECULAR_SHADING\n"; } if (flags.HasFlag(GenFlags.Skinning)) { pp += "#define HAS_SKINNING\n"; } if (flags.HasFlag(GenFlags.Lighting)) { pp += "#define HAS_LIGHTING\n"; } return Shader.FromResource("open3mod.Shader.UberVertexShader.glsl", "open3mod.Shader.UberFragmentShader.glsl", pp); }
public Shader Generate(GenFlags flags) { string pp = ""; if (flags.HasFlag(GenFlags.ColorMap)) { pp += "#define HAS_COLOR_MAP\n"; } if (flags.HasFlag(GenFlags.VertexColor)) { pp += "#define HAS_VERTEX_COLOR\n"; } if (flags.HasFlag(GenFlags.PhongSpecularShading)) { pp += "#define HAS_PHONG_SPECULAR_SHADING\n"; } if (flags.HasFlag(GenFlags.Skinning)) { pp += "#define HAS_SKINNING\n"; } if (flags.HasFlag(GenFlags.Lighting)) { pp += "#define HAS_LIGHTING\n"; } return(new Shader("open3mod.Shader.UberVertexShader.glsl", "open3mod.Shader.UberFragmentShader.glsl", pp)); }
public Shader GenerateOrGetFromCache(GenFlags flags) { if (!shaders_.ContainsKey(flags)) { shaders_[flags] = Generate(flags); } return(shaders_[flags]); }
public Shader GenerateOrGetFromCache(GenFlags flags) { if (!shaders_.ContainsKey(flags)) { shaders_[flags] = Generate(flags); } return shaders_[flags]; }
public Shader GenerateOrGetFromCache(GenFlags flags, int lightCount) { int byteShift = 0x20; if (!shaders_.ContainsKey(flags + lightCount * byteShift)) { shaders_[flags + lightCount * byteShift] = Generate(flags, lightCount); } return(shaders_[flags + lightCount * byteShift]); }
public Shader Generate(GenFlags flags, int lightCount) { string pp = ""; if (lightCount > 0) { pp += "#define NR_LIGHTS " + lightCount.ToString() + "\n"; } if (flags.HasFlag(GenFlags.TwoSide)) { pp += "#define HAS_TWOSIDE\n"; } if (flags.HasFlag(GenFlags.VertexColor)) { pp += "#define HAS_VERTEX_COLOR\n"; } if (flags.HasFlag(GenFlags.PhongSpecularShading)) { pp += "#define HAS_PHONG_SPECULAR_SHADING\n"; } if (flags.HasFlag(GenFlags.Skinning)) { pp += "#define HAS_SKINNING\n"; } if (flags.HasFlag(GenFlags.Lighting)) { pp += "#define HAS_LIGHTING\n"; } return(Shader.FromResource("open3mod.Shaders.UberVertexShader.glsl", "open3mod.Shaders.UberFragmentShader.glsl", pp)); }