Ejemplo n.º 1
0
        internal static void Init()
        {
            m_vs = MyShaders.CreateVs("Decals/Decals.hlsl");
            var transparentMacro = new ShaderMacro("RENDER_TO_TRANSPARENT", null);

            m_psColorMapTransparent = MyShaders.CreatePs("Decals/Decals.hlsl", new ShaderMacro[] { transparentMacro });
            m_psColorMap            = MyShaders.CreatePs("Decals/Decals.hlsl", MyMeshMaterials1.GetMaterialTextureMacros(MyFileTextureEnum.COLOR_METAL));
            m_psNormalMap           = MyShaders.CreatePs("Decals/Decals.hlsl", MyMeshMaterials1.GetMaterialTextureMacros(MyFileTextureEnum.NORMALMAP_GLOSS));
            m_psNormalColorMap      = MyShaders.CreatePs("Decals/Decals.hlsl",
                                                         MyMeshMaterials1.GetMaterialTextureMacros(MyFileTextureEnum.COLOR_METAL | MyFileTextureEnum.NORMALMAP_GLOSS));
            m_psNormalColorExtMap = MyShaders.CreatePs("Decals/Decals.hlsl",
                                                       MyMeshMaterials1.GetMaterialTextureMacros(
                                                           MyFileTextureEnum.COLOR_METAL | MyFileTextureEnum.NORMALMAP_GLOSS | MyFileTextureEnum.EXTENSIONS));

            InitIB();
        }
 internal static void AddMaterialShaderFlagMacrosTo(List <ShaderMacro> list, MyShaderUnifiedFlags flags, MyFileTextureEnum textureTypes = MyFileTextureEnum.UNSPECIFIED)
 {
     if ((flags & MyShaderUnifiedFlags.DEPTH_ONLY) > 0)
     {
         list.Add(new ShaderMacro("DEPTH_ONLY", null));
     }
     if ((flags & MyShaderUnifiedFlags.ALPHA_MASKED) > 0)
     {
         list.Add(new ShaderMacro("ALPHA_MASKED", null));
     }
     if ((flags & MyShaderUnifiedFlags.ALPHA_MASK_ARRAY) > 0)
     {
         list.Add(new ShaderMacro("ALPHA_MASK_ARRAY", null));
     }
     if ((flags & MyShaderUnifiedFlags.TRANSPARENT) > 0)
     {
         list.Add(new ShaderMacro("TRANSPARENT", null));
     }
     if ((flags & MyShaderUnifiedFlags.DITHERED) > 0)
     {
         list.Add(new ShaderMacro("DITHERED", null));
     }
     if ((flags & MyShaderUnifiedFlags.DITHERED_LOD) > 0)
     {
         list.Add(new ShaderMacro("DITHERED_LOD", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_SKINNING) > 0)
     {
         list.Add(new ShaderMacro("USE_SKINNING", null));
     }
     if ((flags & MyShaderUnifiedFlags.STATIC_DECAL) > 0)
     {
         Debug.Assert(textureTypes != MyFileTextureEnum.UNSPECIFIED);
         list.Add(new ShaderMacro("STATIC_DECAL", null));
         list.AddRange(MyMeshMaterials1.GetMaterialTextureMacros(textureTypes));
     }
     if ((flags & MyShaderUnifiedFlags.STATIC_DECAL_CUTOUT) > 0)
     {
         list.Add(new ShaderMacro("STATIC_DECAL_CUTOUT", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_CUBE_INSTANCING) > 0)
     {
         list.Add(new ShaderMacro("USE_CUBE_INSTANCING", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_DEFORMED_CUBE_INSTANCING) > 0)
     {
         list.Add(new ShaderMacro("USE_DEFORMED_CUBE_INSTANCING", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_GENERIC_INSTANCING) > 0)
     {
         list.Add(new ShaderMacro("USE_GENERIC_INSTANCING", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_MERGE_INSTANCING) > 0)
     {
         list.Add(new ShaderMacro("USE_MERGE_INSTANCING", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_SINGLE_INSTANCE) > 0)
     {
         Debug.Assert((flags & MyShaderUnifiedFlags.USE_MERGE_INSTANCING) > 0);
         list.Add(new ShaderMacro("USE_SINGLE_INSTANCE", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_VOXEL_MORPHING) == MyShaderUnifiedFlags.USE_VOXEL_MORPHING)
     {
         list.Add(new ShaderMacro("USE_VOXEL_MORPHING", null));
     }
     if ((flags & MyShaderUnifiedFlags.USE_VOXEL_DATA) == MyShaderUnifiedFlags.USE_VOXEL_DATA)
     {
         list.Add(new ShaderMacro("USE_VOXEL_DATA", null));
     }
 }