Beispiel #1
0
        public Renderer(VideoSystem videosystem)
        {
            if (videosystem == null)
            {
                throw new ArgumentNullException("videosystem");
            }

            m_videosystem = videosystem;

            using (IO.File effectfile = m_videosystem.GetSubSystem <IO.FileSystem>().OpenFile("xnaMugen.data.Shader.fx"))
            {
                CompiledEffect compiled = Effect.CompileEffectFromSource(effectfile.ReadToEnd(), null, null, CompilerOptions.None, TargetPlatform.Windows);
                if (compiled.Success == false)
                {
                    throw new InvalidOperationException("Cannot successfully create shader.");
                }

                m_effect = new Effect(Device, compiled.GetEffectCode(), CompilerOptions.NotCloneable, null);
            }

            m_drawbuffer = new Vertex[500];
            m_parameters = new KeyedCollection <String, EffectParameter>(x => x.Name);

            m_nullpixels  = m_videosystem.CreatePixelTexture(new Point(2, 2));
            m_nullpalette = m_videosystem.CreatePaletteTexture();

            Byte[] pixels = new Byte[] { 1, 2, 1, 2 };
            m_nullpixels.SetData <Byte>(pixels);

            Color[] paldata = new Color[256];
            paldata[1] = Color.White;
            paldata[2] = Color.Red;
            m_nullpalette.SetData <Color>(paldata);
        }
Beispiel #2
0
        public Renderer(VideoSystem videosystem)
        {
            if (videosystem == null) throw new ArgumentNullException("videosystem");

            m_videosystem = videosystem;

            using (IO.File effectfile = m_videosystem.GetSubSystem<IO.FileSystem>().OpenFile("xnaMugen.data.Shader.fx"))
            {
                CompiledEffect compiled = Effect.CompileEffectFromSource(effectfile.ReadToEnd(), null, null, CompilerOptions.None, TargetPlatform.Windows);
                if (compiled.Success == false)
                {
                    throw new InvalidOperationException("Cannot successfully create shader.");
                }

                m_effect = new Effect(Device, compiled.GetEffectCode(), CompilerOptions.NotCloneable, null);
            }

            m_drawbuffer = new Vertex[500];
            m_parameters = new KeyedCollection<String, EffectParameter>(x => x.Name);

            m_nullpixels = m_videosystem.CreatePixelTexture(new Point(2, 2));
            m_nullpalette = m_videosystem.CreatePaletteTexture();

            Byte[] pixels = new Byte[] { 1, 2, 1, 2 };
            m_nullpixels.SetData<Byte>(pixels);

            Color[] paldata = new Color[256];
            paldata[1] = Color.White;
            paldata[2] = Color.Red;
            m_nullpalette.SetData<Color>(paldata);
        }
Beispiel #3
0
        public Renderer(VideoSystem videosystem)
        {
            if (videosystem == null)
            {
                throw new ArgumentNullException(nameof(videosystem));
            }

            m_videosystem = videosystem;

            m_videosystem.SubSystems.Game.Content.RootDirectory = "data";
            m_effect = m_videosystem.SubSystems.Game.Content.Load <Effect>("bin/shader");

            m_drawbuffer = new Vertex[500];
            m_parameters = new KeyedCollection <string, EffectParameter>(x => x.Name);

            m_nullpixels  = m_videosystem.CreatePixelTexture(new Point(2, 2));
            m_nullpalette = m_videosystem.CreatePaletteTexture();

            var pixels = new byte[] { 1, 2, 1, 2 };

            m_nullpixels.SetData(pixels);

            var paldata = new Color[256];

            paldata[1] = Color.White;
            paldata[2] = Color.Red;
            m_nullpalette.SetData(paldata);
        }