示例#1
0
        /// <summary>
        /// Returns the index in the texture list and the full index (index in the list + some flags specifying existence of normal/displacement maps)
        /// </summary>
        int AddTexture(Texture2D texAlbedo, Texture2D texEmission, Texture2D texNRM, Texture2D texDISP)
        {
            int index = 0;

            if (texAlbedo == null || worldTexturesDict.TryGetValue(texAlbedo, out index))
            {
                return(index);
            }

            // Add entry to dictionary
            index = worldTextures.Count;
            worldTexturesDict [texAlbedo] = index;

            // Albedo + Emission mask
            WorldTexture wt = new WorldTexture();

            wt.colorsAndEmission = CombineAlbedoAndEmission(texAlbedo, texEmission);
            worldTextures.Add(wt);

            // Normal + Elevation Map
            if (enableNormalMap || enableReliefMapping)
            {
                WorldTexture wextra = new WorldTexture();
                wextra.normalsAndElevation = CombineNormalsAndElevation(texNRM, texDISP);
                worldTextures.Add(wextra);
            }

            return(index);
        }
 public override void Initialize()
 {
     Pixel        = AssetManager.GetTexture("pixel");
     WorldTexture = AssetManager.GetTexture("world");
     Pixels       = new Color[WorldTexture.Width * WorldTexture.Height];
     WorldTexture.GetData(Pixels);
 }
示例#3
0
        public WorldTexture GetWorldTexture(GraphicsDevice device)
        {
            var result = new WorldTexture
            {
                Pixel = this.GetTexture(device)
            };

            result.ZBuffer = this.GetZTexture(device);
            return(result);
        }
示例#4
0
        public WorldTexture GetWorldTexture(GraphicsDevice device)
        {
            var result = new WorldTexture
            {
                Pixel = this.GetTexture(device)
            };

            if (this.ZBufferData != null)
            {
                result.ZBuffer = this.GetZTexture(device);
            }
            return(result);
        }
示例#5
0
文件: SPR2.cs 项目: fourks/FreeSO
        public WorldTexture GetWorldTexture(GraphicsDevice device)
        {
            var result = new WorldTexture
            {
                Pixel = this.GetTexture(device, false)
            };

            result.ZBuffer = this.GetZTexture(device, false);
            if (!IffFile.RETAIN_CHUNK_DATA)
            {
                PixelData   = null;
                ZBufferData = null;
            }
            return(result);
        }
示例#6
0
        public WorldTexture GetWorldTexture(Microsoft.Xna.Framework.Graphics.GraphicsDevice device)
        {
            var iff  = Parent.ChunkParent;
            var spr2 = iff.Get <SPR2>((ushort)this.SpriteID);

            if (spr2 != null)
            {
                return(spr2.Frames[this.SpriteFrameIndex].GetWorldTexture(device));
            }
            var spr1 = iff.Get <SPR>((ushort)this.SpriteID);

            if (spr1 != null)
            {
                var result = new WorldTexture();
                result.Pixel = spr1.Frames[(int)this.SpriteFrameIndex].GetTexture(device);
                return(result);
            }
            return(null);
        }
示例#7
0
        public Point GetDimensions()
        {
            var iff  = Parent.ChunkParent;
            var spr2 = iff.Get <SPR2>((ushort)this.SpriteID);

            if (spr2 != null)
            {
                var frame = spr2.Frames[this.SpriteFrameIndex];
                return(new Point(frame.Width, frame.Height));
            }
            var spr1 = iff.Get <SPR>((ushort)this.SpriteID);

            if (spr1 != null)
            {
                var result = new WorldTexture();
                var frame  = spr1.Frames[(int)this.SpriteFrameIndex];
                return(new Point(frame.Width, frame.Height));
            }
            return(new Point(1, 1));
        }
示例#8
0
 public WorldTexture GetWorldTexture(GraphicsDevice device)
 {
     var result = new WorldTexture
     {
         Pixel = this.GetTexture(device)
     };
     if (this.ZBufferData != null)
     {
         result.ZBuffer = this.GetZTexture(device);
     }
     return result;
 }
示例#9
0
 public WorldTexture GetWorldTexture(Microsoft.Xna.Framework.Graphics.GraphicsDevice device)
 {
     var iff = Parent.ChunkParent;
     var spr2 = iff.Get<SPR2>((ushort)this.SpriteID);
     if (spr2 != null)
     {
         return spr2.Frames[this.SpriteFrameIndex].GetWorldTexture(device);
     }
     var spr1 = iff.Get<SPR>((ushort)this.SpriteID);
     if (spr1 != null)
     {
         var result = new WorldTexture();
         result.Pixel = spr1.Frames[(int)this.SpriteFrameIndex].GetTexture(device);
         return result;
     }
     return null;
 }