|
|
|
@ -68,10 +68,10 @@ namespace UltraCombos.Kinect2MotionTransmit |
|
|
|
public ComputeBuffer FinalVelocityBuffer { get { return final_velocity_buffer; } } |
|
|
|
public ComputeBuffer FinalVelocityBuffer { get { return final_velocity_buffer; } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Texture2D depth_high_texture; |
|
|
|
Texture2D depth_texture; |
|
|
|
byte[] depth_high_data; |
|
|
|
byte[] depth_data; |
|
|
|
Texture2D depth_low_texture; |
|
|
|
//Texture2D depth_low_texture; |
|
|
|
byte[] depth_low_data; |
|
|
|
//byte[] depth_low_data; |
|
|
|
Texture2D velocity_texture; |
|
|
|
Texture2D velocity_texture; |
|
|
|
byte[] velocity_data; |
|
|
|
byte[] velocity_data; |
|
|
|
|
|
|
|
|
|
|
|
@ -91,13 +91,13 @@ namespace UltraCombos.Kinect2MotionTransmit |
|
|
|
private void Start() |
|
|
|
private void Start() |
|
|
|
{ |
|
|
|
{ |
|
|
|
buffer = new ComputeBuffer(width * height, sizeof(float) * 4); |
|
|
|
buffer = new ComputeBuffer(width * height, sizeof(float) * 4); |
|
|
|
Debug.LogFormat("[Kinect Grpc] Buffer is created by count {0} and stride {1}", buffer.count, buffer.stride); |
|
|
|
Debug.LogFormat("Buffer is created by count {0} and stride {1}", buffer.count, buffer.stride); |
|
|
|
depth_high_data = new byte[buffer.count / 2]; |
|
|
|
depth_data = new byte[buffer.count ]; |
|
|
|
depth_low_data = new byte[buffer.count / 2]; |
|
|
|
//depth_low_data = new byte[buffer.count / 2]; |
|
|
|
velocity_data = new byte[buffer.count]; |
|
|
|
velocity_data = new byte[buffer.count]; |
|
|
|
|
|
|
|
|
|
|
|
depth_high_texture = new Texture2D(width, height, TextureFormat.BC4, false); |
|
|
|
depth_texture = new Texture2D(width, height, TextureFormat.BC5, false); |
|
|
|
depth_low_texture = new Texture2D(width, height, TextureFormat.BC4, false); |
|
|
|
//depth_low_texture = new Texture2D(width, height, TextureFormat.BC4, false); |
|
|
|
velocity_texture = new Texture2D(width, height, TextureFormat.BC5, false); |
|
|
|
velocity_texture = new Texture2D(width, height, TextureFormat.BC5, false); |
|
|
|
|
|
|
|
|
|
|
|
final_position_buffer = new ComputeBuffer(width * height, sizeof(float) * 4); |
|
|
|
final_position_buffer = new ComputeBuffer(width * height, sizeof(float) * 4); |
|
|
|
@ -152,19 +152,19 @@ namespace UltraCombos.Kinect2MotionTransmit |
|
|
|
kinect.matrix = Matrix4x4.TRS(pos, q, Vector3.one); |
|
|
|
kinect.matrix = Matrix4x4.TRS(pos, q, Vector3.one); |
|
|
|
kinect.ClipBox = new Vector3(data.ClipSizeX, data.ClipSizeY, data.ClipSizeZ); |
|
|
|
kinect.ClipBox = new Vector3(data.ClipSizeX, data.ClipSizeY, data.ClipSizeZ); |
|
|
|
|
|
|
|
|
|
|
|
data.DepthHighData.CopyTo(depth_high_data, 0); |
|
|
|
data.DepthHighData.CopyTo(depth_data, 0); |
|
|
|
data.DepthLowData.CopyTo(depth_low_data, 0); |
|
|
|
//data.DepthLowData.CopyTo(depth_low_data, 0); |
|
|
|
data.VelocityData.CopyTo(velocity_data, 0); |
|
|
|
data.VelocityData.CopyTo(velocity_data, 0); |
|
|
|
|
|
|
|
|
|
|
|
depth_high_texture.LoadRawTextureData(depth_high_data); |
|
|
|
depth_texture.LoadRawTextureData(depth_data); |
|
|
|
depth_high_texture.Apply(); |
|
|
|
depth_texture.Apply(); |
|
|
|
depth_low_texture.LoadRawTextureData(depth_low_data); |
|
|
|
//depth_low_texture.LoadRawTextureData(depth_low_data); |
|
|
|
depth_low_texture.Apply(); |
|
|
|
//depth_low_texture.Apply(); |
|
|
|
velocity_texture.LoadRawTextureData(velocity_data); |
|
|
|
velocity_texture.LoadRawTextureData(velocity_data); |
|
|
|
velocity_texture.Apply(); |
|
|
|
velocity_texture.Apply(); |
|
|
|
|
|
|
|
|
|
|
|
shader.SetTexture(0, "depth_high_texture", depth_high_texture); |
|
|
|
shader.SetTexture(0, "depth_texture", depth_texture); |
|
|
|
shader.SetTexture(0, "depth_low_texture", depth_low_texture); |
|
|
|
//shader.SetTexture(0, "depth_low_texture", depth_low_texture); |
|
|
|
shader.SetTexture(0, "velocity_texture", velocity_texture); |
|
|
|
shader.SetTexture(0, "velocity_texture", velocity_texture); |
|
|
|
shader.SetBuffer(0, "kinect_motion_buffer", buffer); |
|
|
|
shader.SetBuffer(0, "kinect_motion_buffer", buffer); |
|
|
|
shader.SetBuffer(0, "position_buffer", kinect.position); |
|
|
|
shader.SetBuffer(0, "position_buffer", kinect.position); |
|
|
|
@ -257,7 +257,7 @@ namespace UltraCombos.Kinect2MotionTransmit |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
server.Start(); |
|
|
|
server.Start(); |
|
|
|
Debug.Log("[Kinect Grpc] Start Server"); |
|
|
|
Debug.Log("Start Server"); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (System.Exception e) |
|
|
|
catch (System.Exception e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|