|
@@ -21,7 +21,8 @@ namespace bbiwarg.Graphics
|
|
|
private long timeSpacePressed, timeLeftPressed, timeRightPressed;
|
|
|
private Stopwatch watch;
|
|
|
|
|
|
- public OutputWindow(VideoHandle videoHandle): base(3 * videoHandle.getWidth(), 2 * videoHandle.getHeight())
|
|
|
+ public OutputWindow(VideoHandle videoHandle)
|
|
|
+ : base(3 * videoHandle.getWidth(), 2 * videoHandle.getHeight())
|
|
|
{
|
|
|
this.videoHandle = videoHandle;
|
|
|
watch = new Stopwatch();
|
|
@@ -68,7 +69,7 @@ namespace bbiwarg.Graphics
|
|
|
|
|
|
protected override void OnRenderFrame(FrameEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
base.OnRenderFrame(e);
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
|
|
Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, -Vector3.UnitZ, Vector3.UnitY);
|
|
@@ -139,9 +140,9 @@ namespace bbiwarg.Graphics
|
|
|
Int16 blue = 0;
|
|
|
|
|
|
|
|
|
- float relDepth = videoHandle.getRelativeDepth(x,y);
|
|
|
+ float relDepth = videoHandle.getRelativeDepth(x, y);
|
|
|
red = green = blue = (Int16)((1.0f - videoHandle.getRelativeDepth(x, y)) * Int16.MaxValue);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
switch (videoHandle.getPalmImageStateAt(x, y))
|
|
|
{
|
|
@@ -159,9 +160,11 @@ namespace bbiwarg.Graphics
|
|
|
blue = red = 0;
|
|
|
break;
|
|
|
case PalmImageState.palmGrid:
|
|
|
- green = blue = red = Int16.MaxValue;
|
|
|
+ green = (Int16)(green / 2 + Int16.MaxValue / 2);
|
|
|
+ blue = (Int16)(blue / 2 + Int16.MaxValue / 2);
|
|
|
+ red = (Int16)(red / 2 + Int16.MaxValue / 2);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -184,13 +187,17 @@ namespace bbiwarg.Graphics
|
|
|
blue = (Int16)(blue / 2);
|
|
|
break;
|
|
|
case TouchImageState.touchDetected:
|
|
|
- red = blue = 0;
|
|
|
- green = Int16.MaxValue;
|
|
|
+ red = (Int16)(red / 2);
|
|
|
+ blue = (Int16)(blue / 2);
|
|
|
+ green = (Int16)(green / 2 + Int16.MaxValue / 2);
|
|
|
break;
|
|
|
case TouchImageState.touchTracked:
|
|
|
- red = Int16.MaxValue;
|
|
|
- green = blue = 0;
|
|
|
+ red = (Int16)(red / 2 + Int16.MaxValue / 2);
|
|
|
+ green = (Int16)(green / 2);
|
|
|
+ blue = (Int16)(blue / 2);
|
|
|
break;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
depthTextureData[index] = red;
|
|
@@ -198,7 +205,7 @@ namespace bbiwarg.Graphics
|
|
|
depthTextureData[index + 2] = blue;
|
|
|
|
|
|
|
|
|
- FingerImageState fis = videoHandle.getFingerImageStateAt(x,y);
|
|
|
+ FingerImageState fis = videoHandle.getFingerImageStateAt(x, y);
|
|
|
red = green = blue = 0;
|
|
|
if (videoHandle.isEdgeAt(x, y)) blue = Int16.MaxValue;
|
|
|
else if (fis == FingerImageState.fingerTracked) green = Int16.MaxValue;
|
|
@@ -218,7 +225,7 @@ namespace bbiwarg.Graphics
|
|
|
GL.BindTexture(TextureTarget.Texture2D, depthTextureID);
|
|
|
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.getWidth(), videoHandle.getHeight(), 0, PixelFormat.Rgb, PixelType.Short, depthTextureData);
|
|
|
float size = 0.5f;
|
|
|
- float size_2 = (float) (size / 2.0f);
|
|
|
+ float size_2 = (float)(size / 2.0f);
|
|
|
GL.Begin(PrimitiveType.Quads);
|
|
|
GL.Color3(1.0, 1.0, 1.0);
|
|
|
GL.TexCoord2(0.0, 0.0); GL.Vertex3(0, size_2, -0.5);
|
|
@@ -232,10 +239,10 @@ namespace bbiwarg.Graphics
|
|
|
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.getWidth(), videoHandle.getHeight(), 0, PixelFormat.Rgb, PixelType.Short, edgeTextureData);
|
|
|
GL.Begin(PrimitiveType.Quads);
|
|
|
GL.Color3(1.0, 1.0, 1.0);
|
|
|
- GL.TexCoord2(0.0, 0.0); GL.Vertex3(0, -size/2.0, -0.5);
|
|
|
- GL.TexCoord2(-1.0, 0.0); GL.Vertex3(-size, -size/2.0, -0.5);
|
|
|
- GL.TexCoord2(-1.0, -1.0); GL.Vertex3(-size, size/2.0, -0.5);
|
|
|
- GL.TexCoord2(0.0, -1.0); GL.Vertex3(0, size/2.0, -0.5);
|
|
|
+ GL.TexCoord2(0.0, 0.0); GL.Vertex3(0, -size / 2.0, -0.5);
|
|
|
+ GL.TexCoord2(-1.0, 0.0); GL.Vertex3(-size, -size / 2.0, -0.5);
|
|
|
+ GL.TexCoord2(-1.0, -1.0); GL.Vertex3(-size, size / 2.0, -0.5);
|
|
|
+ GL.TexCoord2(0.0, -1.0); GL.Vertex3(0, size / 2.0, -0.5);
|
|
|
GL.End();
|
|
|
|
|
|
|