Use the new vector conversion functions.
Modified Files: src/FDM/groundcache.cxx src/Main/renderer.cxx src/Main/viewer.cxx src/Scenery/scenery.cxx
This commit is contained in:
parent
5c56757303
commit
2f6107982c
4 changed files with 22 additions and 21 deletions
|
@ -151,8 +151,8 @@ public:
|
||||||
const SGMaterial* material = _material;
|
const SGMaterial* material = _material;
|
||||||
|
|
||||||
_haveHit = false;
|
_haveHit = false;
|
||||||
_center = SGVec3d(inverseMatrix.preMult(_center.osg()));
|
_center = toSG(inverseMatrix.preMult(toOsg(_center)));
|
||||||
_down = SGVec3d(osg::Matrix::transform3x3(_down.osg(), inverseMatrix));
|
_down = toSG(osg::Matrix::transform3x3(toOsg(_down), inverseMatrix));
|
||||||
if (velocity) {
|
if (velocity) {
|
||||||
SGVec3d staticCenter(_center);
|
SGVec3d staticCenter(_center);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public:
|
||||||
_sceneryHit = ori.transform(_sceneryHit);
|
_sceneryHit = ori.transform(_sceneryHit);
|
||||||
_sceneryHit += dt*velocity->linear;
|
_sceneryHit += dt*velocity->linear;
|
||||||
}
|
}
|
||||||
_sceneryHit = SGVec3d(matrix.preMult(_sceneryHit.osg()));
|
_sceneryHit = toSG(matrix.preMult(toOsg(_sceneryHit)));
|
||||||
} else {
|
} else {
|
||||||
_material = material;
|
_material = material;
|
||||||
_haveHit = haveHit;
|
_haveHit = haveHit;
|
||||||
|
@ -263,7 +263,8 @@ public:
|
||||||
|
|
||||||
SGLineSegmentd downSeg(_center, _center + _maxDown*_down);
|
SGLineSegmentd downSeg(_center, _center + _maxDown*_down);
|
||||||
double maxDist = bound._radius + _radius;
|
double maxDist = bound._radius + _radius;
|
||||||
return distSqr(downSeg, SGVec3d(bound._center)) <= maxDist*maxDist;
|
SGVec3d boundCenter(toVec3d(toSG(bound._center)));
|
||||||
|
return distSqr(downSeg, boundCenter) <= maxDist*maxDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGSharedPtr<simgear::BVHNode> getBVHNode() const
|
SGSharedPtr<simgear::BVHNode> getBVHNode() const
|
||||||
|
|
|
@ -238,13 +238,13 @@ public:
|
||||||
osg::Light* light = lightSource->getLight();
|
osg::Light* light = lightSource->getLight();
|
||||||
|
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||||
light->setAmbient(l->scene_ambient().osg());
|
light->setAmbient(toOsg(l->scene_ambient()));
|
||||||
light->setDiffuse(l->scene_diffuse().osg());
|
light->setDiffuse(toOsg(l->scene_diffuse()));
|
||||||
light->setSpecular(l->scene_specular().osg());
|
light->setSpecular(toOsg(l->scene_specular()));
|
||||||
SGVec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
|
osg::Vec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
|
||||||
light->setPosition(position.osg());
|
light->setPosition(position);
|
||||||
SGVec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
|
osg::Vec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
|
||||||
light->setDirection(direction.osg());
|
light->setDirection(direction);
|
||||||
light->setSpotExponent(0);
|
light->setSpotExponent(0);
|
||||||
light->setSpotCutoff(180);
|
light->setSpotCutoff(180);
|
||||||
light->setConstantAttenuation(1);
|
light->setConstantAttenuation(1);
|
||||||
|
@ -292,7 +292,7 @@ public:
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||||
lightModel->setAmbientIntensity(l->scene_ambient().osg());
|
lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
|
||||||
#else
|
#else
|
||||||
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
|
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
|
||||||
#endif
|
#endif
|
||||||
|
@ -335,7 +335,7 @@ public:
|
||||||
SGUpdateVisitor* updateVisitor = static_cast<SGUpdateVisitor*>(nv);
|
SGUpdateVisitor* updateVisitor = static_cast<SGUpdateVisitor*>(nv);
|
||||||
osg::Fog* fog = static_cast<osg::Fog*>(sa);
|
osg::Fog* fog = static_cast<osg::Fog*>(sa);
|
||||||
fog->setMode(osg::Fog::EXP2);
|
fog->setMode(osg::Fog::EXP2);
|
||||||
fog->setColor(updateVisitor->getFogColor().osg());
|
fog->setColor(toOsg(updateVisitor->getFogColor()));
|
||||||
fog->setDensity(updateVisitor->getFogExp2Density());
|
fog->setDensity(updateVisitor->getFogExp2Density());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -571,11 +571,11 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
|
|
||||||
if ( fgGetBool("/sim/rendering/textures") ) {
|
if ( fgGetBool("/sim/rendering/textures") ) {
|
||||||
SGVec4f clearColor(l->adj_fog_color());
|
SGVec4f clearColor(l->adj_fog_color());
|
||||||
camera->setClearColor(clearColor.osg());
|
camera->setClearColor(toOsg(clearColor));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SGVec4f clearColor(l->sky_color());
|
SGVec4f clearColor(l->sky_color());
|
||||||
camera->setClearColor(clearColor.osg());
|
camera->setClearColor(toOsg(clearColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update fog params if visibility has changed
|
// update fog params if visibility has changed
|
||||||
|
@ -785,8 +785,8 @@ FGRenderer::pick(std::vector<SGSceneryPick>& pickList,
|
||||||
if (!pickCallback)
|
if (!pickCallback)
|
||||||
continue;
|
continue;
|
||||||
SGSceneryPick sceneryPick;
|
SGSceneryPick sceneryPick;
|
||||||
sceneryPick.info.local = SGVec3d(hit->getLocalIntersectPoint());
|
sceneryPick.info.local = toSG(hit->getLocalIntersectPoint());
|
||||||
sceneryPick.info.wgs84 = SGVec3d(hit->getWorldIntersectPoint());
|
sceneryPick.info.wgs84 = toSG(hit->getWorldIntersectPoint());
|
||||||
sceneryPick.callback = pickCallback;
|
sceneryPick.callback = pickCallback;
|
||||||
pickList.push_back(sceneryPick);
|
pickList.push_back(sceneryPick);
|
||||||
}
|
}
|
||||||
|
|
|
@ -659,6 +659,6 @@ FGViewer::update (double dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recalc();
|
recalc();
|
||||||
_cameraGroup->update(_absolute_view_pos.osg(), mViewOrientation.osg());
|
_cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
|
||||||
_cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
|
_cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
|
||||||
osgUtil::IntersectVisitor intersectVisitor;
|
osgUtil::IntersectVisitor intersectVisitor;
|
||||||
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
|
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
|
||||||
osg::ref_ptr<osg::LineSegment> lineSegment;
|
osg::ref_ptr<osg::LineSegment> lineSegment;
|
||||||
lineSegment = new osg::LineSegment(start.osg(), end.osg());
|
lineSegment = new osg::LineSegment(toOsg(start), toOsg(end));
|
||||||
intersectVisitor.addLineSegment(lineSegment.get());
|
intersectVisitor.addLineSegment(lineSegment.get());
|
||||||
get_scene_graph()->accept(intersectVisitor);
|
get_scene_graph()->accept(intersectVisitor);
|
||||||
bool hits = false;
|
bool hits = false;
|
||||||
|
@ -195,7 +195,7 @@ FGScenery::get_cart_ground_intersection(const SGVec3d& pos, const SGVec3d& dir,
|
||||||
osgUtil::IntersectVisitor intersectVisitor;
|
osgUtil::IntersectVisitor intersectVisitor;
|
||||||
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
|
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
|
||||||
osg::ref_ptr<osg::LineSegment> lineSegment;
|
osg::ref_ptr<osg::LineSegment> lineSegment;
|
||||||
lineSegment = new osg::LineSegment(start.osg(), end.osg());
|
lineSegment = new osg::LineSegment(toOsg(start), toOsg(end));
|
||||||
intersectVisitor.addLineSegment(lineSegment.get());
|
intersectVisitor.addLineSegment(lineSegment.get());
|
||||||
get_scene_graph()->accept(intersectVisitor);
|
get_scene_graph()->accept(intersectVisitor);
|
||||||
bool hits = false;
|
bool hits = false;
|
||||||
|
@ -235,7 +235,7 @@ bool FGScenery::scenery_available(const SGGeod& position, double range_m)
|
||||||
if (!get_elevation_m(SGGeod::fromGeodM(position, SG_MAX_ELEVATION_M), elev, 0, 0))
|
if (!get_elevation_m(SGGeod::fromGeodM(position, SG_MAX_ELEVATION_M), elev, 0, 0))
|
||||||
return false;
|
return false;
|
||||||
SGVec3f p = SGVec3f::fromGeod(SGGeod::fromGeodM(position, elev));
|
SGVec3f p = SGVec3f::fromGeod(SGGeod::fromGeodM(position, elev));
|
||||||
simgear::CheckSceneryVisitor csnv(getPagerSingleton(), p.osg(), range_m);
|
simgear::CheckSceneryVisitor csnv(getPagerSingleton(), toOsg(p), range_m);
|
||||||
// currently the PagedLODs will not be loaded by the DatabasePager
|
// currently the PagedLODs will not be loaded by the DatabasePager
|
||||||
// while the splashscreen is there, so CheckSceneryVisitor force-loads
|
// while the splashscreen is there, so CheckSceneryVisitor force-loads
|
||||||
// missing objects in the main thread
|
// missing objects in the main thread
|
||||||
|
|
Loading…
Reference in a new issue