示例#1
0
 public void Write()
 {
     Help.IOHelp.WriteVec(Diff);
     Help.IOHelp.WriteVec(Spec);
     Help.IOHelp.WriteFloat(Shine);
     Help.IOHelp.WriteBool(ColorMap != null);
     if (ColorMap != null)
     {
         ColorMap.Write();
     }
     Help.IOHelp.WriteBool(NormalMap != null);
     if (NormalMap != null)
     {
         NormalMap.Write();
     }
     Help.IOHelp.WriteBool(SpecularMap != null);
     if (SpecularMap != null)
     {
         SpecularMap.Write();
     }
     Help.IOHelp.WriteBool(ExtraMap != null);
     if (ExtraMap != null)
     {
         ExtraMap.Write();
     }
     Help.IOHelp.WriteBool(EnvironmentMap != null);
     if (EnvironmentMap != null)
     {
         Help.IOHelp.WriteString(EnvironmentMap.Path);
     }
 }
示例#2
0
        /// <summary>
        /// Dispose resources
        /// </summary>
        public void Dispose()
        {
            if (Mesh != null)
            {
                Mesh.Dispose();
            }
            Mesh = null;

            if (SpecularMap != null)
            {
                SpecularMap.Dispose();
            }
            SpecularMap = null;

            if (HeightMap != null)
            {
                HeightMap.Dispose();
            }
            HeightMap = null;

            if (BumpMap != null)
            {
                BumpMap.Dispose();
            }
            BumpMap = null;

            if (DiffuseMap != null)
            {
                DiffuseMap.Dispose();
            }
            DiffuseMap = null;
        }
示例#3
0
        public virtual void Release()
        {
            if (ColorMap != null)
            {
                ColorMap.Release(0);
            }

            if (NormalMap != null)
            {
                NormalMap.Release(1);
            }
            //if (TSpec != null) TSpec.Release(2);
            if (EnvironmentMap != null)
            {
                EnvironmentMap.Release(4);
            }

            if (SpecularMap != null)
            {
                SpecularMap.Release(3);
            }
            if (ExtraMap != null)
            {
                ExtraMap.Release(5);
            }

            Active = null;
        }
示例#4
0
        private void CreateRenderTargets(GraphicsDevice graphics)
        {
            var pp = graphics.PresentationParameters;

            currLightMapScale = GameMain.Config.LightMapScale;

            LightMap?.Dispose();
            LightMap = new RenderTarget2D(graphics,
                                          (int)(GameMain.GraphicsWidth * GameMain.Config.LightMapScale), (int)(GameMain.GraphicsHeight * GameMain.Config.LightMapScale), false,
                                          pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
                                          RenderTargetUsage.DiscardContents);

            SpecularMap?.Dispose();
            SpecularMap = new RenderTarget2D(graphics,
                                             (int)(GameMain.GraphicsWidth * GameMain.Config.LightMapScale), (int)(GameMain.GraphicsHeight * GameMain.Config.LightMapScale), false,
                                             pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
                                             RenderTargetUsage.DiscardContents);

            HighlightMap?.Dispose();
            HighlightMap = new RenderTarget2D(graphics,
                                              (int)(GameMain.GraphicsWidth * GameMain.Config.LightMapScale), (int)(GameMain.GraphicsHeight * GameMain.Config.LightMapScale), false,
                                              pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
                                              RenderTargetUsage.DiscardContents);

            LosTexture?.Dispose();
            LosTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth * GameMain.Config.LightMapScale), (int)(GameMain.GraphicsHeight * GameMain.Config.LightMapScale), false, SurfaceFormat.Color, DepthFormat.None);
        }
示例#5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DiffuseMap != null ? DiffuseMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (NormalMap != null ? NormalMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SpecularMap != null ? SpecularMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Color.GetHashCode();
         return(hashCode);
     }
 }
示例#6
0
 /// <summary>
 /// Calls <see cref="Asset.ReleaseReference"/> for all contained <see cref="XTexture"/>s.
 /// </summary>
 public void ReleaseReference()
 {
     if (DiffuseMaps != null)
     {
         foreach (var texture in DiffuseMaps.WhereNotNull())
         {
             texture.ReleaseReference();
         }
     }
     NormalMap?.ReleaseReference();
     HeightMap?.ReleaseReference();
     SpecularMap?.ReleaseReference();
     EmissiveMap?.ReleaseReference();
 }
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                }

                if (DiffuseMap != null)
                {
                    DiffuseMap.Dispose();
                }

                if (NormalMap != null)
                {
                    NormalMap.Dispose();
                }

                if (DiffuseAlphaMap != null)
                {
                    DiffuseAlphaMap.Dispose();
                }

                if (ColorTable != null)
                {
                    ColorTable.Dispose();
                }

                if (MaskMap != null)
                {
                    MaskMap.Dispose();
                }

                if (SpecularMap != null)
                {
                    SpecularMap.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
示例#8
0
        public virtual void Bind()
        {
            if (ColorMap != null)
            {
                ColorMap.Bind(0);
            }

            if (NormalMap != null)
            {
                NormalMap.Bind(1);
            }

            //if (TSpec != null) TSpec.Bind(2);

            if (ShadowMap != null)
            {
                // ShadowMap.Bind ( 2 );
            }

            if (EnvironmentMap != null)
            {
                EnvironmentMap.Bind(4);
            }

            if (SpecularMap != null)
            {
                SpecularMap.Bind(3);
            }

            if (ExtraMap != null)
            {
                ExtraMap.Bind(5);
            }

            Active = this;
        }
 public void Accept(ShaderGeneratorContext context)
 {
     SpecularMap.Accept(context);
 }
示例#10
0
 public void Visit(MaterialGeneratorContext context)
 {
     SpecularMap.Visit(context);
 }