private void drawRays(RegisteredCamera thisCamera, int i) { //for each tracked point project from the camera centre to the point: float aspect = GraphicsDevice.Viewport.AspectRatio; effect.World = Matrix.Identity * Matrix.CreateTranslation(viewTranslationVector); //effect.World = effect.World * Matrix.CreateTranslation(thisCamera.PositionVector); //effect.World = effect.World * Matrix.CreateFromYawPitchRoll(yaw * dragSensitivity, pitch * dragSensitivity, roll * dragSensitivity); //effect.World = effect.World * Matrix.CreateScale(globalScaling); //effect.View = Matrix.CreateFromYawPitchRoll(yaw * dragSensitivity, pitch * dragSensitivity, roll * dragSensitivity) * Matrix.CreateLookAt(new Vector3(0, 0, -5 * globalScaling), // Vector3.Zero, Vector3.Up); effect.View = ViewMatrix; effect.Projection = Matrix.CreatePerspectiveFieldOfView(1, aspect, 0.01f, 100); //for (int i = 0; i < thisCamera.TrackedPoints.Count; i++) //{ //int i = (int)rotAngleX; //if (i < thisCamera.TrackedPoints.Count) //{ //TrackedImagePoint thisPoint = thisCamera.TrackedPoints[i]; int testy = 0; //if (WebCamPermute != null) //{ //int thisCamIndex = WebCamPermute[i]; int thisCamIndex = i; if (thisCamIndex < WebCamsEye.Count) { if (WebCamsEye[thisCamIndex].FilteredTrackedPoints != null) { if (WebCamsEye[thisCamIndex].FilteredTrackedPoints.TrackedPoints != null) { if (WebCamsEye[thisCamIndex].FilteredTrackedPoints.TrackedPoints.Count > 0) { //if (WebCamPermute.Count > 0) // { try { for (int r = 0; r < WebCamsEye[thisCamIndex].FilteredTrackedPoints.TrackedPoints.Count; r++) { WebCamTrack thisTrack = WebCamsEye[thisCamIndex].FilteredTrackedPoints.TrackedPoints[r]; if (thisTrack.Points.Count > 0) { Vector3 WordCoordinates = thisCamera.ImageToWorld(thisTrack.Points.Select(x => x.X).Average(), thisTrack.Points.Select(x => x.Y).Average(), -100, transposeRot, negateRot, invertRot, invertZ, rotAngleX, rotAngleY, rotAngleZ); //Vector3 WordCoordinates = thisCamera.ImageToWorld(thisTrack.Points[0].X, thisTrack.Points[0].Y, -100, transposeRot, negateRot, invertRot, invertZ, rotAngleX, rotAngleY, rotAngleZ); Vector3 startPoint = new Vector3(thisCamera.PositionVector.X, thisCamera.PositionVector.Y, thisCamera.PositionVector.Z); Vector3 endPoint = new Vector3(WordCoordinates.X, (float)WordCoordinates.Y, (float)WordCoordinates.Z); //trackInCamera.Add(thisCamIndex); IntersectionLines.Add(new Line3D { LineStart = new Point3D(startPoint.X, startPoint.Y, startPoint.Z), LineEnd = new Point3D(endPoint.X, endPoint.Y, endPoint.Z) }); effect.CurrentTechnique.Passes[0].Apply(); var vertices = new[] { new VertexPositionColor(startPoint, Microsoft.Xna.Framework.Color.Red), new VertexPositionColor(endPoint, Microsoft.Xna.Framework.Color.Red) }; effect.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, vertices, 0, 1); } else { //trackInCamera[thisCamIndex] = false; } } } catch (Exception test) { testy = 1; } return; //} } else { //trackInCamera[thisCamIndex] = false; } } } //} //IntersectionLines[thisCamIndex].Displ } }