1
0
Fork 0

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:
frohlich 2009-09-07 21:40:46 +00:00 committed by Tim Moore
parent 5c56757303
commit 2f6107982c
4 changed files with 22 additions and 21 deletions

View file

@ -151,8 +151,8 @@ public:
const SGMaterial* material = _material;
_haveHit = false;
_center = SGVec3d(inverseMatrix.preMult(_center.osg()));
_down = SGVec3d(osg::Matrix::transform3x3(_down.osg(), inverseMatrix));
_center = toSG(inverseMatrix.preMult(toOsg(_center)));
_down = toSG(osg::Matrix::transform3x3(toOsg(_down), inverseMatrix));
if (velocity) {
SGVec3d staticCenter(_center);
@ -208,7 +208,7 @@ public:
_sceneryHit = ori.transform(_sceneryHit);
_sceneryHit += dt*velocity->linear;
}
_sceneryHit = SGVec3d(matrix.preMult(_sceneryHit.osg()));
_sceneryHit = toSG(matrix.preMult(toOsg(_sceneryHit)));
} else {
_material = material;
_haveHit = haveHit;
@ -263,7 +263,8 @@ public:
SGLineSegmentd downSeg(_center, _center + _maxDown*_down);
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

View file

@ -238,13 +238,13 @@ public:
osg::Light* light = lightSource->getLight();
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
light->setAmbient(l->scene_ambient().osg());
light->setDiffuse(l->scene_diffuse().osg());
light->setSpecular(l->scene_specular().osg());
SGVec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
light->setPosition(position.osg());
SGVec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
light->setDirection(direction.osg());
light->setAmbient(toOsg(l->scene_ambient()));
light->setDiffuse(toOsg(l->scene_diffuse()));
light->setSpecular(toOsg(l->scene_specular()));
osg::Vec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
light->setPosition(position);
osg::Vec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
light->setDirection(direction);
light->setSpotExponent(0);
light->setSpotCutoff(180);
light->setConstantAttenuation(1);
@ -292,7 +292,7 @@ public:
#if 0
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
lightModel->setAmbientIntensity(l->scene_ambient().osg());
lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
#else
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
#endif
@ -335,7 +335,7 @@ public:
SGUpdateVisitor* updateVisitor = static_cast<SGUpdateVisitor*>(nv);
osg::Fog* fog = static_cast<osg::Fog*>(sa);
fog->setMode(osg::Fog::EXP2);
fog->setColor(updateVisitor->getFogColor().osg());
fog->setColor(toOsg(updateVisitor->getFogColor()));
fog->setDensity(updateVisitor->getFogExp2Density());
}
};
@ -571,11 +571,11 @@ FGRenderer::update( bool refresh_camera_settings ) {
if ( fgGetBool("/sim/rendering/textures") ) {
SGVec4f clearColor(l->adj_fog_color());
camera->setClearColor(clearColor.osg());
camera->setClearColor(toOsg(clearColor));
}
} else {
SGVec4f clearColor(l->sky_color());
camera->setClearColor(clearColor.osg());
camera->setClearColor(toOsg(clearColor));
}
// update fog params if visibility has changed
@ -785,8 +785,8 @@ FGRenderer::pick(std::vector<SGSceneryPick>& pickList,
if (!pickCallback)
continue;
SGSceneryPick sceneryPick;
sceneryPick.info.local = SGVec3d(hit->getLocalIntersectPoint());
sceneryPick.info.wgs84 = SGVec3d(hit->getWorldIntersectPoint());
sceneryPick.info.local = toSG(hit->getLocalIntersectPoint());
sceneryPick.info.wgs84 = toSG(hit->getWorldIntersectPoint());
sceneryPick.callback = pickCallback;
pickList.push_back(sceneryPick);
}

View file

@ -659,6 +659,6 @@ FGViewer::update (double dt)
}
}
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());
}

View file

@ -143,7 +143,7 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
osgUtil::IntersectVisitor intersectVisitor;
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
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());
get_scene_graph()->accept(intersectVisitor);
bool hits = false;
@ -195,7 +195,7 @@ FGScenery::get_cart_ground_intersection(const SGVec3d& pos, const SGVec3d& dir,
osgUtil::IntersectVisitor intersectVisitor;
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
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());
get_scene_graph()->accept(intersectVisitor);
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))
return false;
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
// while the splashscreen is there, so CheckSceneryVisitor force-loads
// missing objects in the main thread