/// <summary>
        /// Updates composer variables
        /// </summary>
        /// <param name="viewProjection">View * projection matrix</param>
        /// <param name="depthMap">Depth map texture</param>
        /// <param name="lightMap">Light map</param>
        /// <param name="context">Drawing context</param>
        public void UpdateComposer(
            Matrix viewProjection,
            EngineShaderResourceView depthMap,
            EngineShaderResourceView lightMap,
            DrawContext context)
        {
            this.WorldViewProjection = viewProjection;
            this.EyePositionWorld    = context.EyePosition;

            var lights = context.Lights;

            if (lights != null)
            {
                var ambientLight = lights.GetVisibleHemisphericLight();
                if (ambientLight != null)
                {
                    this.HemisphericLight = new BufferLightHemispheric(ambientLight);
                }
                else
                {
                    this.HemisphericLight = BufferLightHemispheric.Default;
                }

                this.FogStart = lights.FogStart;
                this.FogRange = lights.FogRange;
                this.FogColor = lights.FogColor;
            }

            this.TG3Map   = depthMap;
            this.LightMap = lightMap;
        }
示例#2
0
        /// <summary>
        /// Resource disposal
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                for (int i = 0; i < this.foliageBuffers.Count; i++)
                {
                    this.foliageBuffers[i]?.Dispose();
                    this.foliageBuffers[i] = null;
                }
                this.foliageBuffers.Clear();

                foreach (var item in this.foliagePatches.Values)
                {
                    foreach (var value in item)
                    {
                        value?.Dispose();
                    }
                }
                this.foliagePatches.Clear();

                this.foliageMap?.Dispose();
                this.foliageMap = null;

                for (int i = 0; i < this.foliageMapChannels.Count; i++)
                {
                    this.foliageMapChannels[i]?.Dispose();
                    this.foliageMapChannels[i] = null;
                }
                this.foliageMapChannels.Clear();

                this.textureRandom?.Dispose();
                this.textureRandom = null;
            }
        }
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="viewProjection">View * projection matrix</param>
        /// <param name="eyePositionWorld">Eye position in world coordinates</param>
        /// <param name="state">Particle state</param>
        /// <param name="textureCount">Texture count</param>
        /// <param name="textures">Texture</param>
        public void UpdatePerFrame(
            Matrix viewProjection,
            Vector3 eyePositionWorld,
            EffectParticleState state,
            uint textureCount,
            EngineShaderResourceView textures)
        {
            this.World = Matrix.Identity;
            this.WorldViewProjection = viewProjection;
            this.EyePositionWorld    = eyePositionWorld;
            this.TotalTime           = state.TotalTime;
            this.ElapsedTime         = state.ElapsedTime;

            this.EmissionRate        = state.EmissionRate;
            this.VelocitySensitivity = state.VelocitySensitivity;
            this.HorizontalVelocity  = state.HorizontalVelocity;
            this.VerticalVelocity    = state.VerticalVelocity;
            this.RandomValues        = state.RandomValues;

            this.MaxDuration           = state.MaxDuration;
            this.MaxDurationRandomness = state.MaxDurationRandomness;
            this.EndVelocity           = state.EndVelocity;
            this.Gravity      = state.Gravity;
            this.StartSize    = state.StartSize;
            this.EndSize      = state.EndSize;
            this.MinColor     = state.MinColor;
            this.MaxColor     = state.MaxColor;
            this.RotateSpeed  = state.RotateSpeed;
            this.TextureCount = textureCount;
            this.TextureArray = textures;
        }
示例#4
0
        /// <summary>
        /// Update scene globals
        /// </summary>
        /// <param name="materialPalette">Material palette</param>
        /// <param name="materialPaletteWidth">Material palette width</param>
        public static void UpdateSceneGlobals(
            EngineShaderResourceView materialPalette, uint materialPaletteWidth,
            EngineShaderResourceView animationPalette, uint animationPaletteWidth)
        {
            EffectDefaultBillboard.UpdateGlobals(
                materialPalette, materialPaletteWidth,
                GameEnvironment.LODDistanceHigh, GameEnvironment.LODDistanceMedium, GameEnvironment.LODDistanceLow);

            EffectDefaultFoliage.UpdateGlobals(
                materialPalette, materialPaletteWidth,
                GameEnvironment.LODDistanceHigh, GameEnvironment.LODDistanceMedium, GameEnvironment.LODDistanceLow);

            EffectDefaultBasic.UpdateGlobals(
                materialPalette, materialPaletteWidth,
                animationPalette, animationPaletteWidth,
                GameEnvironment.LODDistanceHigh, GameEnvironment.LODDistanceMedium, GameEnvironment.LODDistanceLow);
            EffectDefaultTerrain.UpdateGlobals(
                materialPalette, materialPaletteWidth,
                GameEnvironment.LODDistanceHigh, GameEnvironment.LODDistanceMedium, GameEnvironment.LODDistanceLow);

            EffectDeferredBasic.UpdateGlobals(animationPalette, animationPaletteWidth);
            EffectDeferredComposer.UpdateGlobals(
                materialPalette, materialPaletteWidth,
                GameEnvironment.LODDistanceHigh, GameEnvironment.LODDistanceMedium, GameEnvironment.LODDistanceLow);

            EffectShadowCascade.UpdateGlobals(animationPalette, animationPaletteWidth);

            EffectShadowBasic.UpdateGlobals(animationPalette, animationPaletteWidth);

            EffectShadowPoint.UpdateGlobals(animationPalette, animationPaletteWidth);
        }
示例#5
0
 /// <summary>
 /// Update effect globals
 /// </summary>
 /// <param name="animationPalette">Animation palette texture</param>
 /// <param name="animationPaletteWith">Animation palette texture width</param>
 public void UpdateGlobals(
     EngineShaderResourceView animationPalette,
     uint animationPaletteWidth)
 {
     this.AnimationPalette      = animationPalette;
     this.AnimationPaletteWidth = animationPaletteWidth;
 }
示例#6
0
 /// <summary>
 /// Update per model object data
 /// </summary>
 /// <param name="color">Color</param>
 /// <param name="texture">Texture</param>
 /// <param name="textureIndex">Texture index</param>
 public void UpdatePerObject(
     Color4 color,
     EngineShaderResourceView texture,
     int textureIndex)
 {
     this.Color        = color;
     this.Textures     = texture;
     this.TextureIndex = textureIndex;
 }
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="world">World</param>
        /// <param name="viewProjection">View * projection</param>
        /// <param name="eyePositionWorld">Eye position in world coordinates</param>
        /// <param name="randomTexture">Random texture</param>
        public void UpdatePerFrame(
            Matrix world,
            Matrix viewProjection,
            Vector3 eyePositionWorld,
            EngineShaderResourceView randomTexture)
        {
            this.WorldViewProjection = world * viewProjection;
            this.EyePositionWorld    = eyePositionWorld;

            this.TextureRandom = randomTexture;
        }
示例#8
0
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="context">Drawing context</param>
        /// <param name="state">State</param>
        public void UpdatePerFrame(
            DrawContext context,
            EffectBillboardState state)
        {
            this.World = Matrix.Identity;
            this.WorldViewProjection = context.ViewProjection;
            this.EyePositionWorld    = context.EyePosition;

            this.StartRadius    = state.StartRadius;
            this.EndRadius      = state.EndRadius;
            this.TextureCount   = state.TextureCount;
            this.NormalMapCount = state.NormalMapCount;
            this.Textures       = state.Texture;
            this.NormalMaps     = state.NormalMaps;

            this.MaterialIndex = state.MaterialIndex;

            var lights = context.Lights;

            if (lights != null)
            {
                this.HemiLight   = BufferLightHemispheric.Build(lights.GetVisibleHemisphericLight());
                this.DirLights   = BufferLightDirectional.Build(lights.GetVisibleDirectionalLights(), out int dirLength);
                this.PointLights = BufferLightPoint.Build(lights.GetVisiblePointLights(), out int pointLength);
                this.SpotLights  = BufferLightSpot.Build(lights.GetVisibleSpotLights(), out int spotLength);
                this.LightCount  = new[] { dirLength, pointLength, spotLength };

                this.FogStart = lights.FogStart;
                this.FogRange = lights.FogRange;
                this.FogColor = lights.FogColor;

                this.ShadowMapDirectional = context.ShadowMapDirectional?.Texture;
                this.ShadowMapPoint       = context.ShadowMapPoint?.Texture;
                this.ShadowMapSpot        = context.ShadowMapSpot?.Texture;
            }
            else
            {
                this.HemiLight   = BufferLightHemispheric.Default;
                this.DirLights   = BufferLightDirectional.Default;
                this.PointLights = BufferLightPoint.Default;
                this.SpotLights  = BufferLightSpot.Default;
                this.LightCount  = new[] { 0, 0, 0 };

                this.FogStart = 0;
                this.FogRange = 0;
                this.FogColor = Color.Transparent;

                this.ShadowMapDirectional = null;
                this.ShadowMapPoint       = null;
                this.ShadowMapSpot        = null;
            }

            this.TextureRandom = state.RandomTexture;
        }
 /// <summary>
 /// Update per model object data
 /// </summary>
 /// <param name="startRadius">Drawing start radius</param>
 /// <param name="endRadius">Drawing end radius</param>
 /// <param name="textureCount">Texture count</param>
 /// <param name="texture">Texture</param>
 public void UpdatePerObject(
     float startRadius,
     float endRadius,
     uint textureCount,
     EngineShaderResourceView texture)
 {
     this.StartRadius  = startRadius;
     this.EndRadius    = endRadius;
     this.TextureCount = textureCount;
     this.Textures     = texture;
 }
示例#10
0
 /// <summary>
 /// Update per frame data
 /// </summary>
 /// <param name="world">World matrix</param>
 /// <param name="viewProjection">View * projection matrix</param>
 /// <param name="color">Color</param>
 /// <param name="texture">Font texture</param>
 public void UpdatePerFrame(
     Matrix world,
     Matrix viewProjection,
     Color4 color,
     EngineShaderResourceView texture)
 {
     this.World = world;
     this.WorldViewProjection = world * viewProjection;
     this.Color   = color;
     this.Texture = texture;
 }
        /// <summary>
        /// Update effect globals
        /// </summary>
        /// <param name="materialPalette">Material palette texture</param>
        /// <param name="materialPaletteWidth">Material palette texture width</param>
        /// <param name="lod1">High level of detail maximum distance</param>
        /// <param name="lod2">Medium level of detail maximum distance</param>
        /// <param name="lod3">Low level of detail maximum distance</param>
        public void UpdateGlobals(
            EngineShaderResourceView materialPalette,
            uint materialPaletteWidth,
            float lod1,
            float lod2,
            float lod3)
        {
            this.MaterialPalette      = materialPalette;
            this.MaterialPaletteWidth = materialPaletteWidth;

            this.LOD = new Vector3(lod1, lod2, lod3);
        }
示例#12
0
 /// <summary>
 /// Update per frame data
 /// </summary>
 /// <param name="world">World matrix</param>
 /// <param name="viewProjection">View * projection matrix</param>
 /// <param name="direction">Blur direction</param>
 /// <param name="size">Texture size</param>
 /// <param name="diffuseMap">DiffuseMap</param>
 public void UpdatePerFrame(
     Matrix world,
     Matrix viewProjection,
     Vector2 direction,
     Vector2 size,
     EngineShaderResourceView diffuseMap)
 {
     this.WorldViewProjection = world * viewProjection;
     this.BlurDirection       = direction;
     this.TextureSize         = size;
     this.DiffuseMap          = diffuseMap;
 }
        /// <summary>
        /// Updates per spot light variables
        /// </summary>
        /// <param name="light">Light</param>
        /// <param name="transform">Translation and rotation matrix</param>
        /// <param name="viewProjection">View * projection matrix</param>
        /// <param name="shadowMap">Shadow map</param>
        public void UpdatePerLight(
            SceneLightSpot light,
            Matrix transform,
            Matrix viewProjection,
            IShadowMap shadowMap)
        {
            this.SpotLight = new BufferLightSpot(light);

            this.World = transform;
            this.WorldViewProjection = transform * viewProjection;

            this.ShadowMapSpot = shadowMap?.Texture;
        }
示例#14
0
        /// <summary>
        /// Creates a map channel from the specified description
        /// </summary>
        /// <param name="channel">Channel description</param>
        /// <param name="index">Channel index</param>
        /// <param name="contentPath">Resources content path</param>
        /// <returns>Returns the new map channel</returns>
        private FoliageMapChannel CreateChannel(GroundGardenerDescription.Channel channel, int index, string contentPath)
        {
            EngineShaderResourceView foliageTextures   = null;
            EngineShaderResourceView foliageNormalMaps = null;
            int textureCount   = channel.VegetationTextures != null ? channel.VegetationTextures.Length : 0;
            int normalMapCount = channel.VegetationNormalMaps != null ? channel.VegetationNormalMaps.Length : 0;

            if (normalMapCount != 0 && normalMapCount != textureCount)
            {
                throw new EngineException("Normal map arrays must have the same slices than diffuse texture arrays");
            }

            if (textureCount > 0)
            {
                var image = new ImageContent()
                {
                    Streams = ContentManager.FindContent(contentPath, channel.VegetationTextures),
                };

                foliageTextures = this.Game.ResourceManager.CreateResource(image);
            }

            if (normalMapCount > 0)
            {
                var image = new ImageContent()
                {
                    Streams = ContentManager.FindContent(contentPath, channel.VegetationNormalMaps),
                };

                foliageNormalMaps = this.Game.ResourceManager.CreateResource(image);
            }

            return(new FoliageMapChannel()
            {
                Index = index,
                Seed = channel.Seed,
                Saturation = channel.Saturation,
                MinSize = channel.MinSize,
                MaxSize = channel.MaxSize,
                Delta = channel.Delta,
                StartRadius = channel.StartRadius,
                EndRadius = channel.EndRadius,
                TextureCount = (uint)textureCount,
                NormalMapCount = (uint)normalMapCount,
                Textures = foliageTextures,
                NormalMaps = foliageNormalMaps,
                WindEffect = channel.WindEffect,
                Count = channel.Count,
            });
        }
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="world">World</param>
        /// <param name="viewProjection">View * projection</param>
        /// <param name="eyePositionWorld">Eye position in world coordinates</param>
        /// <param name="lights">Scene ligths</param>
        /// <param name="shadowMapDirectional">Low definition shadow map</param>
        /// <param name="shadowMapPoint">Point light shadow map</param>
        /// <param name="shadowMapSpot">Spot light shadow map</param>
        private void UpdatePerFrame(
            Matrix world,
            Matrix viewProjection,
            Vector3 eyePositionWorld,
            SceneLights lights,
            IShadowMap shadowMapDirectional,
            IShadowMap shadowMapPoint,
            IShadowMap shadowMapSpot)
        {
            this.World = world;
            this.WorldViewProjection = world * viewProjection;

            if (lights != null)
            {
                this.EyePositionWorld = eyePositionWorld;

                this.HemiLight   = BufferLightHemispheric.Build(lights.GetVisibleHemisphericLight());
                this.DirLights   = BufferLightDirectional.Build(lights.GetVisibleDirectionalLights(), out int dirLength);
                this.PointLights = BufferLightPoint.Build(lights.GetVisiblePointLights(), out int pointLength);
                this.SpotLights  = BufferLightSpot.Build(lights.GetVisibleSpotLights(), out int spotLength);
                this.LightCount  = new[] { dirLength, pointLength, spotLength };

                this.FogStart = lights.FogStart;
                this.FogRange = lights.FogRange;
                this.FogColor = lights.FogColor;

                this.ShadowMapDirectional = shadowMapDirectional?.Texture;
                this.ShadowMapPoint       = shadowMapPoint?.Texture;
                this.ShadowMapSpot        = shadowMapSpot?.Texture;
            }
            else
            {
                this.EyePositionWorld = Vector3.Zero;

                this.HemiLight   = BufferLightHemispheric.Default;
                this.DirLights   = BufferLightDirectional.Default;
                this.PointLights = BufferLightPoint.Default;
                this.SpotLights  = BufferLightSpot.Default;
                this.LightCount  = new[] { 0, 0, 0 };

                this.FogStart = 0;
                this.FogRange = 0;
                this.FogColor = Color.Transparent;

                this.ShadowMapDirectional = null;
                this.ShadowMapPoint       = null;
                this.ShadowMapSpot        = null;
            }
        }
        /// <summary>
        /// Updates per frame variables
        /// </summary>
        /// <param name="viewProjection">View * projection matrix</param>
        /// <param name="eyePositionWorld">Eye position in world coordinates</param>
        /// <param name="colorMap">Color map texture</param>
        /// <param name="normalMap">Normal map texture</param>
        /// <param name="depthMap">Depth map texture</param>
        public void UpdatePerFrame(
            Matrix viewProjection,
            Vector3 eyePositionWorld,
            EngineShaderResourceView colorMap,
            EngineShaderResourceView normalMap,
            EngineShaderResourceView depthMap)
        {
            this.World = Matrix.Identity;
            this.WorldViewProjection = viewProjection;
            this.EyePositionWorld    = eyePositionWorld;

            this.TG1Map = colorMap;
            this.TG2Map = normalMap;
            this.TG3Map = depthMap;
        }
示例#17
0
 /// <summary>
 /// Resource disposal
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (Textures != null)
         {
             Textures.Dispose();
             Textures = null;
         }
         if (NormalMaps != null)
         {
             NormalMaps.Dispose();
             NormalMaps = null;
         }
     }
 }
示例#18
0
 /// <summary>
 /// Set global resource by name
 /// </summary>
 /// <param name="name">Resource name</param>
 /// <param name="resource">Resource content</param>
 public void SetGlobalResource(string name, EngineShaderResourceView resource)
 {
     if (this.globalResources.ContainsKey(name))
     {
         var cRes = this.globalResources[name];
         if (cRes != null)
         {
             cRes.Dispose();
         }
         this.globalResources[name] = resource;
     }
     else
     {
         this.globalResources.Add(name, resource);
     }
 }
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="textureResolution">Texture resolution</param>
        /// <param name="context">Drawing context</param>
        public void UpdatePerFrame(
            float textureResolution,
            DrawContext context)
        {
            this.World = Matrix.Identity;
            this.WorldViewProjection = context.ViewProjection;
            this.TextureResolution   = textureResolution;

            var lights = context.Lights;

            if (lights != null)
            {
                this.EyePositionWorld = context.EyePosition;

                this.HemiLight   = BufferLightHemispheric.Build(lights.GetVisibleHemisphericLight());
                this.DirLights   = BufferLightDirectional.Build(lights.GetVisibleDirectionalLights(), out int dirLength);
                this.PointLights = BufferLightPoint.Build(lights.GetVisiblePointLights(), out int pointLength);
                this.SpotLights  = BufferLightSpot.Build(lights.GetVisibleSpotLights(), out int spotLength);
                this.LightCount  = new[] { dirLength, pointLength, spotLength };

                this.FogStart = lights.FogStart;
                this.FogRange = lights.FogRange;
                this.FogColor = lights.FogColor;

                this.ShadowMapDirectional = context.ShadowMapDirectional?.Texture;
                this.ShadowMapPoint       = context.ShadowMapPoint?.Texture;
                this.ShadowMapSpot        = context.ShadowMapSpot?.Texture;
            }
            else
            {
                this.EyePositionWorld = Vector3.Zero;

                this.HemiLight   = BufferLightHemispheric.Default;
                this.DirLights   = BufferLightDirectional.Default;
                this.PointLights = BufferLightPoint.Default;
                this.SpotLights  = BufferLightSpot.Default;
                this.LightCount  = new[] { 0, 0, 0 };

                this.FogStart = 0;
                this.FogRange = 0;
                this.FogColor = Color.Transparent;

                this.ShadowMapDirectional = null;
                this.ShadowMapPoint       = null;
                this.ShadowMapSpot        = null;
            }
        }
示例#20
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="game">Game</param>
        /// <param name="bufferManager">Buffer manager</param>
        /// <param name="description">Description</param>
        public GroundGardener(Scene scene, GroundGardenerDescription description) :
            base(scene, description)
        {
            if (description == null)
            {
                throw new EngineException("A gardener description should be specified.");
            }

            this.textureRandom = this.Game.ResourceManager.CreateResource(Guid.NewGuid(), 1024, -1, 1, 24);

            this.foliageSphere = new BoundingSphere(Vector3.Zero, description.VisibleRadius);

            //Material
            this.material = new MeshMaterial()
            {
                Material = description.Material != null?description.Material.GetMaterial() : Material.Default
            };

            //Read foliage textures
            string contentPath = description.ContentPath;

            if (!string.IsNullOrEmpty(description.VegetationMap))
            {
                var foliageMapImage = new ImageContent()
                {
                    Streams = ContentManager.FindContent(contentPath, description.VegetationMap),
                };
                this.foliageMap = FoliageMap.FromStream(foliageMapImage.Stream);
            }

            for (int i = 0; i < description.Channels.Length; i++)
            {
                var channelDesc = description.Channels[i];
                if (channelDesc?.Enabled == true)
                {
                    var newChannel = CreateChannel(channelDesc, i, contentPath);

                    this.foliageMapChannels.Add(newChannel);
                }
            }

            for (int i = 0; i < MaxFoliageBuffers; i++)
            {
                this.foliageBuffers.Add(new FoliageBuffer(this.Game, this.BufferManager, description.Name));
            }
        }
示例#21
0
        /// <summary>
        /// Update per frame
        /// </summary>
        /// <param name="world">World</param>
        /// <param name="viewProjection">View * projection</param>
        /// <param name="brightness">Brightness</param>
        /// <param name="color">Cloud color</param>
        /// <param name="fadingDistance">FadingDistance</param>
        /// <param name="firstTexture">First texture</param>
        /// <param name="secondTexture">Second texture</param>
        public void UpdatePerFrame(
            Matrix world,
            Matrix viewProjection,
            float brightness,
            Color4 color,
            float fadingDistance,
            EngineShaderResourceView firstTexture,
            EngineShaderResourceView secondTexture)
        {
            this.WorldViewProjection = world * viewProjection;

            this.Brightness     = brightness;
            this.Color          = color.RGB();
            this.FadingDistance = fadingDistance;

            this.FirstTexture  = firstTexture;
            this.SecondTexture = secondTexture;
        }
        /// <summary>
        /// Update per frame data
        /// </summary>
        /// <param name="viewProjection">View * projection</param>
        /// <param name="eyePositionWorld">Eye position in world coordinates</param>
        /// <param name="windDirection">Wind direction</param>
        /// <param name="windStrength">Wind strength</param>
        /// <param name="totalTime">Total time</param>
        /// <param name="delta">Delta</param>
        /// <param name="randomTexture">Random texture</param>
        public void UpdatePerFrame(
            Matrix viewProjection,
            Vector3 eyePositionWorld,
            Vector3 windDirection,
            float windStrength,
            float totalTime,
            Vector3 delta,
            EngineShaderResourceView randomTexture)
        {
            this.WorldViewProjection = viewProjection;
            this.EyePositionWorld    = eyePositionWorld;

            this.WindDirection = windDirection;
            this.WindStrength  = windStrength;
            this.TotalTime     = totalTime;
            this.Delta         = delta;
            this.TextureRandom = randomTexture;
        }
示例#23
0
        /// <summary>
        /// Dispose objects
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.renderTarget != null)
                {
                    this.renderTarget.Dispose();
                    this.renderTarget = null;
                }

                if (this.renderTexture != null)
                {
                    this.renderTexture.Dispose();
                    this.renderTexture = null;
                }

                if (this.minimapBox != null)
                {
                    this.minimapBox.Dispose();
                    this.minimapBox = null;
                }
            }
        }
示例#24
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="scene">Scene</param>
        /// <param name="description">Sky plane description class</param>
        public SkyPlane(Scene scene, SkyPlaneDescription description)
            : base(scene, description)
        {
            var img1 = new ImageContent()
            {
                Streams = ContentManager.FindContent(description.ContentPath, description.Texture1Name),
            };

            this.skyTexture1 = this.Game.ResourceManager.CreateResource(img1);

            var img2 = new ImageContent()
            {
                Streams = ContentManager.FindContent(description.ContentPath, description.Texture2Name),
            };

            this.skyTexture2 = this.Game.ResourceManager.CreateResource(img2);

            this.skyMode  = description.SkyMode;
            this.rotation = Matrix.Identity;

            this.MaxBrightness     = description.MaxBrightness;
            this.MinBrightness     = description.MinBrightness;
            this.FadingDistance    = description.FadingDistance;
            this.Velocity          = description.Velocity;
            this.PerturbationScale = description.PerturbationScale;
            this.Direction         = description.Direction;
            this.CloudsBaseColor   = description.CloudBaseColor;

            //Create sky plane
            GeometryUtil.CreateCurvePlane(
                description.Size,
                description.Repeat,
                description.PlaneWidth,
                description.PlaneTop,
                description.PlaneBottom,
                out Vector3[] vData, out Vector2[] uvs, out uint[] iData);
示例#25
0
        /// <summary>
        /// Initialize textures
        /// </summary>
        /// <param name="contentPath">Content path</param>
        /// <param name="textures">Texture names</param>
        private void InitializeTexture(string contentPath, string[] textures)
        {
            var image = ImageContent.Array(contentPath, textures);

            this.spriteTexture = this.Game.ResourceManager.CreateResource(image);
        }
示例#26
0
 /// <summary>
 /// Update effect globals
 /// </summary>
 /// <param name="animationPalette">Animation palette texture</param>
 /// <param name="animationPaletteWith">Animation palette texture width</param>
 public abstract void UpdateGlobals(
     EngineShaderResourceView animationPalette,
     uint animationPaletteWidth);
示例#27
0
 /// <summary>
 /// Update per model object data
 /// </summary>
 /// <param name="texture">Texture</param>
 public void UpdatePerObject(
     EngineShaderResourceView cubeTexture)
 {
     this.CubeTexture = cubeTexture;
 }
示例#28
0
 /// <summary>
 /// Set the instance texture
 /// </summary>
 /// <param name="texture">Texture</param>
 public void SetTexture(EngineShaderResourceView texture)
 {
     this.cubeMapTexture = texture;
 }
示例#29
0
        /// <summary>
        /// Initialize textures
        /// </summary>
        /// <param name="contentPath">Content path</param>
        /// <param name="textures">Texture names</param>
        protected void InitializeTexture(string contentPath, params string[] textures)
        {
            var image = ImageContent.Cubic(contentPath, textures[0]);

            this.cubeMapTexture = this.Game.ResourceManager.CreateResource(image);
        }