devices/deviceoptical/opticaldevicetester/DeviceBuffer.h

devices/deviceoptical/opticaldevicetester/DeviceBuffer.h
// Port number to use for server
const int PORTNUMBER = 8889; // Port number for communication
const int SIM_FPS = 60; // Tested for 30,60,120
#if defined( WIN32 )
typedef unsigned __int64 nsTime;
#else
typedef unsigned long long nsTime;
#endif
struct sDataBuffer
{
nsTime mTime;
int mCounter;
double mMarkerData[4][4];
sDataBuffer()
{
mTime = 0;
mCounter = 0;
}
void Simulate(nsTime pTime)
{
mTime = pTime;
for(int i=0;i<4;i++)
{
mMarkerData[i][3] = 0.0; //Occlusion
}
double a = 10.0;
int b = (int)(mTime/10000000);
mMarkerData[0][0] = (double)(b%300)-150;
mMarkerData[0][1] = 0.0;
mMarkerData[0][2] = 0.0;
mMarkerData[1][0] = mMarkerData[0][0] + a;
mMarkerData[1][1] = 0.0;
mMarkerData[1][2] = 0.0;
mMarkerData[2][0] = mMarkerData[0][0];
mMarkerData[2][1] = a;
mMarkerData[2][2] = 0.0;
mMarkerData[3][0] = mMarkerData[0][0];
mMarkerData[3][1] = 0.0;
mMarkerData[3][2] = a;
// Simulate an occlusion
if(mMarkerData[0][0] > 0.0 && mMarkerData[0][0] < 50.0)
{
mMarkerData[0][0] = 0.0;
mMarkerData[0][1] = 20.0;
mMarkerData[0][2] = 0.0;
mMarkerData[0][3] = 1.0;
}
mCounter++;
}
};