Example #1
0
 public bool Equals(Material other)
 {
     return(diffuseMap == other.diffuseMap && Shader.Equals(other.Shader) &&
            RenderSizeMode == other.RenderSizeMode && DefaultColor == other.DefaultColor &&
            animation == other.animation && Duration == other.Duration &&
            spriteSheet == other.spriteSheet && RenderingCalculator.Equals(other.RenderingCalculator));
 }
Example #2
0
 public Material(Color nonUvColor, ShaderFlags nonUvShaderFlags)
     : base("<GeneratedCustomMaterial:" + nonUvColor + ":" + nonUvShaderFlags + ">")
 {
     Shader              = ContentLoader.Create <Shader>(new ShaderCreationData(nonUvShaderFlags));
     DefaultColor        = nonUvColor;
     MetaData            = new ContentMetaData();
     RenderingCalculator = new RenderingCalculator();
 }
Example #3
0
 protected override void CreateDefault()
 {
     PixelSize = DefaultTextureSize;
     DisableLinearFiltering = true;
     BlendMode = BlendMode.Opaque;
     Fill(CheckerMapColors);
     SetSamplerState();
     RenderingCalculator = new RenderingCalculator();
 }
Example #4
0
 /// <summary>
 /// Special constructor for creating custom shaders and images or reusing existing instances.
 /// </summary>
 public Material(Shader customShader, Image customDiffuseMap)
     : base("<GeneratedCustomMaterial:" + customShader + ":" + customDiffuseMap + ">")
 {
     Shader              = customShader;
     DiffuseMap          = customDiffuseMap;
     DefaultColor        = Color.White;
     MetaData            = new ContentMetaData();
     RenderingCalculator = new RenderingCalculator();
 }
Example #5
0
 protected Image(ImageCreationData data)
     : base("<GeneratedImage>")
 {
     PixelSize              = data.PixelSize;
     BlendMode              = data.BlendMode;
     UseMipmaps             = data.UseMipmaps;
     AllowTiling            = data.AllowTiling;
     DisableLinearFiltering = data.DisableLinearFiltering;
     RenderingCalculator    = new RenderingCalculator();
 }
Example #6
0
 private void Initialize(ShaderFlags flags, string imageOrAnimationName, Color defaultColor)
 {
     Shader              = ContentLoader.Create <Shader>(new ShaderCreationData(flags));
     DefaultColor        = defaultColor;
     RenderingCalculator = new RenderingCalculator();
     if (!String.IsNullOrEmpty(imageOrAnimationName))
     {
         DetermineUseCaseData(imageOrAnimationName);
     }
 }
Example #7
0
 /// <summary>
 /// Creates a new image with the specified size to be filled dynamically (via .DiffuseMap.Fill).
 /// </summary>
 public Material(Size customPixelSize, ShaderFlags shaderFlags = ShaderFlags.Position2DTextured)
     : base("<GeneratedCustomMaterial:" + shaderFlags + ":" + customPixelSize + ">")
 {
     Shader              = ContentLoader.Create <Shader>(new ShaderCreationData(shaderFlags));
     DiffuseMap          = ContentLoader.Create <Image>(new ImageCreationData(customPixelSize));
     pixelSize           = customPixelSize;
     DefaultColor        = Color.White;
     MetaData            = new ContentMetaData();
     RenderingCalculator = new RenderingCalculator();
 }
Example #8
0
 /// <summary>
 /// Creates an 1x1 image with a colored shader material for simple solid flat surfaces.
 /// </summary>
 public Material(Color nonUVShaderColor)
     : base("<GeneratedCustomMaterial:" + nonUVShaderColor + ">")
 {
     Shader     = ContentLoader.Create <Shader>(new ShaderCreationData(ShaderFlags.Position2DColored));
     DiffuseMap = ContentLoader.Create <Image>(new ImageCreationData(Size.One));
     DiffuseMap.Fill(Color.White);
     pixelSize           = Size.One;
     DefaultColor        = nonUVShaderColor;
     MetaData            = new ContentMetaData();
     RenderingCalculator = new RenderingCalculator();
 }
Example #9
0
        private void CreateUVCalculator(Rectangle uv)
        {
            var atlasRegion = new AtlasRegion
            {
                UV        = uv,
                PadLeft   = GetFloatOrZero("PadLeft"),
                PadRight  = GetFloatOrZero("PadRight"),
                PadTop    = GetFloatOrZero("PadTop"),
                PadBottom = GetFloatOrZero("PadBottom"),
                IsRotated = MetaData.Get("Rotated", "").ToLowerInvariant() == "true"
            };

            RenderingCalculator = new RenderingCalculator(atlasRegion);
        }
Example #10
0
 private void ProcessImage(Stream fileData)
 {
     ExtractMetaData();
     SetSamplerStateAndTryToLoadImage(fileData);
     RenderingCalculator = new RenderingCalculator();
 }