Beispiel #1
0
 internal static void InitDefaultContent()
 {
     DefaultContent.InitType <FragmentShader>(".frag", stream =>
     {
         using (StreamReader reader = new StreamReader(stream))
         {
             string code = reader.ReadToEnd();
             return(new FragmentShader(code));
         }
     });
 }
Beispiel #2
0
 internal static void InitDefaultContent()
 {
     DefaultContent.InitType <Material>(new Dictionary <string, Material>
     {
         { "SolidWhite", new Material(DrawTechnique.Solid, ColorRgba.White) },
         { "SolidBlack", new Material(DrawTechnique.Solid, ColorRgba.Black) },
         { "InvertWhite", new Material(DrawTechnique.Invert, ColorRgba.White) },
         { "CoheeIcon", new Material(DrawTechnique.Mask, Texture.CoheeIcon) },
         { "CoheeIconB", new Material(DrawTechnique.Mask, Texture.CoheeIconB) },
         { "CoheeLogoBig", new Material(DrawTechnique.Alpha, Texture.CoheeLogoBig) },
         { "CoheeLogoMedium", new Material(DrawTechnique.Alpha, Texture.CoheeLogoMedium) },
         { "CoheeLogoSmall", new Material(DrawTechnique.Alpha, Texture.CoheeLogoSmall) },
         { "Checkerboard", new Material(DrawTechnique.Solid, Texture.Checkerboard) },
     });
 }
Beispiel #3
0
        internal static void InitDefaultContent()
        {
            DefaultContent.InitType <DrawTechnique>(new Dictionary <string, DrawTechnique>
            {
                { "Solid", new DrawTechnique(BlendMode.Solid) },
                { "Mask", new DrawTechnique(BlendMode.Mask) },
                { "Add", new DrawTechnique(BlendMode.Add) },
                { "Alpha", new DrawTechnique(BlendMode.Alpha) },
                { "Multiply", new DrawTechnique(BlendMode.Multiply) },
                { "Light", new DrawTechnique(BlendMode.Light) },
                { "Invert", new DrawTechnique(BlendMode.Invert) },

                { "Picking", new DrawTechnique(BlendMode.Mask, VertexShader.Minimal, FragmentShader.Picking) },
                { "SharpAlpha", new DrawTechnique(BlendMode.Alpha, VertexShader.Minimal, FragmentShader.SharpAlpha) }
            });
        }
Beispiel #4
0
 internal static void InitDefaultContent()
 {
     DefaultContent.InitType <Texture>(new Dictionary <string, Texture>
     {
         { "CoheeIcon", new Texture(Pixmap.CoheeIcon) },
         { "CoheeIconB", new Texture(Pixmap.CoheeIconB) },
         { "CoheeLogoBig", new Texture(Pixmap.CoheeLogoBig) },
         { "CoheeLogoMedium", new Texture(Pixmap.CoheeLogoMedium) },
         { "CoheeLogoSmall", new Texture(Pixmap.CoheeLogoSmall) },
         { "White", new Texture(Pixmap.White) },
         { "Checkerboard", new Texture(
               Pixmap.Checkerboard,
               TextureSizeMode.Default,
               TextureMagFilter.Nearest,
               TextureMinFilter.Nearest,
               TextureWrapMode.Repeat,
               TextureWrapMode.Repeat) },
     });
 }
Beispiel #5
0
        internal static void InitDefaultContent()
        {
            IImageCodec codec = ImageCodec.GetRead(ImageCodec.FormatPng);

            if (codec == null)
            {
                Logs.Core.WriteError(
                    "Unable to retrieve image codec for format '{0}'. Can't initialize default {1} Resources.",
                    ImageCodec.FormatPng,
                    typeof(Pixmap).Name);

                // Initialize default content with generic error instances, so
                // everything else can still work as expected. We logged the error,
                // and there's nothing anyone can do about this at runtime, so just
                // fail gracefully without causing more trouble.
                DefaultContent.InitType <Pixmap>(name => new Pixmap(new PixelData(1, 1, new ColorRgba(255, 0, 255))));

                return;
            }
            DefaultContent.InitType <Pixmap>(".png", stream => new Pixmap(codec.Read(stream)));
        }