Beispiel #1
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();
 }
Beispiel #2
0
 /// <summary>
 /// As opposed to loading a material from content it can also be created with this constructor.
 /// If imageOrAnimationName is used you need to provide either a DiffuseMap or an Animation.
 /// </summary>
 public Material(ShaderFlags shaderFlags, string imageOrAnimationName)
     : base("<GeneratedMaterial:" + shaderFlags + ":" + imageOrAnimationName + ">")
 {
     Initialize(shaderFlags, imageOrAnimationName, Color.White);
     if (MetaData == null)
     {
         MetaData = new ContentMetaData();
     }
 }
Beispiel #3
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();
 }
Beispiel #4
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();
 }
Beispiel #5
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();
 }