static void Draw(float Dt) { WorldSurface.Draw(Default); if (Program.RenderVoxels) { ShaderUniforms.Model = Matrix4x4.CreateTranslation(-Program.WorldOrigin); DefaultFlatColor.Bind(); Voxels.VoxMesh.Draw(); DefaultFlatColor.Unbind(); } Matrix4x4 TransRot = OptotrakClient.GetRotation() * OptotrakClient.GetTranslation(); // This is the transformation matrix for rendering of the plane ShaderUniforms.Model = Matrix4x4.CreateScale(10) * TransRot; // Translates, rotates and scales the plane to appropriate size. Default.Bind(); Plane.Draw(); Default.Unbind(); if (Program.RenderPoints) { RealSenseClient.GetVerts(ref Points); ShaderUniforms.Model = Matrix4x4.Identity; DefaultFlatColor.Bind(); Points.Draw(); DefaultFlatColor.Unbind(); } DrawPin(PinMat1, LegClient.R_Start - Program.WorldOrigin); DrawPin(PinMat2, LegClient.R_End - Program.WorldOrigin); DrawPin(PinMat1, LegClient.L_Start - Program.WorldOrigin); DrawPin(PinMat2, LegClient.L_End - Program.WorldOrigin); }
static void Main(string[] Args) { LoadConfig(); int VoxelsX = (int)(Treadmill_X / VoxelSize); int VoxelsY = (int)(Treadmill_Y / VoxelSize); int VoxelsZ = (int)(Treadmill_Z / VoxelSize); WorldOrigin = new Vector3(Treadmill_X, 0, 0); CameraHeight = new Vector3(0, PelvisHeight, 0); Console.Spawn(Args.Contains("--console") || SpawnConsole); OptotrakClient.Init(40023); LegClient.Init(40024); RenderWindow.Init(60, Treadmill_X, Treadmill_Z); Voxels.Init(VoxelsX, VoxelsY, VoxelsZ, VoxelSize); RealSenseClient.Init(); while (RenderWindow.Tick()) { // Additional logic which should execute per-frame goes here if (!UseThreading) { RealSenseClient.Loop(); } } }
static void Main(string[] Args) { LoadConfig(); int VoxelsX = (int)(Treadmill_X / VoxelSize); int VoxelsY = (int)(Treadmill_Y / VoxelSize); int VoxelsZ = (int)(Treadmill_Z / VoxelSize); WorldOrigin = new Vector3(Treadmill_X, 0, 0); // Shifts the world origin to the left side (the actual render window 0,0,0 is in the right corner) CameraHeight = new Vector3(0, PelvisHeight, 0); // the distance from the floor to the camera Console.Spawn(Args.Contains("--console") || SpawnConsole); OptotrakClient.Init(40023); // initializes optotrack client and starts a thread for it. Starts also a thread for UDP (on port 40023) LegClient.Init(40024); // The same as above but for MVN Analyze RenderWindow.Init(60, Treadmill_X, Treadmill_Z); Voxels.Init(VoxelsX, VoxelsY, VoxelsZ, VoxelSize); RealSenseClient.Init(); while (RenderWindow.Tick()) { // Additional logic which should execute per-frame goes here if (!UseThreading) { RealSenseClient.Loop(); } } }