|
@@ -58,9 +58,7 @@ namespace bbiwarg.DataSource
|
|
|
else
|
|
|
device.RegisterParameterHandle<int>("SOURCE.DEPTHSENSE.AmplitudeThreshold").Value = 100; // confidence-threshhold
|
|
|
|
|
|
- frameRate = device.RegisterParameterHandle<float>("SOURCE.FrameRate");
|
|
|
-
|
|
|
-
|
|
|
+ frameRate = device.RegisterParameterHandle<float>("SOURCE.FrameRate");
|
|
|
|
|
|
// events
|
|
|
device.EventManager.RegisterEventListener("DEVICE.Status", new Iisu.EventDelegates.Device.Status(onDeviceStatusChanged));
|
|
@@ -69,8 +67,7 @@ namespace bbiwarg.DataSource
|
|
|
depthImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.DEPTH.Image");
|
|
|
colorImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.COLOR.Image");
|
|
|
confidenceImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.CONFIDENCE.Image");
|
|
|
- vertexArray = device.RegisterDataHandle<Iisu.Data.Vertex[]>("SCENE.VertexArray");
|
|
|
-
|
|
|
+
|
|
|
handOpen[0] = device.RegisterDataHandle<bool>("CI.HAND1.IsOpen");
|
|
|
handOpen[1] = device.RegisterDataHandle<bool>("CI.HAND2.IsOpen");
|
|
|
|
|
@@ -99,6 +96,8 @@ namespace bbiwarg.DataSource
|
|
|
private void onDeviceStatusChanged(string eventName, DeviceStatus status)
|
|
|
{
|
|
|
active = status.HasFlag(Iisu.DeviceStatus.Playing);
|
|
|
+ if (vertexArray != null && !vertexArray.Valid && active)
|
|
|
+ vertexArray = device.RegisterDataHandle<Iisu.Data.Vertex[]>("SCENE.VertexArray");
|
|
|
}
|
|
|
|
|
|
public void start()
|
|
@@ -177,20 +176,27 @@ namespace bbiwarg.DataSource
|
|
|
}
|
|
|
|
|
|
public VertexArray getVertexArray()
|
|
|
- {
|
|
|
- int numVertices = vertexArray.Value.Length;
|
|
|
-
|
|
|
- Vector[] positions = new Vector[numVertices];
|
|
|
- Color4[] colors = new Color4[numVertices];
|
|
|
-
|
|
|
- for (int i = 0; i < numVertices; ++i)
|
|
|
- {
|
|
|
- positions[i] = new DenseVector(vertexArray.Value[i].Position.ToArray());
|
|
|
- Iisu.Data.Color4C color = vertexArray.Value[i].Color;
|
|
|
- colors[i] = new Color4(color.A, color.R, color.G, color.B);
|
|
|
+ {
|
|
|
+ if (vertexArray != null && vertexArray.Valid)
|
|
|
+ {
|
|
|
+ int numVertices = vertexArray.Value.Length;
|
|
|
+
|
|
|
+ Vector[] positions = new Vector[numVertices];
|
|
|
+ Color4[] colors = new Color4[numVertices];
|
|
|
+
|
|
|
+ for (int i = 0; i < numVertices; ++i)
|
|
|
+ {
|
|
|
+ positions[i] = new DenseVector(vertexArray.Value[i].Position.ToArray());
|
|
|
+ Iisu.Data.Color4C color = vertexArray.Value[i].Color;
|
|
|
+ colors[i] = new Color4(color.A, color.R, color.G, color.B);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new VertexArray(positions, colors);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return new VertexArray(new DenseVector[0], new Color4[0]);
|
|
|
}
|
|
|
-
|
|
|
- return new VertexArray(positions, colors);
|
|
|
}
|
|
|
|
|
|
private void checkHandIndex(uint handIndex)
|