예제 #1
0
        public static Texture FromPicture(PictureObjectModel pic, TextureRotation rotation, TextureFlip flip)
        {
            if (texturesByPicture.ContainsKey(pic))
            {
                Texture tex = texturesByPicture[pic];
                tex.Rotation = rotation;
                tex.Flip     = flip;
                return(tex);
            }

            uint[] textureIDs = new uint[1];

            Internal.OpenGL.Methods.glGenTextures(1, textureIDs);
            Internal.OpenGL.Methods.glErrorToException();

            uint textureID = textureIDs[0];

            Texture texture = new Texture(textureID);

            texture.Target       = TextureTarget.Texture2D;
            texture.TextureImage = pic;

            texture.MinFilter    = TextureFilter.Linear;
            texture.MagFilter    = TextureFilter.Linear;
            texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip     = flip;

            if (!texturesByID.ContainsKey(textureID))
            {
                texturesByID.Add(textureID, texture);
            }
            if (!texturesByPicture.ContainsKey(pic))
            {
                texturesByPicture.Add(pic, texture);
            }
            return(texture);
        }
예제 #2
0
        public static Texture FromFile(string FileName, TextureRotation rotation, TextureFlip flip)
        {
            if (texturesByFileName.ContainsKey(FileName))
            {
                Texture tex = texturesByFileName[FileName];
                tex.Rotation = rotation;
                tex.Flip     = flip;
                return(tex);
            }

            uint[] textureIDs = new uint[1];
            Internal.OpenGL.Methods.glGenTextures(1, textureIDs);
            uint textureID = textureIDs[0];

            Texture texture = new Texture(textureID);

            texture.Target = TextureTarget.Texture2D;

            texture.FileName = FileName;

            texture.MinFilter = TextureFilter.Linear;
            texture.MagFilter = TextureFilter.Linear;
            // texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip     = flip;

            if (!texturesByID.ContainsKey(textureID))
            {
                texturesByID.Add(textureID, texture);
            }
            if (!texturesByFileName.ContainsKey(FileName))
            {
                texturesByFileName.Add(FileName, texture);
            }
            return(texture);
        }
예제 #3
0
        public Texture CreateTextureFromFile(string FileName, TextureRotation rotation, TextureFlip flip)
        {
            if (_texturesByFileName.ContainsKey(FileName))
            {
                Texture tex = _texturesByFileName[FileName];
                tex.Rotation = rotation;
                tex.Flip     = flip;
                return(tex);
            }

            uint[] textureIDs = Engine.GenerateTextureIDs(1);
            uint   textureID  = textureIDs[0];

            Texture texture = new Texture(textureID);

            texture.Target = TextureTarget.Texture2D;

            texture.FileName = FileName;

            texture.MinFilter = TextureFilter.Linear;
            texture.MagFilter = TextureFilter.Linear;
            // texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip     = flip;

            if (!_texturesByID.ContainsKey(textureID))
            {
                _texturesByID.Add(textureID, texture);
            }
            if (!_texturesByFileName.ContainsKey(FileName))
            {
                _texturesByFileName.Add(FileName, texture);
            }
            return(texture);
        }
예제 #4
0
        public static Texture FromPicture(PictureObjectModel pic, TextureRotation rotation, TextureFlip flip)
        {
            if (texturesByPicture.ContainsKey(pic))
            {
                Texture tex = texturesByPicture[pic];
                tex.Rotation = rotation;
                tex.Flip     = flip;
                return(tex);
            }

            uint[] textureIDs = Engine.GetDefault().GenerateTextureIDs(1);
            uint   textureID  = textureIDs[0];

            Texture texture = new Texture(textureID);

            texture.Target       = TextureTarget.Texture2D;
            texture.TextureImage = pic;

            texture.MinFilter    = TextureFilter.Linear;
            texture.MagFilter    = TextureFilter.Linear;
            texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip     = flip;

            if (!texturesByID.ContainsKey(textureID))
            {
                texturesByID.Add(textureID, texture);
            }
            if (!texturesByPicture.ContainsKey(pic))
            {
                texturesByPicture.Add(pic, texture);
            }
            return(texture);
        }
예제 #5
0
 public Texture(int number, int probabilityWeight, TextureRotation textureRotation)
 {
     Number            = number;
     ProbabilityWeight = probabilityWeight;
     TextureRotation   = textureRotation;
 }
예제 #6
0
        public static Texture FromPicture(PictureObjectModel pic, TextureRotation rotation, TextureFlip flip)
        {
            if (texturesByPicture.ContainsKey(pic))
            {
                Texture tex = texturesByPicture[pic];
                tex.Rotation = rotation;
                tex.Flip = flip;
                return tex;
            }

            uint[] textureIDs = new uint[1];

            Internal.OpenGL.Methods.glGenTextures(1, textureIDs);
            Internal.OpenGL.Methods.glErrorToException();

            uint textureID = textureIDs[0];

            Texture texture = new Texture(textureID);
            texture.Target = TextureTarget.Texture2D;
            texture.TextureImage = pic;

            texture.MinFilter = TextureFilter.Linear;
            texture.MagFilter = TextureFilter.Linear;
            texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip = flip;

            if (!texturesByID.ContainsKey(textureID))
            {
                texturesByID.Add(textureID, texture);
            }
            if (!texturesByPicture.ContainsKey(pic))
            {
                texturesByPicture.Add(pic, texture);
            }
            return texture;
        }
예제 #7
0
        public static Texture FromFile(string FileName, TextureRotation rotation, TextureFlip flip)
        {
            if (texturesByFileName.ContainsKey(FileName))
            {
                Texture tex = texturesByFileName[FileName];
                tex.Rotation = rotation;
                tex.Flip = flip;
                return tex;
            }

            uint[] textureIDs = new uint[1];
            Internal.OpenGL.Methods.glGenTextures(1, textureIDs);
            uint textureID = textureIDs[0];

            Texture texture = new Texture(textureID);
            texture.Target = TextureTarget.Texture2D;

            texture.FileName = FileName;

            texture.MinFilter = TextureFilter.Linear;
            texture.MagFilter = TextureFilter.Linear;
            // texture.TextureWrapR = TextureWrap.Repeat;
            texture.TextureWrapS = TextureWrap.Repeat;
            texture.TextureWrapT = TextureWrap.Repeat;

            texture.Rotation = rotation;
            texture.Flip = flip;

            if (!texturesByID.ContainsKey(textureID))
            {
                texturesByID.Add(textureID, texture);
            }
            if (!texturesByFileName.ContainsKey(FileName))
            {
                texturesByFileName.Add(FileName, texture);
            }
            return texture;
        }