Hi every one. I’m trying render pointCloud from kinect device using planeGeometry vertexData. And i’m get stuck with understanding of amount of vertices.
function initPointCloud():void
{
var geometry:PlaneGeometry = new PlaneGeometry(100,100,2,2);
var mesh:Mesh = new Mesh(geometry,spriteMaterial);
var vertices:Vector.<Number> = new Vector.<Number>();
pointCloud.position=0;
while(pointCloud.bytesAvailable>0)
{
var x:Number = Number(pointCloud.readUnsignedByte());
x += pointCloud.readUnsignedByte() << 8;
var y:Number = Number(pointCloud.readUnsignedByte());
y += pointCloud.readUnsignedByte() << 8;
var z:Number = Number(pointCloud.readUnsignedByte());
z += pointCloud.readUnsignedByte() << 8;
vertices.push(x);
vertices.push(y);
vertices.push(z*0.1);
}
log("new vertices length =",vertices.length,"old vertices length =",(mesh.geometry.subGeometries[0] as CompactSubGeometry).vertexData.length);
(mesh.geometry.subGeometries[0] as CompactSubGeometry).updateData(vertices);
pointCloudContainer.addChild(mesh);
view.scene.addChild(pointCloudContainer);
log("initPointCloud OK");
renderPointCloud();
}