Exemplo n.º 1
0
 internal static void LoadTextures(MyMaterialProxy proxy, MyMaterialDescription desc)
 {
     {
         proxy.SetTexture("ColorMetalTexture",
                          MyTextureManager.GetColorMetalTexture(desc.TextureColorMetalPath).ShaderView);
         proxy.SetTexture("NormalGlossTexture",
                          MyTextureManager.GetNormalGlossTexture(desc.TextureNormalGlossPath).ShaderView);
         proxy.SetTexture("AmbientOcclusionTexture",
                          MyTextureManager.GetExtensionsTexture(desc.TextureAmbientOcclusionPath).ShaderView);
         if (desc.TextureAlphamaskPath != null)
         {
             proxy.SetTexture("AlphamaskTexture",
                              MyTextureManager.GetAlphamaskTexture(desc.TextureAlphamaskPath).ShaderView);
         }
     }
     proxy.RecalcTexturesHash();
 }
Exemplo n.º 2
0
 internal static void LoadTextures(MyMaterialProxy proxy, MyMaterialDescription desc)
 {
     {
         proxy.SetTexture("ColorMetalTexture",
             MyTextureManager.GetColorMetalTexture(desc.TextureColorMetalPath).ShaderView);
         proxy.SetTexture("NormalGlossTexture",
             MyTextureManager.GetNormalGlossTexture(desc.TextureNormalGlossPath).ShaderView);
         proxy.SetTexture("AmbientOcclusionTexture",
             MyTextureManager.GetExtensionsTexture(desc.TextureAmbientOcclusionPath).ShaderView);
         if (desc.TextureAlphamaskPath != null)
         {
             proxy.SetTexture("AlphamaskTexture",
                 MyTextureManager.GetAlphamaskTexture(desc.TextureAlphamaskPath).ShaderView);
         }
     }
     proxy.RecalcTexturesHash();
 }
Exemplo n.º 3
0
        internal static MyMaterialProxy Create(MyMaterialDescription ? desc, string materialTag)
        {
            int key = desc.HasValue ? desc.Value.CalculateKey() : 0;
            key = MyHashHelper.Combine(key, materialTag.GetHashCode());

            var proxy = m_proxies.SetDefault(key, null);
            if (proxy != null)
                return proxy;

            proxy = MyShaderMaterialReflection.CreateBindings(materialTag);

            if(desc == null)
            {
                // TODO: change later
                desc = MyAssetMesh.GetDebugMaterialDescriptor();
            }

            LoadTextures(proxy, desc.Value);

            proxy.RecalcConstantsHash();

            m_proxies[key] = proxy;
            m_descriptors[key] = desc.Value;

            m_reverseMapping[proxy] = desc.Value;

            return proxy;
        }