Introduced OrigSize for original size of textures
This commit is contained in:
1 parent
151fab8857
commit
5bbfd07e01
15 files changed
+206
-229
No files matched your search
@@ -196,13 +196,13 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect)
|
public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect)
|
||||||
{
|
{
|
||||||
if (texture.Height <= 0f)
|
if (texture.OrigSize.Height <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H);
|
RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H);
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
|
|
||||||
CHelper.SetRect(bounds, out rect, (float)texture.Width / texture.Height, aspect);
|
CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect);
|
||||||
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
|
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
|
||||||
texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
|
texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,10 +171,10 @@ namespace Vocaluxe.Base
|
|||||||
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
|
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
|
||||||
_Finished = CVideo.Finished(_VideoStream);
|
_Finished = CVideo.Finished(_VideoStream);
|
||||||
|
|
||||||
STexture tex = new STexture(-1) {Height = 0};
|
STexture tex = new STexture(-1);
|
||||||
CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime);
|
CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime);
|
||||||
|
|
||||||
if (tex.Height > 0)
|
if (tex.Index > 0)
|
||||||
{
|
{
|
||||||
CDraw.RemoveTexture(ref _VideoTexture);
|
CDraw.RemoveTexture(ref _VideoTexture);
|
||||||
_VideoTexture = tex;
|
_VideoTexture = tex;
|
||||||
@@ -182,7 +182,7 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
|
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)_VideoTexture.Width / _VideoTexture.Height, EAspect.Crop);
|
CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop);
|
||||||
|
|
||||||
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
|
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -678,23 +678,21 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public STexture CopyScreen()
|
public STexture CopyScreen()
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, _W, _H);
|
||||||
|
texture.W2 = _CheckForNextPowerOf2(_W);
|
||||||
|
texture.H2 = _CheckForNextPowerOf2(_H);
|
||||||
|
|
||||||
|
texture.WidthRatio = (float)texture.OrigSize.Width / texture.W2;
|
||||||
|
texture.HeightRatio = (float)texture.OrigSize.Height / texture.H2;
|
||||||
|
|
||||||
Surface backbufferSurface = _Device.GetBackBuffer(0, 0);
|
Surface backbufferSurface = _Device.GetBackBuffer(0, 0);
|
||||||
Texture tex = new Texture(_Device, _PresentParameters.BackBufferWidth, _PresentParameters.BackBufferHeight, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
|
Texture tex = new Texture(_Device, _W, _H, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
|
||||||
Surface textureSurface = tex.GetSurfaceLevel(0);
|
Surface textureSurface = tex.GetSurfaceLevel(0);
|
||||||
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0);
|
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0, new Rectangle(0, 0, _W, _H), new Rectangle(0, 0, _W, _H));
|
||||||
backbufferSurface.Dispose();
|
backbufferSurface.Dispose();
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
_D3DTextures.Add(_IDs.Peek(), tex);
|
_D3DTextures.Add(_IDs.Peek(), tex);
|
||||||
|
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
texture.Width = _W;
|
|
||||||
texture.Height = _H;
|
|
||||||
texture.W2 = _CheckForNextPowerOf2(texture.Width);
|
|
||||||
texture.H2 = _CheckForNextPowerOf2(texture.Height);
|
|
||||||
texture.Index = _IDs.Dequeue();
|
texture.Index = _IDs.Dequeue();
|
||||||
|
|
||||||
_Textures[texture.Index] = texture;
|
_Textures[texture.Index] = texture;
|
||||||
@@ -708,7 +706,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="texture">The texture in which the frame is copied to</param>
|
/// <param name="texture">The texture in which the frame is copied to</param>
|
||||||
public void CopyScreen(ref STexture texture)
|
public void CopyScreen(ref STexture texture)
|
||||||
{
|
{
|
||||||
if (!_TextureExists(ref texture) || texture.Width != GetScreenWidth() || texture.Height != GetScreenHeight())
|
//Check for actual texture sizes! (W2/H2) as it may be up/downsized compared to OrigSize
|
||||||
|
if (!_TextureExists(ref texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight())
|
||||||
{
|
{
|
||||||
RemoveTexture(ref texture);
|
RemoveTexture(ref texture);
|
||||||
texture = CopyScreen();
|
texture = CopyScreen();
|
||||||
@@ -924,9 +923,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture AddTexture(int w, int h, byte[] data)
|
public STexture AddTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, w, h);
|
||||||
|
|
||||||
Texture t = _CreateTexture(w, h, data, ref texture);
|
Texture t = _CreateTexture(data, ref texture);
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
@@ -937,10 +936,10 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Texture _CreateTexture(int w, int h, byte[] data, ref STexture texture)
|
private Texture _CreateTexture(byte[] data, ref STexture texture)
|
||||||
{
|
{
|
||||||
texture.Width = w;
|
int w = texture.OrigSize.Width;
|
||||||
texture.Height = h;
|
int h = texture.OrigSize.Height;
|
||||||
texture.W2 = _CheckForNextPowerOf2(w);
|
texture.W2 = _CheckForNextPowerOf2(w);
|
||||||
texture.H2 = _CheckForNextPowerOf2(h);
|
texture.H2 = _CheckForNextPowerOf2(h);
|
||||||
texture.WidthRatio = (float)w / texture.W2;
|
texture.WidthRatio = (float)w / texture.W2;
|
||||||
@@ -957,14 +956,12 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
int rowWidth = 4 * texture.W2;
|
int rowWidth = 4 * texture.W2;
|
||||||
for (int i = 0; i + rowWidth <= data.Length; i += 4 * w)
|
for (int i = 0; i + rowWidth <= data.Length; i += 4 * w)
|
||||||
{
|
{
|
||||||
rect.Data.Write(data, i, rowWidth);
|
rect.Data.Write(data, i, 4 * w);
|
||||||
rect.Data.Position = rect.Data.Position - rowWidth;
|
rect.Data.Position = rect.Data.Position - rowWidth;
|
||||||
rect.Data.Position += rect.Pitch;
|
rect.Data.Position += rect.Pitch;
|
||||||
}
|
}
|
||||||
t.UnlockRectangle(0);
|
t.UnlockRectangle(0);
|
||||||
|
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
texture.TexturePath = String.Empty;
|
texture.TexturePath = String.Empty;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@@ -978,12 +975,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture EnqueueTexture(int w, int h, byte[] data)
|
public STexture EnqueueTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, w, h);
|
||||||
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
||||||
|
|
||||||
texture.Height = h;
|
|
||||||
texture.Width = w;
|
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
_D3DTextures.Add(_IDs.Peek(), null);
|
_D3DTextures.Add(_IDs.Peek(), null);
|
||||||
@@ -1010,37 +1004,17 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
DataRectangle rect = _D3DTextures[texture.Index].LockRectangle(0, LockFlags.Discard);
|
DataRectangle rect = _D3DTextures[texture.Index].LockRectangle(0, LockFlags.Discard);
|
||||||
int w = texture.Width;
|
int w = texture.OrigSize.Width;
|
||||||
for (int i = 0; i < data.Length; i += 4 * w)
|
int rowWidth = 4 * texture.W2;
|
||||||
|
for (int i = 0; i + rowWidth <= data.Length; i += 4 * w)
|
||||||
{
|
{
|
||||||
rect.Data.Write(data, i, 4 * w);
|
rect.Data.Write(data, i, 4 * w);
|
||||||
rect.Data.Position -= 4 * w;
|
rect.Data.Position = rect.Data.Position - rowWidth;
|
||||||
rect.Data.Position += rect.Pitch;
|
rect.Data.Position += rect.Pitch;
|
||||||
}
|
}
|
||||||
_D3DTextures[texture.Index].UnlockRectangle(0);
|
_D3DTextures[texture.Index].UnlockRectangle(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flamefire: Unneccesary as height can not be changed by this! (Texture gets copied)
|
|
||||||
//Texture.height_ratio = Texture.height / CheckForNextPowerOf2(Texture.height);
|
|
||||||
//Texture.width_ratio = Texture.width / CheckForNextPowerOf2(Texture.width);
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/*Surface s = _D3DTextures[Texture.index].GetSurfaceLevel(0);
|
|
||||||
DataRectangle d = s.LockRectangle(LockFlags.Discard);
|
|
||||||
|
|
||||||
for (int i = 0; i < Data.Length; )
|
|
||||||
{
|
|
||||||
d.Data.Write(Data, i, 4 * (int)Texture.width);
|
|
||||||
i += 4 * (int)Texture.width;
|
|
||||||
d.Data.Position = d.Data.Position - 4 * (int)Texture.width;
|
|
||||||
d.Data.Position += d.Pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
Texture.height_ratio = Texture.height / NextPowerOfTwo(Texture.height);
|
|
||||||
Texture.width_ratio = Texture.width / NextPowerOfTwo(Texture.width);
|
|
||||||
|
|
||||||
s.UnlockRectangle();
|
|
||||||
return true; */
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1351,11 +1325,15 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
if (!_Textures.ContainsKey(q.ID))
|
if (!_Textures.ContainsKey(q.ID))
|
||||||
continue;
|
continue;
|
||||||
STexture texture = _Textures[q.ID];
|
STexture texture = _Textures[q.ID];
|
||||||
|
if (q.Width == texture.OrigSize.Width && q.Height == texture.OrigSize.Height)
|
||||||
|
{
|
||||||
|
Texture t = _CreateTexture(q.Data, ref texture);
|
||||||
|
_D3DTextures[q.ID] = t;
|
||||||
|
|
||||||
Texture t = _CreateTexture(q.Width, q.Height, q.Data, ref texture);
|
_Textures[texture.Index] = texture;
|
||||||
_D3DTextures[q.ID] = t;
|
}
|
||||||
|
else
|
||||||
_Textures[texture.Index] = texture;
|
CLog.LogError("Wrong texture size in queue!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,18 +291,11 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture CopyScreen()
|
public STexture CopyScreen()
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(0);
|
|
||||||
Bitmap bmp = new Bitmap(_Backbuffer);
|
Bitmap bmp = new Bitmap(_Backbuffer);
|
||||||
_Bitmaps.Add(bmp);
|
_Bitmaps.Add(bmp);
|
||||||
|
STexture texture = new STexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height);
|
||||||
texture.Index = _Bitmaps.Count - 1;
|
|
||||||
|
|
||||||
texture.Width = bmp.Width;
|
|
||||||
texture.Height = bmp.Height;
|
|
||||||
|
|
||||||
// Add to Texture List
|
// Add to Texture List
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
_Textures.Add(texture);
|
_Textures.Add(texture);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
@@ -310,7 +303,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public void CopyScreen(ref STexture texture)
|
public void CopyScreen(ref STexture texture)
|
||||||
{
|
{
|
||||||
if (texture.Index == 0 || texture.Width != GetScreenWidth() || texture.Height != GetScreenHeight())
|
if (texture.Index == 0 || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight())
|
||||||
{
|
{
|
||||||
RemoveTexture(ref texture);
|
RemoveTexture(ref texture);
|
||||||
texture = CopyScreen();
|
texture = CopyScreen();
|
||||||
@@ -344,10 +337,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
Bitmap bmp2 = new Bitmap(bmp);
|
Bitmap bmp2 = new Bitmap(bmp);
|
||||||
_Bitmaps.Add(bmp2);
|
_Bitmaps.Add(bmp2);
|
||||||
STexture texture = new STexture {Index = _Bitmaps.Count - 1, Width = bmp.Width, Height = bmp.Height, Color = new SColorF(1f, 1f, 1f, 1f)};
|
STexture texture = new STexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height);
|
||||||
|
|
||||||
// Add to Texture List
|
// Add to Texture List
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
texture.TexturePath = String.Empty;
|
texture.TexturePath = String.Empty;
|
||||||
|
|
||||||
_Textures.Add(texture);
|
_Textures.Add(texture);
|
||||||
|
|||||||
+123
-132
@@ -490,23 +490,20 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture CopyScreen()
|
public STexture CopyScreen()
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, _W, _H);
|
||||||
|
|
||||||
int id = GL.GenTexture();
|
int id = GL.GenTexture();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||||
texture.ID = id;
|
texture.ID = id;
|
||||||
|
|
||||||
texture.Width = _W;
|
texture.W2 = MathHelper.NextPowerOfTwo(texture.OrigSize.Width);
|
||||||
texture.Height = _H;
|
texture.H2 = MathHelper.NextPowerOfTwo(texture.OrigSize.Height);
|
||||||
texture.W2 = MathHelper.NextPowerOfTwo(texture.Width);
|
|
||||||
texture.H2 = MathHelper.NextPowerOfTwo(texture.Height);
|
|
||||||
|
|
||||||
texture.WidthRatio = (float)texture.Width / texture.W2;
|
texture.WidthRatio = (float)texture.OrigSize.Width / texture.W2;
|
||||||
texture.HeightRatio = (float)texture.Height / texture.H2;
|
texture.HeightRatio = (float)texture.OrigSize.Height / texture.H2;
|
||||||
|
|
||||||
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.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, texture.Width, texture.Height);
|
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, _W, _H);
|
||||||
|
|
||||||
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.Linear);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||||
@@ -514,8 +511,6 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
|
|
||||||
// Add to Texture List
|
// Add to Texture List
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
@@ -528,7 +523,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public void CopyScreen(ref STexture texture)
|
public void CopyScreen(ref STexture texture)
|
||||||
{
|
{
|
||||||
if (!_TextureExists(ref texture) || Math.Abs(texture.Width - GetScreenWidth()) > 1 || Math.Abs(texture.Height - GetScreenHeight()) > 1)
|
//Check for actual texture sizes! (W2/H2) as it may be up/downsized compared to OrigSize
|
||||||
|
if (!_TextureExists(ref texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight())
|
||||||
{
|
{
|
||||||
RemoveTexture(ref texture);
|
RemoveTexture(ref texture);
|
||||||
texture = CopyScreen();
|
texture = CopyScreen();
|
||||||
@@ -537,7 +533,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||||
|
|
||||||
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, texture.Width, texture.Height);
|
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, texture.OrigSize.Width, texture.OrigSize.Height);
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
}
|
}
|
||||||
@@ -679,10 +675,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture AddTexture(Bitmap bmp)
|
public STexture AddTexture(Bitmap bmp)
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
|
||||||
|
|
||||||
if (bmp.Height == 0 || bmp.Width == 0)
|
if (bmp.Height == 0 || bmp.Width == 0)
|
||||||
return texture;
|
return new STexture(-1);
|
||||||
|
|
||||||
int maxSize;
|
int maxSize;
|
||||||
switch (CConfig.TextureQuality)
|
switch (CConfig.TextureQuality)
|
||||||
@@ -726,13 +720,12 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
h = maxSize;
|
h = maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STexture texture = new STexture(-1, w, h);
|
||||||
|
|
||||||
int id = GL.GenTexture();
|
int id = GL.GenTexture();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||||
texture.ID = id;
|
texture.ID = id;
|
||||||
|
|
||||||
texture.Width = w;
|
|
||||||
texture.Height = h;
|
|
||||||
|
|
||||||
texture.W2 = MathHelper.NextPowerOfTwo(w);
|
texture.W2 = MathHelper.NextPowerOfTwo(w);
|
||||||
texture.H2 = MathHelper.NextPowerOfTwo(h);
|
texture.H2 = MathHelper.NextPowerOfTwo(h);
|
||||||
try
|
try
|
||||||
@@ -773,8 +766,6 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
|
|
||||||
// Add to Texture List
|
// Add to Texture List
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
texture.TexturePath = String.Empty;
|
texture.TexturePath = String.Empty;
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
@@ -788,9 +779,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public STexture AddTexture(int w, int h, byte[] data)
|
public STexture AddTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, w, h);
|
||||||
|
|
||||||
_CreateTexture(w, h, data, ref texture);
|
_CreateTexture(data, ref texture);
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
@@ -801,8 +792,10 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _CreateTexture(int w, int h, byte[] data, ref STexture texture)
|
private void _CreateTexture(byte[] data, ref STexture texture)
|
||||||
{
|
{
|
||||||
|
int w = texture.OrigSize.Width;
|
||||||
|
int h = texture.OrigSize.Height;
|
||||||
if (_UsePBO)
|
if (_UsePBO)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -823,13 +816,11 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||||
texture.ID = id;
|
texture.ID = id;
|
||||||
|
|
||||||
texture.Width = w;
|
texture.W2 = MathHelper.NextPowerOfTwo(w);
|
||||||
texture.Height = h;
|
texture.H2 = MathHelper.NextPowerOfTwo(h);
|
||||||
texture.W2 = MathHelper.NextPowerOfTwo(texture.Width);
|
|
||||||
texture.H2 = MathHelper.NextPowerOfTwo(texture.Height);
|
|
||||||
|
|
||||||
texture.WidthRatio = (float)texture.Width / texture.W2;
|
texture.WidthRatio = (float)w / texture.W2;
|
||||||
texture.HeightRatio = (float)texture.Height / texture.H2;
|
texture.HeightRatio = (float)h / texture.H2;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -847,19 +838,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
|
|
||||||
// Add to Texture List
|
// Add to Texture List
|
||||||
texture.Color = new SColorF(1f, 1f, 1f, 1f);
|
|
||||||
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
|
|
||||||
texture.TexturePath = String.Empty;
|
texture.TexturePath = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public STexture EnqueueTexture(int w, int h, byte[] data)
|
public STexture EnqueueTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
STexture texture = new STexture(-1);
|
STexture texture = new STexture(-1, w, h);
|
||||||
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
|
||||||
|
|
||||||
texture.Height = h;
|
|
||||||
texture.Width = w;
|
|
||||||
|
|
||||||
lock (_MutexTexture)
|
lock (_MutexTexture)
|
||||||
{
|
{
|
||||||
texture.Index = _IDs.Dequeue();
|
texture.Index = _IDs.Dequeue();
|
||||||
@@ -887,7 +873,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
|
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.Width, texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.OrigSize.Width, texture.OrigSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
||||||
@@ -897,7 +883,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||||
|
|
||||||
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.Width, texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.OrigSize.Width, texture.OrigSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
|
||||||
|
|
||||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
|
||||||
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
|
||||||
@@ -976,100 +962,100 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y)
|
if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_TextureExists(ref texture))
|
if (!_TextureExists(ref texture))
|
||||||
|
return;
|
||||||
|
|
||||||
|
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
||||||
|
|
||||||
|
float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio;
|
||||||
|
float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio;
|
||||||
|
float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio;
|
||||||
|
float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio;
|
||||||
|
|
||||||
|
if (x1 < 0)
|
||||||
|
x1 = 0f;
|
||||||
|
|
||||||
|
if (x2 > texture.WidthRatio)
|
||||||
|
x2 = texture.WidthRatio;
|
||||||
|
|
||||||
|
if (y1 < 0)
|
||||||
|
y1 = 0f;
|
||||||
|
|
||||||
|
if (y2 > texture.HeightRatio)
|
||||||
|
y2 = texture.HeightRatio;
|
||||||
|
|
||||||
|
|
||||||
|
float rx1 = rect.X;
|
||||||
|
float rx2 = rect.X + rect.W;
|
||||||
|
float ry1 = rect.Y;
|
||||||
|
float ry2 = rect.Y + rect.H;
|
||||||
|
|
||||||
|
if (rx1 < bounds.X)
|
||||||
|
rx1 = bounds.X;
|
||||||
|
|
||||||
|
if (rx2 > bounds.X + bounds.W)
|
||||||
|
rx2 = bounds.X + bounds.W;
|
||||||
|
|
||||||
|
if (ry1 < bounds.Y)
|
||||||
|
ry1 = bounds.Y;
|
||||||
|
|
||||||
|
if (ry2 > bounds.Y + bounds.H)
|
||||||
|
ry2 = bounds.Y + bounds.H;
|
||||||
|
|
||||||
|
GL.Enable(EnableCap.Blend);
|
||||||
|
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||||
|
|
||||||
|
GL.MatrixMode(MatrixMode.Texture);
|
||||||
|
GL.PushMatrix();
|
||||||
|
|
||||||
|
if (Math.Abs(rect.Rotation) > float.Epsilon)
|
||||||
{
|
{
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
|
GL.Translate(0.5f, 0.5f, 0);
|
||||||
|
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
||||||
float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio;
|
GL.Translate(-0.5f, -0.5f, 0);
|
||||||
float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio;
|
|
||||||
float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio;
|
|
||||||
float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio;
|
|
||||||
|
|
||||||
if (x1 < 0)
|
|
||||||
x1 = 0f;
|
|
||||||
|
|
||||||
if (x2 > texture.WidthRatio)
|
|
||||||
x2 = texture.WidthRatio;
|
|
||||||
|
|
||||||
if (y1 < 0)
|
|
||||||
y1 = 0f;
|
|
||||||
|
|
||||||
if (y2 > texture.HeightRatio)
|
|
||||||
y2 = texture.HeightRatio;
|
|
||||||
|
|
||||||
|
|
||||||
float rx1 = rect.X;
|
|
||||||
float rx2 = rect.X + rect.W;
|
|
||||||
float ry1 = rect.Y;
|
|
||||||
float ry2 = rect.Y + rect.H;
|
|
||||||
|
|
||||||
if (rx1 < bounds.X)
|
|
||||||
rx1 = bounds.X;
|
|
||||||
|
|
||||||
if (rx2 > bounds.X + bounds.W)
|
|
||||||
rx2 = bounds.X + bounds.W;
|
|
||||||
|
|
||||||
if (ry1 < bounds.Y)
|
|
||||||
ry1 = bounds.Y;
|
|
||||||
|
|
||||||
if (ry2 > bounds.Y + bounds.H)
|
|
||||||
ry2 = bounds.Y + bounds.H;
|
|
||||||
|
|
||||||
GL.Enable(EnableCap.Blend);
|
|
||||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Texture);
|
|
||||||
GL.PushMatrix();
|
|
||||||
|
|
||||||
if (Math.Abs(rect.Rotation) > float.Epsilon)
|
|
||||||
{
|
|
||||||
GL.Translate(0.5f, 0.5f, 0);
|
|
||||||
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
|
|
||||||
GL.Translate(-0.5f, -0.5f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mirrored)
|
|
||||||
{
|
|
||||||
GL.Begin(BeginMode.Quads);
|
|
||||||
|
|
||||||
GL.TexCoord2(x1, y1);
|
|
||||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x1, y2);
|
|
||||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x2, y2);
|
|
||||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x2, y1);
|
|
||||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.End();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GL.Begin(BeginMode.Quads);
|
|
||||||
|
|
||||||
GL.TexCoord2(x2, y2);
|
|
||||||
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x2, y1);
|
|
||||||
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x1, y1);
|
|
||||||
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.TexCoord2(x1, y2);
|
|
||||||
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
|
||||||
|
|
||||||
GL.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
GL.PopMatrix();
|
|
||||||
|
|
||||||
GL.Disable(EnableCap.Blend);
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mirrored)
|
||||||
|
{
|
||||||
|
GL.Begin(BeginMode.Quads);
|
||||||
|
|
||||||
|
GL.TexCoord2(x1, y1);
|
||||||
|
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x1, y2);
|
||||||
|
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x2, y2);
|
||||||
|
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x2, y1);
|
||||||
|
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL.Begin(BeginMode.Quads);
|
||||||
|
|
||||||
|
GL.TexCoord2(x2, y2);
|
||||||
|
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x2, y1);
|
||||||
|
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x1, y1);
|
||||||
|
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.TexCoord2(x1, y2);
|
||||||
|
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
|
||||||
|
|
||||||
|
GL.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL.PopMatrix();
|
||||||
|
|
||||||
|
GL.Disable(EnableCap.Blend);
|
||||||
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end)
|
public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end)
|
||||||
@@ -1220,9 +1206,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
if (texture.Index < 1)
|
if (texture.Index < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_CreateTexture(q.Width, q.Height, q.Data, ref texture);
|
if (q.Width == texture.OrigSize.Width && q.Height == texture.OrigSize.Height)
|
||||||
|
{
|
||||||
|
_CreateTexture(q.Data, ref texture);
|
||||||
|
|
||||||
_Textures[texture.Index] = texture;
|
_Textures[texture.Index] = texture;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CLog.LogError("Wrong texture size in queue!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video
|
|||||||
|
|
||||||
if (num >= 0)
|
if (num >= 0)
|
||||||
{
|
{
|
||||||
if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height)
|
if (frame.Index == -1 || _Width != frame.OrigSize.Width || _Height != frame.OrigSize.Height)
|
||||||
{
|
{
|
||||||
CDraw.RemoveTexture(ref frame);
|
CDraw.RemoveTexture(ref frame);
|
||||||
frame = CDraw.AddTexture(_Width, _Height, _FrameBuffer[num].Data);
|
frame = CDraw.AddTexture(_Width, _Height, _FrameBuffer[num].Data);
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video
|
|||||||
{
|
{
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return;
|
return;
|
||||||
if (frame.Index == -1 || width != frame.Width || height != frame.Height || data.Length == 0)
|
if (frame.Index == -1 || width != frame.OrigSize.Width || height != frame.OrigSize.Height || data.Length == 0)
|
||||||
{
|
{
|
||||||
CDraw.RemoveTexture(ref frame);
|
CDraw.RemoveTexture(ref frame);
|
||||||
frame = CDraw.AddTexture(width, height, data);
|
frame = CDraw.AddTexture(width, height, data);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Vocaluxe.Lib.Webcam
|
|||||||
{
|
{
|
||||||
lock (_MutexData)
|
lock (_MutexData)
|
||||||
{
|
{
|
||||||
if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height)
|
if (frame.Index == -1 || _Width != frame.OrigSize.Width || _Height != frame.OrigSize.Height)
|
||||||
{
|
{
|
||||||
CDraw.RemoveTexture(ref frame);
|
CDraw.RemoveTexture(ref frame);
|
||||||
frame = CDraw.AddTexture(_Width, _Height, _Data);
|
frame = CDraw.AddTexture(_Width, _Height, _Data);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ namespace Vocaluxe.Screens
|
|||||||
_Image = image;
|
_Image = image;
|
||||||
_ImgDot = imgDot;
|
_ImgDot = imgDot;
|
||||||
_Particle = particle;
|
_Particle = particle;
|
||||||
_ParticleOffsetX = (int)Math.Round(particleOffsetX * image.Rect.W / image.Texture.Width - particle.Rect.W / 2);
|
_ParticleOffsetX = (int)Math.Round(particleOffsetX * image.Rect.W / image.Texture.OrigSize.Width - particle.Rect.W / 2);
|
||||||
_ParticleOffsetY = (int)Math.Round(particleOffsetY * image.Rect.H / image.Texture.Height - particle.Rect.H / 2);
|
_ParticleOffsetY = (int)Math.Round(particleOffsetY * image.Rect.H / image.Texture.OrigSize.Height - particle.Rect.H / 2);
|
||||||
Active = true;
|
Active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +317,8 @@ namespace Vocaluxe.Screens
|
|||||||
base.OnShow();
|
base.OnShow();
|
||||||
|
|
||||||
//Vocaluxe-Logo
|
//Vocaluxe-Logo
|
||||||
_Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), new SRectF((float)(CSettings.RenderW - _TexLogo.Width) / 2, -270, _TexLogo.Width, _TexLogo.Height, -2));
|
_Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1),
|
||||||
|
new SRectF((float)(CSettings.RenderW - _TexLogo.OrigSize.Width) / 2, -270, _TexLogo.OrigSize.Width, _TexLogo.OrigSize.Height, -2));
|
||||||
|
|
||||||
//Little stars for logo
|
//Little stars for logo
|
||||||
int numstars = (int)(_Logo.Rect.W * 0.25f / 2f);
|
int numstars = (int)(_Logo.Rect.W * 0.25f / 2f);
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ namespace Vocaluxe.Screens
|
|||||||
background = _Background;
|
background = _Background;
|
||||||
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
|
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)background.Width / background.Height, aspect);
|
CHelper.SetRect(bounds, out rect, (float)background.OrigAspect, aspect);
|
||||||
|
|
||||||
CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
|
CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
|
||||||
_Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
|
_Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
|
||||||
|
|||||||
@@ -203,11 +203,11 @@ namespace VocaluxeLib.Menu
|
|||||||
private bool _DrawTexture()
|
private bool _DrawTexture()
|
||||||
{
|
{
|
||||||
STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||||
if (texture.Height > 0)
|
if (texture.OrigSize.Height > 1)
|
||||||
{
|
{
|
||||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)texture.Width / texture.Height, EAspect.Crop);
|
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
|
||||||
|
|
||||||
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||||
return true;
|
return true;
|
||||||
@@ -218,11 +218,11 @@ namespace VocaluxeLib.Menu
|
|||||||
private bool _DrawVideo()
|
private bool _DrawVideo()
|
||||||
{
|
{
|
||||||
STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
|
STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
|
||||||
if (videoTexture.Height > 0)
|
if (videoTexture.OrigSize.Height > 1)
|
||||||
{
|
{
|
||||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
|
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
|
||||||
|
|
||||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||||
return true;
|
return true;
|
||||||
@@ -233,11 +233,11 @@ namespace VocaluxeLib.Menu
|
|||||||
private bool _DrawBackgroundMusicVideo()
|
private bool _DrawBackgroundMusicVideo()
|
||||||
{
|
{
|
||||||
STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
|
STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
|
||||||
if (videoTexture.Height > 0)
|
if (videoTexture.OrigSize.Height > 1)
|
||||||
{
|
{
|
||||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
|
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
|
||||||
|
|
||||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
||||||
RectangleF rect2;
|
RectangleF rect2;
|
||||||
CHelper.SetRect(bounds2, out rect2, (float)texture.Width / texture.Height, aspect);
|
CHelper.SetRect(bounds2, out rect2, texture.OrigAspect, aspect);
|
||||||
|
|
||||||
rect.X = rect2.X;
|
rect.X = rect2.X;
|
||||||
rect.Y = rect2.Y;
|
rect.Y = rect2.Y;
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
|
|
||||||
//Width of each of the ends (round parts)
|
//Width of each of the ends (round parts)
|
||||||
//Need 2 of them so use minimum
|
//Need 2 of them so use minimum
|
||||||
float endsW = Math.Min(noteRect.H * noteBegin.Width / noteBegin.Height, noteRect.W / 2);
|
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
|
||||||
|
|
||||||
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
STexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
|
STexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
|
||||||
STexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
|
STexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
|
||||||
|
|
||||||
float dx = noteBackgroundBegin.Width * r.H / noteBackgroundBegin.Height;
|
float dx = r.H * noteBackgroundBegin.OrigAspect;
|
||||||
if (2 * dx > r.W)
|
if (2 * dx > r.W)
|
||||||
dx = r.W / 2;
|
dx = r.W / 2;
|
||||||
|
|
||||||
@@ -618,7 +618,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
);
|
);
|
||||||
|
|
||||||
STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
|
STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
|
||||||
float dx = noteBegin.Width * r.H / noteBegin.Height;
|
float dx = r.H * noteBegin.OrigAspect;
|
||||||
if (2 * dx > r.W)
|
if (2 * dx > r.W)
|
||||||
dx = r.W / 2;
|
dx = r.W / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_CoverBig.Draw(1f, EAspect.Crop);
|
_CoverBig.Draw(1f, EAspect.Crop);
|
||||||
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, (float)_Vidtex.Width / _Vidtex.Height, EAspect.Crop);
|
CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop);
|
||||||
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
|
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
|
||||||
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
|
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
|
||||||
|
|
||||||
|
|||||||
+27
-12
@@ -108,32 +108,47 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public string TexturePath;
|
public string TexturePath;
|
||||||
|
|
||||||
public int Width;
|
/// <summary>
|
||||||
public int Height;
|
/// Original size (e.g. of bmp)
|
||||||
|
/// </summary>
|
||||||
|
public readonly Size OrigSize;
|
||||||
|
public float OrigAspect
|
||||||
|
{
|
||||||
|
get { return (float)OrigSize.Width / OrigSize.Height; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current size when drawn
|
||||||
|
/// </summary>
|
||||||
public SRectF Rect;
|
public SRectF Rect;
|
||||||
|
|
||||||
public int W2; //power of 2 width
|
/// <summary>
|
||||||
public int H2; //power of 2 height
|
/// Internal texture width (on device), a power of 2 if necessary
|
||||||
|
/// </summary>
|
||||||
|
public int W2;
|
||||||
|
/// <summary>
|
||||||
|
/// Internal texture height (on device), a power of 2 if necessary
|
||||||
|
/// </summary>
|
||||||
|
public int H2;
|
||||||
public float WidthRatio;
|
public float WidthRatio;
|
||||||
public float HeightRatio;
|
public float HeightRatio;
|
||||||
|
|
||||||
public SColorF Color;
|
public SColorF Color;
|
||||||
|
|
||||||
public STexture(int index)
|
public STexture(int index, int origWidth = 1, int origHeight = 1)
|
||||||
{
|
{
|
||||||
Index = index;
|
Index = index;
|
||||||
PBO = 0;
|
PBO = 0;
|
||||||
ID = -1;
|
ID = -1;
|
||||||
TexturePath = String.Empty;
|
TexturePath = String.Empty;
|
||||||
|
|
||||||
Width = 1;
|
OrigSize = new Size(origWidth, origHeight);
|
||||||
Height = 1;
|
Rect = new SRectF(0f, 0f, origWidth, origHeight, 0f);
|
||||||
Rect = new SRectF(0f, 0f, 1f, 1f, 0f);
|
|
||||||
|
|
||||||
W2 = 1;
|
W2 = origWidth;
|
||||||
H2 = 1;
|
H2 = origHeight;
|
||||||
WidthRatio = 0.5f;
|
WidthRatio = 1;
|
||||||
HeightRatio = 0.5f;
|
HeightRatio = 1;
|
||||||
|
|
||||||
Color = new SColorF(1f, 1f, 1f, 1f);
|
Color = new SColorF(1f, 1f, 1f, 1f);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user