Beispiel #1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            SpriteBatch = new SpriteBatch(GraphicsDevice);

            CalculateViewportScale();

            ShapeRenderer.Initialize(GraphicsDevice);
            TextRenderer.Initialize(Content);
        }
Beispiel #2
0
        public override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);

            ShapeRenderer.Initialize(GraphicsDevice);
            TextRenderer.Initialize(Content);

            Editor.Initialize();

            //Editor.OnViewportChange(GraphicsDevice);
        }
Beispiel #3
0
        /// <summary>
        /// Create a SceneRenderer with graphics device and content manager.
        /// </summary>

        public SceneRenderer(GraphicsDevice device, ContentManager content)
        {
            this.graphicsDevice = device;
            this.content        = content;

            spriteBatch = new SpriteBatch(graphicsDevice);

            // Use standard GBuffer as a default
            shaderTechnique = "GBuffer";
            currentEffect   = null;

            blankNormal   = new Texture2D(device, 1, 1);
            blankTexture  = new Texture2D(device, 1, 1);
            blankSpecular = new Texture2D(device, 1, 1);

            // Create the dummy textures
            Color[][] pixels = new Color[3][];
            pixels[0] = new Color[] { Color.White };
            pixels[1] = new Color[] { Color.Transparent };
            pixels[2] = new Color[] { new Color(0.5f, 0.5f, 1.0f, 1.0f) };

            blankTexture.SetData <Color>(pixels[0]);
            blankSpecular.SetData <Color>(pixels[1]);
            blankNormal.SetData <Color>(pixels[2]);

            // Helper for drawing debug shapes
            ShapeRenderer.Initialize(graphicsDevice);

            // Effect for bounding box drawing
            basicEffect = new BasicEffect(device);
            basicEffect.LightingEnabled    = false;
            basicEffect.TextureEnabled     = false;
            basicEffect.VertexColorEnabled = true;

            // Create a resuable DummyBox
            dummyBoxVB = ShapeRenderer.AddDummyBox();

            boxCorners = new Vector3[8];
            tempBones  = new Matrix[60];

            // Create the instance data vertex buffer.
#if XNA
            vertexBufferBindings = new VertexBufferBinding[2];
#elif MONOGAME
            vertexBufferBindings = new VertexBuffer[2];
#endif
        }