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); }
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); }
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); }
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); }
public Texture(int number, int probabilityWeight, TextureRotation textureRotation) { Number = number; ProbabilityWeight = probabilityWeight; TextureRotation = textureRotation; }
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; }
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; }