Unify Texture data writing

This commit is contained in:
Flamefire committed 2014-09-20 15:30:48 +02:00
1 parent 4d197bda9a
commit 632b90a0e3
3 files changed
+102 -130

No files matched your search

+8 -42
View File
@@ -237,8 +237,6 @@ namespace Vocaluxe.Lib.Draw
// ReSharper restore RedundantOverridenMember // ReSharper restore RedundantOverridenMember
#endregion resize #endregion resize
#region implementation
#region main stuff #region main stuff
/// <summary> /// <summary>
/// Inits the Device /// Inits the Device
@@ -577,25 +575,18 @@ namespace Vocaluxe.Lib.Draw
#endregion Basic Draw Methods #endregion Basic Draw Methods
#region Textures #region Textures
private CD3DTexture _CreateTexture(Size dataSize) protected override CD3DTexture _CreateTexture(Size dataSize)
{
return new CD3DTexture(_Device, dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height));
}
protected override CD3DTexture _CreateTexture(Size dataSize, byte[] data)
{ {
//Create a new texture in the managed pool, which does not need to be recreated on a lost device //Create a new texture in the managed pool, which does not need to be recreated on a lost device
//because a copy of the texture is hold in the Ram //because a copy of the texture is hold in the Ram
CD3DTexture t = _CreateTexture(dataSize); return new CD3DTexture(_Device, dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height));
_WriteDataToTexture(t.D3DTexture, dataSize.Width, data);
return t;
} }
private static void _WriteDataToTexture(Texture t, int w, byte[] data) protected override void _WriteDataToTexture(CD3DTexture texture, byte[] data)
{ {
//Lock the texture and fill it with the data //Lock the texture and fill it with the data
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard); DataRectangle rect = texture.D3DTexture.LockRectangle(0, LockFlags.Discard);
int rowWidth = 4 * w; int rowWidth = 4 * texture.DataSize.Width;
if (rowWidth == rect.Pitch) if (rowWidth == rect.Pitch)
rect.Data.Write(data, 0, data.Length); rect.Data.Write(data, 0, data.Length);
else else
@@ -607,7 +598,7 @@ namespace Vocaluxe.Lib.Draw
rect.Data.Position = rect.Data.Position - rowWidth + rect.Pitch; rect.Data.Position = rect.Data.Position - rowWidth + rect.Pitch;
} }
} }
t.UnlockRectangle(0); texture.D3DTexture.UnlockRectangle(0);
} }
/// <summary> /// <summary>
@@ -631,34 +622,11 @@ namespace Vocaluxe.Lib.Draw
return false; // Texture memory to big return false; // Texture memory to big
texture.DataSize = new Size(w, h); texture.DataSize = new Size(w, h);
} }
_WriteDataToTexture(texture.D3DTexture, w, data); _WriteDataToTexture(texture, data);
return true; return true;
} }
#region drawing #region drawing
/// <summary>
/// Draws a texture
/// </summary>
/// <param name="texture">The texture to be drawn</param>
public void DrawTexture(CTextureRef texture)
{
if (texture == null)
return;
DrawTexture(texture, texture.Rect, texture.Color);
}
/// <summary>
/// Draws a texture
/// </summary>
/// <param name="texture">The texture to be drawn</param>
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
public void DrawTexture(CTextureRef texture, SRectF rect)
{
if (texture == null)
return;
DrawTexture(texture, rect, texture.Color);
}
/// <summary> /// <summary>
/// Draws a texture /// Draws a texture
/// </summary> /// </summary>
@@ -666,7 +634,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="rect">A SRectF struct containing the destination coordinates</param> /// <param name="rect">A SRectF struct containing the destination coordinates</param>
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param> /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="mirrored">True if the texture should be mirrored</param> /// <param name="mirrored">True if the texture should be mirrored</param>
public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false) public override void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false)
{ {
if (rect.W < 1 || rect.H < 1) if (rect.W < 1 || rect.H < 1)
return; return;
@@ -908,8 +876,6 @@ namespace Vocaluxe.Lib.Draw
#endregion Textures #endregion Textures
#endregion implementation
private static Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) private static Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2)
{ {
Matrix originTranslation = Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); Matrix originTranslation = Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0));
+78 -33
View File
@@ -15,11 +15,12 @@ namespace Vocaluxe.Lib.Draw
{ {
abstract class CDrawBase<TTextureType> where TTextureType : CTextureBase, IDisposable abstract class CDrawBase<TTextureType> where TTextureType : CTextureBase, IDisposable
{ {
struct STextureQueue private struct STextureQueue
{ {
public readonly int TextureID; public readonly int TextureID;
public readonly Size DataSize; public readonly Size DataSize;
public readonly byte[] Data; public readonly byte[] Data;
public STextureQueue(int textureID, Size dataSize, byte[] data) public STextureQueue(int textureID, Size dataSize, byte[] data)
{ {
TextureID = textureID; TextureID = textureID;
@@ -28,7 +29,7 @@ namespace Vocaluxe.Lib.Draw
} }
} }
struct STextureCacheEntry private struct STextureCacheEntry
{ {
public TTextureType Texture; public TTextureType Texture;
/// <summary> /// <summary>
@@ -85,9 +86,8 @@ namespace Vocaluxe.Lib.Draw
//Dispose all textures //Dispose all textures
foreach (TTextureType texture in _Textures.Values) foreach (TTextureType texture in _Textures.Values)
{ {
if (texture != null && --texture.RefCount<=0) if (texture != null && --texture.RefCount <= 0)
texture.Dispose(); texture.Dispose();
} }
_Textures.Clear(); _Textures.Clear();
_TextureCache.Clear(); _TextureCache.Clear();
@@ -151,13 +151,34 @@ namespace Vocaluxe.Lib.Draw
} }
#region Textures #region Textures
protected abstract void _WriteDataToTexture(TTextureType texture, byte[] data);
protected virtual void _WriteDataToTexture(TTextureType texture, IntPtr data)
{
byte[] dataArray = new byte[4 * texture.DataSize.Width * texture.DataSize.Height];
Marshal.Copy(data, dataArray, 0, dataArray.Length);
_WriteDataToTexture(texture, dataArray);
}
/// <summary>
/// Factory method to create a texture of the actual type
/// </summary>
/// <param name="dataSize"></param>
/// <returns></returns>
protected abstract TTextureType _CreateTexture(Size dataSize);
/// <summary> /// <summary>
/// Creates the texture specified by the reference and fills it with the given data /// Creates the texture specified by the reference and fills it with the given data
/// </summary> /// </summary>
/// <param name="dataSize"></param> /// <param name="dataSize"></param>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
protected abstract TTextureType _CreateTexture(Size dataSize, byte[] data); protected TTextureType _CreateTexture(Size dataSize, byte[] data)
{
TTextureType texture = _CreateTexture(dataSize);
_WriteDataToTexture(texture, data);
return texture;
}
/// <summary> /// <summary>
/// Creates the texture specified by the reference and fills it with the given data<br /> /// Creates the texture specified by the reference and fills it with the given data<br />
@@ -166,11 +187,11 @@ namespace Vocaluxe.Lib.Draw
/// <param name="dataSize"></param> /// <param name="dataSize"></param>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
protected virtual TTextureType _CreateTexture(Size dataSize, IntPtr data) protected TTextureType _CreateTexture(Size dataSize, IntPtr data)
{ {
byte[] dataArray = new byte[4 * dataSize.Width * dataSize.Height]; TTextureType texture = _CreateTexture(dataSize);
Marshal.Copy(data, dataArray, 0, dataArray.Length); _WriteDataToTexture(texture, data);
return _CreateTexture(dataSize, dataArray); return texture;
} }
private void _AddToCache(TTextureType texture, Size origSize, string texturePath) private void _AddToCache(TTextureType texture, Size origSize, string texturePath)
@@ -178,7 +199,7 @@ namespace Vocaluxe.Lib.Draw
if (texture != null && !String.IsNullOrEmpty(texturePath)) if (texture != null && !String.IsNullOrEmpty(texturePath))
{ {
texture.TexturePath = texturePath; texture.TexturePath = texturePath;
STextureCacheEntry cacheEntry=new STextureCacheEntry {OrigSize = origSize, Texture = texture}; STextureCacheEntry cacheEntry = new STextureCacheEntry {OrigSize = origSize, Texture = texture};
lock (_Textures) lock (_Textures)
{ {
_TextureCache[texturePath] = cacheEntry; _TextureCache[texturePath] = cacheEntry;
@@ -196,9 +217,7 @@ namespace Vocaluxe.Lib.Draw
if (cacheEntry.Texture.RefCount <= 0) if (cacheEntry.Texture.RefCount <= 0)
_TextureCache.Remove(texturePath); _TextureCache.Remove(texturePath);
else else
{
return _GetTextureReference(cacheEntry.OrigSize, cacheEntry.Texture); return _GetTextureReference(cacheEntry.OrigSize, cacheEntry.Texture);
}
} }
} }
return null; return null;
@@ -280,7 +299,7 @@ namespace Vocaluxe.Lib.Draw
break; break;
} }
Size origSize=new Size(bmp.Width, bmp.Height); Size origSize = new Size(bmp.Width, bmp.Height);
Bitmap bmp2 = null; Bitmap bmp2 = null;
TTextureType texture; TTextureType texture;
@@ -307,7 +326,7 @@ namespace Vocaluxe.Lib.Draw
//Fill the new Bitmap with the texture data //Fill the new Bitmap with the texture data
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
texture=_CreateTexture(new Size(w,h), bmpData.Scan0); texture = _CreateTexture(new Size(w, h), bmpData.Scan0);
bmp.UnlockBits(bmpData); bmp.UnlockBits(bmpData);
} }
finally finally
@@ -317,25 +336,25 @@ namespace Vocaluxe.Lib.Draw
} }
_AddToCache(texture, origSize, texturePath); _AddToCache(texture, origSize, texturePath);
return _GetTextureReference(origSize,texture); return _GetTextureReference(origSize, texture);
} }
public CTextureRef AddTexture(int w, int h, byte[] data) public CTextureRef AddTexture(int w, int h, byte[] data)
{ {
TTextureType texture = _CreateTexture(new Size(w, h), data); TTextureType texture = _CreateTexture(new Size(w, h), data);
return _GetTextureReference(w,h, texture); return _GetTextureReference(w, h, texture);
} }
/// <summary> /// <summary>
/// Method used to add a texture to the texture list and return a TextureRef to it<br/> /// Method used to add a texture to the texture list and return a TextureRef to it<br />
/// Important: This should be the only function to ever write to _Textures /// Important: This should be the only function to ever write to _Textures
/// </summary> /// </summary>
/// <param name="origSize"></param> /// <param name="origSize"></param>
/// <param name="texture"></param> /// <param name="texture"></param>
/// <returns></returns> /// <returns></returns>
protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture) protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture)
{ {
Debug.Assert(origSize.Width>0 && origSize.Height>0); Debug.Assert(origSize.Width > 0 && origSize.Height > 0);
int id; int id;
lock (_MutexID) lock (_MutexID)
{ {
@@ -344,7 +363,7 @@ namespace Vocaluxe.Lib.Draw
CTextureRef textureRef = new CTextureRef(id, origSize); CTextureRef textureRef = new CTextureRef(id, origSize);
if (texture != null) if (texture != null)
texture.RefCount++; texture.RefCount++;
if(texture==null || texture.RefCount==1) if (texture == null || texture.RefCount == 1)
_TextureCount++; _TextureCount++;
lock (_Textures) lock (_Textures)
{ {
@@ -354,8 +373,8 @@ namespace Vocaluxe.Lib.Draw
} }
/// <summary> /// <summary>
/// Method used to add a texture to the texture list and return a TextureRef to it<br/> /// Method used to add a texture to the texture list and return a TextureRef to it<br />
/// Convenience method /// Convenience method
/// </summary> /// </summary>
/// <param name="origWidth"></param> /// <param name="origWidth"></param>
/// <param name="origHeight"></param> /// <param name="origHeight"></param>
@@ -371,7 +390,7 @@ namespace Vocaluxe.Lib.Draw
lock (_Textures) lock (_Textures)
{ {
CTextureRef textureRef = _GetTextureReference(w, h, null); CTextureRef textureRef = _GetTextureReference(w, h, null);
_TexturesToLoad.Enqueue(new STextureQueue(textureRef.ID, new Size(w,h),data)); _TexturesToLoad.Enqueue(new STextureQueue(textureRef.ID, new Size(w, h), data));
return textureRef; return textureRef;
} }
} }
@@ -405,7 +424,7 @@ namespace Vocaluxe.Lib.Draw
} }
lock (_Textures) lock (_Textures)
{ {
return _Textures.TryGetValue(textureRef.ID, out texture) && texture!=null; return _Textures.TryGetValue(textureRef.ID, out texture) && texture != null;
} }
} }
@@ -419,17 +438,18 @@ namespace Vocaluxe.Lib.Draw
return; return;
lock (_Textures) lock (_Textures)
{ {
TTextureType t; TTextureType t;
if (_Textures.TryGetValue(texture.ID, out t)) if (_Textures.TryGetValue(texture.ID, out t))
{
if (t != null && --t.RefCount <= 0)
{ {
if (t != null && --t.RefCount <= 0) if (t.TexturePath != null)
{ _TextureCache.Remove(t.TexturePath);
if(t.TexturePath!=null) _TextureCache.Remove(t.TexturePath); t.Dispose();
t.Dispose(); _TextureCount--;
_TextureCount--;
}
_Textures.Remove(texture.ID);
} }
_Textures.Remove(texture.ID);
}
texture.ID = -1; texture.ID = -1;
} }
texture = null; texture = null;
@@ -456,6 +476,31 @@ namespace Vocaluxe.Lib.Draw
{ {
return _TextureCount; return _TextureCount;
} }
/// <summary>
/// Draws a texture
/// </summary>
/// <param name="texture">The texture to be drawn</param>
public void DrawTexture(CTextureRef texture)
{
if (texture == null)
return;
DrawTexture(texture, texture.Rect, texture.Color);
}
/// <summary>
/// Draws a texture
/// </summary>
/// <param name="texture">The texture to be drawn</param>
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
public void DrawTexture(CTextureRef texture, SRectF rect)
{
if (texture == null)
return;
DrawTexture(texture, rect, texture.Color);
}
public abstract void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false);
#endregion #endregion
/// <summary> /// <summary>
+16 -55
View File
@@ -273,14 +273,9 @@ namespace Vocaluxe.Lib.Draw
//TODO: Check if _W,_H needs to be used or not //TODO: Check if _W,_H needs to be used or not
Size size = new Size(GetScreenWidth(), GetScreenHeight()); Size size = new Size(GetScreenWidth(), GetScreenHeight());
COGLTexture texture = _CreateTexture(size); COGLTexture texture = _CreateTexture(size);
GL.BindTexture(TextureTarget.Texture2D, texture.Name); GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, size.Width, size.Height); //TODO: Use _X,_Y and _W,_H? GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, size.Width, size.Height); //TODO: Use _X,_Y and _W,_H?
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
return _GetTextureReference(size, texture); return _GetTextureReference(size, texture);
@@ -298,9 +293,7 @@ namespace Vocaluxe.Lib.Draw
else else
{ {
GL.BindTexture(TextureTarget.Texture2D, texture.Name); GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, GetScreenWidth(), GetScreenHeight()); GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, GetScreenWidth(), GetScreenHeight());
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
} }
} }
@@ -405,53 +398,42 @@ namespace Vocaluxe.Lib.Draw
#endregion Basic Draw Methods #endregion Basic Draw Methods
#region Textures #region Textures
protected override COGLTexture _CreateTexture(Size dataSize)
#region adding
private COGLTexture _CreateTexture(Size dataSize)
{ {
return new COGLTexture(GL.GenTexture(), dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height)); COGLTexture texture = new COGLTexture(GL.GenTexture(), dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height));
}
protected override COGLTexture _CreateTexture(Size dataSize, IntPtr data)
{
COGLTexture texture = _CreateTexture(dataSize);
GL.BindTexture(TextureTarget.Texture2D, texture.Name); GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
return texture; return texture;
} }
protected override COGLTexture _CreateTexture(Size dataSize, byte[] data) protected override void _WriteDataToTexture(COGLTexture texture, byte[] data)
{
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, 0);
}
protected override void _WriteDataToTexture(COGLTexture texture, IntPtr data)
{ {
COGLTexture texture = _CreateTexture(dataSize);
GL.BindTexture(TextureTarget.Texture2D, texture.Name); GL.BindTexture(TextureTarget.Texture2D, texture.Name);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data); GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
return texture;
} }
#endregion adding
#region updating
public override bool UpdateTexture(CTextureRef textureRef, int w, int h, byte[] data) public override bool UpdateTexture(CTextureRef textureRef, int w, int h, byte[] data)
{ {
COGLTexture texture; COGLTexture texture;
@@ -466,34 +448,13 @@ namespace Vocaluxe.Lib.Draw
texture.DataSize = new Size(w, h); texture.DataSize = new Size(w, h);
} }
GL.BindTexture(TextureTarget.Texture2D, texture.Name); _WriteDataToTexture(texture, data);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, 0);
return true; return true;
} }
#endregion updating
#region drawing #region drawing
public void DrawTexture(CTextureRef texture) public override void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false)
{
if (texture == null)
return;
DrawTexture(texture, texture.Rect, texture.Color);
}
public void DrawTexture(CTextureRef texture, SRectF rect)
{
if (texture == null)
return;
DrawTexture(texture, rect, texture.Color);
}
public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false)
{ {
COGLTexture texture; COGLTexture texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))