Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public override void Initialize()
        {
            lightingCB      = new ConstantBuffer(Game.GraphicsDevice, typeof(LightingParams));
            omniLightBuffer = new StructuredBuffer(Game.GraphicsDevice, typeof(OMNILIGHT), RenderSystem.MaxOmniLights, StructuredBufferFlags.None);
            spotLightBuffer = new StructuredBuffer(Game.GraphicsDevice, typeof(SPOTLIGHT), RenderSystem.MaxSpotLights, StructuredBufferFlags.None);
            envLightBuffer  = new StructuredBuffer(Game.GraphicsDevice, typeof(ENVLIGHT), RenderSystem.MaxEnvLights, StructuredBufferFlags.None);
            decalBuffer     = new StructuredBuffer(Game.GraphicsDevice, typeof(DECAL), RenderSystem.MaxDecals, StructuredBufferFlags.None);

            using (var ms = new MemoryStream(Properties.Resources.envLut)) {
                envLut = UserTexture.CreateFromTga(rs, ms, false);
            }

            CreateShadowMaps();

            LoadContent();
            Game.Reloading += (s, e) => LoadContent();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="rs"></param>
        /// <param name="capacity">Number of sprites</param>
        public SpriteLayer(RenderSystem rs, int capacity)
        {
            this.rs = rs;

            Order = 0;

            Visible    = true;
            Transform  = Matrix.Identity;
            Color      = Color.White;
            BlendMode  = SpriteBlendMode.AlphaBlend;
            FilterMode = SpriteFilterMode.LinearClamp;
            StereoMode = SpriteStereoMode.All;

            defaultTexture = new DynamicTexture(rs, 16, 16, typeof(Color), false, false);
            defaultTexture.SetData(Enumerable.Range(0, 16 * 16).Select(i => Color.White).ToArray());

            using (var ms = new MemoryStream(Properties.Resources.conchars)) {
                fontTexture = UserTexture.CreateFromTga(rs, ms, false);
            }

            ReallocGpuBuffers(capacity);

            framesBuffer = new ConstantBuffer(rs.Device, typeof(SpriteFrame), MaxSpriteFrames);
        }