Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="device"></param>
 /// <param name="wrappedContent"></param>
 /// <param name="fontName"></param>
 /// <param name="userMail"></param>
 public CrashDebugger(
     GraphicsDevice device,
     WrappedContentManager wrappedContent,
     string fontName,
     string userMail
     )
 {
     font = wrappedContent.Load <SpriteFont>(fontName);
     //testTexture = wrappedContent.Load<Texture2D>("Textures/custom_uv_diag");
     spriteBatch   = new SpriteBatch(device);
     this.userMail = userMail;
 }
Пример #2
0
        public RendererUpdateQueue Initialize(
            WrappedContentManager wrappedContent,
            string simulationLevel,
            string rendererLevel,
            double startTime
            )
        {
            try
            {
                simTime = new SimulationTime(startTime);

                StartOperation(); // needs a valid simTime!

                paused = false;

                currentUpdateQueue.AddUpdate(new Renderer.Renderer.ChangeLevelUpdate(rendererLevel));
                SetPhase(SimulationPhase.Intro, "", null);

                // load level data
                levelData = wrappedContent.Load <LevelData>(simulationLevel);
                entityManager.Load(levelData);
                soundRegistry.Load();
                LevelLoaded();

                // start to play sounds
                MusicSettingsLoaded();

                Game.Instance.AudioPlayer.Play(soundRegistry.CaveBackgroundLoop, true);
                Game.Instance.AudioPlayer.Play(soundRegistry.LavaBackgroundLoop, true);

                return(EndOperation());
            }
            finally
            {
                currentUpdateQueue = null;
            }
        }
Пример #3
0
        public Profiler(WrappedContentManager wrappedContent, string name)
        {
            rootSection  = new Section(this, null, "root");
            sectionStack = new List <Section>(100);
            frameNumber  = 0;
            inBeginFrame = false;
            this.name    = name;

            filterList = new List <string>();
            filterList.Add("root");
            filterList.Add("root.draw");
            filterList.Add("root.draw.beginning_stuff");
            filterList.Add("root.draw.rendering.*");

            if (wrappedContent != null)
            {
                overlayBackground = new Texture2D(Game.Instance.GraphicsDevice, 32, 32);
                Color[] colorData = new Color[overlayBackground.Width * overlayBackground.Height];
                for (int i = 0; i < overlayBackground.Width * overlayBackground.Height; ++i)
                {
                    colorData[i] = Color.Black;
                }
                overlayBackground.SetData <Color>(colorData);

                overlayBackground2 = new Texture2D(Game.Instance.GraphicsDevice, 32, 32);
                for (int i = 0; i < overlayBackground2.Width * overlayBackground2.Height; ++i)
                {
                    colorData[i] = Color.Yellow;
                }
                overlayBackground2.SetData <Color>(colorData);

                spriteBatch = new SpriteBatch(Game.Instance.GraphicsDevice);

                font = wrappedContent.Load <SpriteFont>("Fonts/kootenay20");
            }
        }
Пример #4
0
 protected override Texture2D LoadSprite(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Texture2D>("Textures/Sfx/IceExplosion"));
 }
Пример #5
0
 protected override Effect LoadEffect(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Effect>("Effects/Sfx/ParticleSystem/Stateful/Implementations/IceExplosion"));
 }
Пример #6
0
 private Effect LoadEffect(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Effect>("Effects/Sfx/ParticleSystem/Stateful/Implementations/IceSpike"));
 }
Пример #7
0
        public Renderer(
            WrappedContentManager wrappedContent,
            GraphicsDevice device
            )
        {
            EnablePostProcessing = true;

            renderTime = new RenderTime(Game.Instance.GlobalClock.ContinuousMilliseconds,
                                        Game.Instance.GlobalClock.PausableMilliseconds);

            entityManager = new RendererEntityManager();

            this.device       = device;
            updateRenderables = new List <Renderable>();
            //            shadowCaster = new List<Renderable>();
            opaqueRenderables          = new List <Renderable>();
            transparentRenderablesTEST = new List <Renderable>();
            transparentRenderables     = new List <Renderable>();
            overlays = new List <Renderable>();

            shadowEffect = wrappedContent.Load <Effect>("Effects/ShadowEffect");

            lightPosition   = new Vector3(0, 10000, 0); // later: replace by orthographic light, not lookAt
            lightTarget     = Vector3.Zero;
            lightProjection = Matrix.CreateOrthographic(1500, 1500, 0.0f, 10000.0f);

            // Set the light to look at the center of the scene.
            lightView = Matrix.CreateLookAt(
                lightPosition,
                lightTarget,
                new Vector3(0, 0, -1));

            // later: replace by something like this:

            lightRenderTarget = new RenderTarget2D(
                device,
                shadowMapSize,
                shadowMapSize,
                false,
                SurfaceFormat.Single,
                DepthFormat.Depth24Stencil8
                );

            vectorCloudTexture = wrappedContent.Load <Texture2D>("Textures/Lava/vectorclouds");
            Color[] vectorCloudTextureData = new Color[vectorCloudTexture.Width * vectorCloudTexture.Height];
            vectorCloudTexture.GetData <Color>(vectorCloudTextureData);

            HalfVector4[] vectorCloudTexture4vsData = new HalfVector4[vectorCloudTexture.Width * vectorCloudTexture.Height];
            for (int i = 0; i < vectorCloudTexture.Width * vectorCloudTexture.Height; ++i)
            {
                Color current = vectorCloudTextureData[i];
                float r       = (float)current.R / (float)Byte.MaxValue;
                float g       = (float)current.G / (float)Byte.MaxValue;
                float b       = (float)current.B / (float)Byte.MaxValue;
                vectorCloudTexture4vsData[i] = new HalfVector4(r, g, b, 1);
            }

            vectorCloudTextureForVertexShaders = new Texture2D(device, vectorCloudTexture.Width, vectorCloudTexture.Height, false, SurfaceFormat.HalfVector4);
            vectorCloudTextureForVertexShaders.SetData(vectorCloudTexture4vsData);

            // set up render targets
            PresentationParameters pp = Device.PresentationParameters;
            int width  = pp.BackBufferWidth;
            int height = pp.BackBufferHeight;
            //SurfaceFormat format = SurfaceFormat.HalfVector4;
            //SurfaceFormat format = SurfaceFormat.Vector4;
            SurfaceFormat format = pp.BackBufferFormat;

            if (EnablePostProcessing)
            {
                //ResolveTarget = new ResolveTexture2D(Device, width, height, 1, format);
                targetOpaqueColorBuffer = new RenderTarget2D(Device, width, height, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetAlphaColorBuffer  = new RenderTarget2D(Device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
                targetHDRColorBuffer    = new RenderTarget2D(Device, width, height, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetHorizontalBlurredHDRColorBuffer = new RenderTarget2D(Device, width / 2, height / 2, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetBlurredHDRColorBuffer           = new RenderTarget2D(Device, width / 2, height / 2, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);

                targetOpaqueRenderChannels            = new RenderTarget2D(Device, width, height, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetAlphaRenderChannels             = new RenderTarget2D(Device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
                targetRenderChannels                  = new RenderTarget2D(Device, width, height, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetHorizontalBlurredRenderChannels = new RenderTarget2D(Device, width / 2, height / 2, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);
                targetBlurredRenderChannels           = new RenderTarget2D(Device, width / 2, height / 2, false, SurfaceFormat.HalfVector4, DepthFormat.Depth24Stencil8);

                targetOpaqueDepth = new RenderTarget2D(Device, width, height, false, SurfaceFormat.Vector2, DepthFormat.Depth24Stencil8);
                targetAlphaDepth  = new RenderTarget2D(Device, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8);
                targetDepth       = new RenderTarget2D(Device, width, height, false, SurfaceFormat.Vector2, DepthFormat.Depth24Stencil8);

                restoreDepthBufferPass = new RestoreDepthBufferPass(this);
                combinePass            = new CombinePass(this);
                combineDepthPass       = new CombineDepthPass(this);
                glowPass       = new GlowPass(this);
                hdrCombinePass = new HdrCombinePass(this);
            }

            statefulParticleResourceManager = new ProjectMagma.Renderer.ParticleSystem.Stateful.ResourceManager(wrappedContent, device);


            updateQueues = new List <RendererUpdateQueue>();

            billboard = new Billboard(this, new Vector3(0, 200, 0), 250, 250, Vector4.One);
        }
Пример #8
0
 protected override Effect LoadRenderEffect(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Effect>("Effects/ParticleSystem/Stateful/Implementations/Smoke"));
 }
Пример #9
0
 protected virtual Texture2D LoadSprite(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Texture2D>("Textures/xna_logo"));
 }
Пример #10
0
 protected virtual Effect LoadRenderEffect(WrappedContentManager wrappedContent)
 {
     return(wrappedContent.Load <Effect>("Effects/ParticleSystem/Stateful/Default"));
 }