Build fixes for building OSG with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF
This commit is contained in:
@@ -676,7 +676,7 @@ int main(int argc, char** argv)
|
||||
databasePagingThread->add(databasePagingOperation.get());
|
||||
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
viewer.setSceneData(group);
|
||||
viewer.setSceneData(group.get());
|
||||
|
||||
viewer.realize();
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
|
||||
void addTouchPoint(unsigned int id, TouchPhase phase, float x, float y, unsigned int tapCount = 0);
|
||||
|
||||
TouchData* getTouchData() const { return _touchData; }
|
||||
TouchData* getTouchData() const { return _touchData.get(); }
|
||||
bool isMultiTouchEvent() const { return (_touchData.valid()); }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
{ if (i<_placers.size()) _placers.erase(_placers.begin()+i); }
|
||||
|
||||
/// Get a child placer
|
||||
Placer* getPlacer( unsigned int i ) { return _placers.at(i); }
|
||||
const Placer* getPlacer( unsigned int i ) const { return _placers.at(i); }
|
||||
Placer* getPlacer( unsigned int i ) { return _placers[i].get(); }
|
||||
const Placer* getPlacer( unsigned int i ) const { return _placers[i].get(); }
|
||||
|
||||
/// Get number of placers
|
||||
unsigned int getNumPlacers() const { return _placers.size(); }
|
||||
|
||||
@@ -43,41 +43,40 @@ void MultiTouchTrackballManipulator::handleMultiTouchDrag(GUIEventAdapter::Touch
|
||||
osg::Vec2 pt_2_now(now->get(1).x,now->get(1).y);
|
||||
osg::Vec2 pt_1_last(last->get(0).x,last->get(0).y);
|
||||
osg::Vec2 pt_2_last(last->get(1).x,last->get(1).y);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
float gap_now((pt_1_now - pt_2_now).length());
|
||||
float gap_last((pt_1_last - pt_2_last).length());
|
||||
|
||||
|
||||
// osg::notify(osg::ALWAYS) << gap_now << " " << gap_last << std::endl;
|
||||
|
||||
if (abs(gap_last - gap_now) >= zoom_threshold)
|
||||
|
||||
if (abs(gap_last - gap_now) >= zoom_threshold)
|
||||
{
|
||||
// zoom gesture
|
||||
zoomModel( (gap_last - gap_now) * eventTimeDelta, true );
|
||||
}
|
||||
|
||||
// drag gesture
|
||||
|
||||
osg::Vec2 delta = ((pt_1_last - pt_1_now) + (pt_2_last - pt_2_now)) / 2.0f;
|
||||
|
||||
float scale = 0.2f * _distance * eventTimeDelta;
|
||||
|
||||
// osg::notify(osg::ALWAYS) << "drag: " << delta << " scale: " << scale << std::endl;
|
||||
|
||||
panModel( delta.x() * scale, delta.y() * scale * (-1)); // flip y-coord because of different origins.
|
||||
}
|
||||
|
||||
|
||||
// drag gesture
|
||||
|
||||
osg::Vec2 delta = ((pt_1_last - pt_1_now) + (pt_2_last - pt_2_now)) / 2.0f;
|
||||
|
||||
float scale = 0.2f * _distance * eventTimeDelta;
|
||||
|
||||
// osg::notify(osg::ALWAYS) << "drag: " << delta << " scale: " << scale << std::endl;
|
||||
|
||||
panModel( delta.x() * scale, delta.y() * scale * (-1)); // flip y-coord because of different origins.
|
||||
}
|
||||
|
||||
|
||||
bool MultiTouchTrackballManipulator::handle( const GUIEventAdapter& ea, GUIActionAdapter& us )
|
||||
{
|
||||
|
||||
|
||||
bool handled(false);
|
||||
|
||||
switch(ea.getEventType()) {
|
||||
|
||||
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
|
||||
case osgGA::GUIEventAdapter::PUSH:
|
||||
case osgGA::GUIEventAdapter::DRAG:
|
||||
case osgGA::GUIEventAdapter::RELEASE:
|
||||
@@ -90,37 +89,41 @@ bool MultiTouchTrackballManipulator::handle( const GUIEventAdapter& ea, GUIActio
|
||||
eventTimeDelta = 0.;
|
||||
}
|
||||
osgGA::GUIEventAdapter::TouchData* data = ea.getTouchData();
|
||||
|
||||
|
||||
// three touches or two taps for home position
|
||||
if ((data->getNumTouchPoints() == 3) || ((data->getNumTouchPoints() == 1) && (data->get(0).tapCount >= 2))) {
|
||||
if ((data->getNumTouchPoints() == 3) || ((data->getNumTouchPoints() == 1) && (data->get(0).tapCount >= 2)))
|
||||
{
|
||||
flushMouseEventStack();
|
||||
_thrown = false;
|
||||
home(ea,us);
|
||||
handled = true;
|
||||
}
|
||||
|
||||
else if (data->getNumTouchPoints() >= 2)
|
||||
}
|
||||
|
||||
else if (data->getNumTouchPoints() >= 2)
|
||||
{
|
||||
if ((_lastTouchData.valid()) && (_lastTouchData->getNumTouchPoints() >= 2)) {
|
||||
handleMultiTouchDrag(data, _lastTouchData, eventTimeDelta);
|
||||
if ((_lastTouchData.valid()) && (_lastTouchData->getNumTouchPoints() >= 2))
|
||||
{
|
||||
handleMultiTouchDrag(data, _lastTouchData.get(), eventTimeDelta);
|
||||
}
|
||||
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
||||
_lastTouchData = data;
|
||||
|
||||
}
|
||||
|
||||
_lastTouchData = data;
|
||||
|
||||
// check if all touches ended
|
||||
unsigned int num_touches_ended(0);
|
||||
for(osgGA::GUIEventAdapter::TouchData::iterator i = data->begin(); i != data->end(); ++i) {
|
||||
for(osgGA::GUIEventAdapter::TouchData::iterator i = data->begin(); i != data->end(); ++i)
|
||||
{
|
||||
if ((*i).phase == osgGA::GUIEventAdapter::TOUCH_ENDED)
|
||||
num_touches_ended++;
|
||||
}
|
||||
|
||||
if(num_touches_ended == data->getNumTouchPoints()) {
|
||||
|
||||
if(num_touches_ended == data->getNumTouchPoints())
|
||||
{
|
||||
_lastTouchData = NULL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user