internal static void InitDefaultContent() { DefaultContent.InitType <Sound>(new Dictionary <string, Sound> { { "Beep", new Sound(AudioData.Beep) } }); }
private static string LoadEmbeddedShaderSource(string name) { using (Stream stream = DefaultContent.GetEmbeddedResourceStream(name)) using (StreamReader reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } }
internal static void InitDefaultContent() { DefaultContent.InitType(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) } }); }
internal static void InitDefaultContent() { DefaultContent.InitType(".vert", stream => { using (StreamReader reader = new StreamReader(stream)) { string code = reader.ReadToEnd(); return(new VertexShader(code)); } }); }
internal static void InitDefaultContent() { DefaultContent.InitType <FragmentShader>(".frag", stream => { using (StreamReader reader = new StreamReader(stream)) { string code = reader.ReadToEnd(); return(new FragmentShader(code)); } }); }
internal static void InitDefaultContent() { DefaultContent.InitType(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) } }); }
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) }, { "DualityIcon", new Material(DrawTechnique.Mask, Texture.DualityIcon) }, { "DualityIconB", new Material(DrawTechnique.Mask, Texture.DualityIconB) }, { "DualityLogoBig", new Material(DrawTechnique.Alpha, Texture.DualityLogoBig) }, { "DualityLogoMedium", new Material(DrawTechnique.Alpha, Texture.DualityLogoMedium) }, { "DualityLogoSmall", new Material(DrawTechnique.Alpha, Texture.DualityLogoSmall) }, { "Checkerboard", new Material(DrawTechnique.Solid, Texture.Checkerboard) }, }); }
internal static void InitDefaultContent() { DefaultContent.InitType <Texture>(new Dictionary <string, Texture> { { "DualityIcon", new Texture(Pixmap.DualityIcon) }, { "DualityIconB", new Texture(Pixmap.DualityIconB) }, { "DualityLogoBig", new Texture(Pixmap.DualityLogoBig) }, { "DualityLogoMedium", new Texture(Pixmap.DualityLogoMedium) }, { "DualityLogoSmall", new Texture(Pixmap.DualityLogoSmall) }, { "White", new Texture(Pixmap.White) }, { "Checkerboard", new Texture( Pixmap.Checkerboard, TextureSizeMode.Default, TextureMagFilter.Nearest, TextureMinFilter.Nearest, TextureWrapMode.Repeat, TextureWrapMode.Repeat) }, }); }
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))); }
internal static void InitDefaultContent() { Font genericMonospace8; using (Stream stream = DefaultContent.GetEmbeddedResourceStream("Cousine8.Font.res")) { genericMonospace8 = Resource.Load <Font>(stream); } Font genericMonospace10; using (Stream stream = DefaultContent.GetEmbeddedResourceStream("Cousine10.Font.res")) { genericMonospace10 = Resource.Load <Font>(stream); } DefaultContent.InitType <Font>(new Dictionary <string, Font> { { "GenericMonospace8", genericMonospace8 }, { "GenericMonospace10", genericMonospace10 }, }); }
internal static void InitDefaultContent() { RenderSetup defaultSetup = new RenderSetup(); defaultSetup.Steps.Add(new RenderStep { Id = "World", DefaultClearColor = true, DefaultProjection = true }); defaultSetup.Steps.Add(new RenderStep { Id = "ScreenOverlay", Projection = ProjectionMode.Screen, ClearFlags = ClearFlag.None, VisibilityMask = VisibilityFlag.AllGroups | VisibilityFlag.ScreenOverlay }); DefaultContent.InitType(new Dictionary <string, RenderSetup> { { "Default", defaultSetup }, }); }
internal static void InitDefaultContent() { DefaultContent.InitType <AudioData>(".ogg", stream => new AudioData(stream)); }