コード例 #1
0
static value openflkinect_init(value in)
{
  value v;
  v = alloc_abstract(k_Kinect, new Kinect());

  Kinect* k = static_cast<Kinect*>(val_data(v));
  DeviceOptions& opts = k->getDeviceOptions();

  opts.deviceId = val_string(val_field(in, val_id("deviceId")));
  opts.deviceIndex = val_int(val_field(in, val_id("deviceIndex;")));

  opts.depthEnabled = val_bool(val_field(in, val_id("depthEnabled")));
  opts.colorEnabled = val_bool(val_field(in, val_id("colorEnabled")));
  opts.irEnabled = val_bool(val_field(in, val_id("irEnabled")));
  opts.skeletonTrackingEnabled =
    val_bool(val_field(in, val_id("skeletonTrackingEnabled")));
  opts.interactionEnabled = val_bool(val_field(in, val_id("interactionEnabled")));
  cout << opts.interactionEnabled << endl;
  opts.depthResolution =
     opts.getResolution(val_string(val_field(in, val_id("depthResolution"))));

  opts.depthSize = opts.Vec2fromHaxePoint(in, "depthSize");

  opts.colorResolution =
      opts.getResolution(val_string(
                  val_field(in, val_id("colorResolution"))));
  opts.colorSize = opts.Vec2fromHaxePoint(in, "colorSize");
  opts.irResolution =
      opts.getResolution(val_string(
                  val_field(in, val_id("irResolution"))));
  opts.irSize = opts.Vec2fromHaxePoint(in, "irSize");

  opts.nearModeEnabled = val_bool(val_field(in, val_id("nearModeEnabled")));
  opts.seatedModeEnabled = val_bool(val_field(in, val_id("seatedModeEnabled")));
  opts.userTrackingEnabled = val_bool(val_field(in, val_id("userTrackingEnabled")));
  opts.extendedModeEnabled = val_bool(val_field(in, val_id("extendedModeEnabled")));
  opts.mapColorToDepth = val_bool(val_field(in, val_id("mapColorToDepth")));

  opts.binaryMode = val_bool(val_field(in, val_id("binaryMode")));
  opts.userColor = val_bool(val_field(in, val_id("userColor")));
  opts.removeBackground = val_bool(val_field(in, val_id("removeBackground")));
  opts.inverted = val_bool(val_field(in, val_id("inverted")));

  opts.flipped = val_bool(val_field(in, val_id("flipped")));
  opts.transform = opts.getTransform(val_string(val_field(in,
          val_id("transform"))));
  return v;
}
コード例 #2
0
static value openflkinect_update_depth_pixels(value ref, value depthArray)
{
  val_check_kind(ref, k_Kinect);
  Kinect* k = static_cast<Kinect*>(val_data(ref));

  int* ints = val_array_int(depthArray);
  if ( ! ints )
  {
    return alloc_bool(false);
  }

  if ( k->isCapturing() == false )
  {
    return alloc_bool(false);
  }

  int* depth = k->depthPixels();
  int dims = k->getDeviceOptions().numDepthPixels();
  memcpy(ints, depth, dims*sizeof(int));
  return alloc_bool(true);
}