Improvements to the osgProducer lib to better handle Producer's normalized
coord system. Addition of ReadCameraConfigFile and WriteCameraConfigFile as a tempory measure for implementing local a C++ read/write of the Producer::CameraConfig, this will be removed once these implementations or similar have been moved to Producer.
This commit is contained in:
@@ -14,6 +14,11 @@ int EventAdapter::_s_Ymax = 1024;
|
||||
int EventAdapter::_s_mx = 0;
|
||||
int EventAdapter::_s_my = 0;
|
||||
|
||||
static float s_xOffset=1.0f;
|
||||
static float s_xScale=0.5f;
|
||||
static float s_yOffset=1.0f;
|
||||
static float s_yScale=0.5f;
|
||||
|
||||
EventAdapter::EventAdapter()
|
||||
{
|
||||
_eventType = NONE; // adaptor does not encapsulate any events.
|
||||
@@ -93,8 +98,8 @@ void EventAdapter::adaptButtonPress(double time,float x, float y, unsigned int b
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = (int)(x*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)(y*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
_s_mx = (int)((x+s_xOffset)*s_xScale*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)((y+s_yOffset)*s_yScale*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
@@ -125,8 +130,8 @@ void EventAdapter::adaptButtonRelease(double time,float x, float y, unsigned int
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = (int)(x*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)(y*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
_s_mx = (int)((x+s_xOffset)*s_xScale*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)((y+s_yOffset)*s_yScale*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
@@ -140,8 +145,8 @@ void EventAdapter::adaptMouseMotion(double time, float x, float y)
|
||||
MOVE;
|
||||
|
||||
_time = time;
|
||||
_s_mx = (int)(x*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)(y*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
_s_mx = (int)((x+s_xOffset)*s_xScale*(float)(_s_Xmax-_s_Xmin))+_s_Xmin;
|
||||
_s_my = (int)((y+s_yOffset)*s_yScale*(float)(_s_Ymin-_s_Ymax))+_s_Ymax;
|
||||
copyStaticVariables();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user