Added DrawColorReflection-Method. Buggy with OpenGL - Need some help!

This commit is contained in:
Florian Kuepper committed 2012-07-27 12:17:00 +02:00
1 parent 4c07e89904
commit 65b76df0f7
5 files changed
+72

No files matched your search

+5
View File
@@ -117,6 +117,11 @@ namespace Vocaluxe.Base
_Draw.DrawColor(color, rect);
}
public static void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
_Draw.DrawColorReflection(color, rect, space, height);
}
public static void ClearScreen()
{
_Draw.ClearScreen();
+13
View File
@@ -836,6 +836,19 @@ namespace Vocaluxe.Lib.Draw
{
DrawTexture(_BlankTexture, rect, color);
}
/// <summary>
/// Draws reflection of a colored rectangle
/// </summary>
/// <param name="color">The color in which the rectangle will be drawn in</param>
/// <param name="rect">The coordinates in a SRectF struct</param>
/// <param name="space">The space between the texture and the reflection</param>
/// <param name="height">The height of the reflection</param>
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
DrawTextureReflection(_BlankTexture, rect, color, rect, space, height);
}
#endregion Basic Draw Methods
#region Textures
#region adding
+5
View File
@@ -352,6 +352,11 @@ namespace Vocaluxe.Lib.Draw
}
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
}
public STexture AddTexture(Bitmap bmp)
{
Bitmap bmp2 = new Bitmap(bmp);
+48
View File
@@ -661,6 +661,54 @@ namespace Vocaluxe.Lib.Draw
GL.Disable(EnableCap.Blend);
}
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
float rx1 = rect.X;
float rx2 = rect.X + rect.W;
float ry1 = rect.Y + rect.H + space;
float ry2 = rect.Y + rect.H + space + height;
if (rx1 < rect.X)
rx1 = rect.X;
if (rx2 > rect.X + rect.W)
rx2 = rect.X + rect.W;
if (ry1 < rect.Y + space)
ry1 = rect.Y + space;
if (ry2 > rect.Y + rect.H + space + height)
ry2 = rect.Y + rect.H + space + height;
GL.Enable(EnableCap.Blend);
if (rect.Rotation != 0f)
{
GL.Translate(0.5f, 0.5f, 0);
GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
GL.Translate(-0.5f, -0.5f, 0);
}
GL.Begin(BeginMode.Quads);
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);
GL.Color4(color.R, color.G, color.B, 0f);
GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
GL.Color4(color.R, color.G, color.B, 0f);
GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);
GL.End();
GL.Disable(EnableCap.Blend);
}
#endregion Basic Draw Methods
#region Textures
+1
View File
@@ -125,6 +125,7 @@ namespace Vocaluxe.Lib.Draw
// Basic Draw Methods
void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2);
void DrawColor(SColorF color, SRectF rect);
void DrawColorReflection(SColorF color, SRectF rect, float space, float height);
void ClearScreen();
STexture CopyScreen();