Fixed shadows warnings

This commit is contained in:
Robert Osfield
2016-05-25 10:26:35 +01:00
parent 8f20bc9147
commit 831f406d17
3 changed files with 41 additions and 37 deletions

View File

@@ -149,9 +149,6 @@ osg::ref_ptr<SharedGeometry> GeometryPool::getOrCreateGeometry(osgTerrain::Terra
LocationCoords locationCoords;
locationCoords.reserve(numVertices);
osg::Vec3d pos(0.0, 0.0, 0.0);
osg::Vec3d normal(0.0, 0.0, 1.0);
osg::Vec2 delta(1.0f/static_cast<float>(nx), 1.0f/static_cast<float>(ny));
// pass in the delta texcoord per texel via the color array
(*colours)[0].x() = c_mult;
@@ -166,30 +163,37 @@ osg::ref_ptr<SharedGeometry> GeometryPool::getOrCreateGeometry(osgTerrain::Terra
matrix = locator->getTransform();
}
double skirtHeight = -1.0;
// compute the size of the skirtHeight
osg::Vec3d bottom_left(0.0,0.0,0.0);
osg::Vec3d top_right(1.0,1.0,0.0);
// transform for unit coords to local coords of the tile
bottom_left = bottom_left * matrix;
top_right = top_right * matrix;
// if we have a geocentric database then transform into geocentric coords.
const osg::EllipsoidModel* em = locator->getEllipsoidModel();
if (em && locator->getCoordinateSystemType()==osgTerrain::Locator::GEOCENTRIC)
{
// note y axis maps to latitude, x axis to longitude
em->convertLatLongHeightToXYZ(bottom_left.y(), bottom_left.x(), bottom_left.z(), bottom_left.x(), bottom_left.y(), bottom_left.z());
em->convertLatLongHeightToXYZ(top_right.y(), top_right.x(), top_right.z(), top_right.x(), top_right.y(), top_right.z());
osg::Vec3d bottom_left(0.0,0.0,0.0);
osg::Vec3d top_right(1.0,1.0,0.0);
// transform for unit coords to local coords of the tile
bottom_left = bottom_left * matrix;
top_right = top_right * matrix;
// if we have a geocentric database then transform into geocentric coords.
const osg::EllipsoidModel* em = locator->getEllipsoidModel();
if (em && locator->getCoordinateSystemType()==osgTerrain::Locator::GEOCENTRIC)
{
// note y axis maps to latitude, x axis to longitude
em->convertLatLongHeightToXYZ(bottom_left.y(), bottom_left.x(), bottom_left.z(), bottom_left.x(), bottom_left.y(), bottom_left.z());
em->convertLatLongHeightToXYZ(top_right.y(), top_right.x(), top_right.z(), top_right.x(), top_right.y(), top_right.z());
}
double diagonalLength = (top_right-bottom_left).length();
double skirtRatio = 0.02;
skirtHeight = -diagonalLength*skirtRatio;
}
double diagonalLength = (top_right-bottom_left).length();
double skirtRatio = 0.02;
double skirtHeight = -diagonalLength*skirtRatio;
// set up the vertex data
{
osg::Vec3d pos(0.0, 0.0, 0.0);
osg::Vec3d normal(0.0, 0.0, 1.0);
osg::Vec2 delta(1.0f/static_cast<float>(nx), 1.0f/static_cast<float>(ny));
// bottom row for skirt
pos.y () = static_cast<double>(0)*r_mult;
pos.z() = skirtHeight;
@@ -567,11 +571,11 @@ osg::ref_ptr<osg::MatrixTransform> GeometryPool::getTileSubgraph(osgTerrain::Ter
osg::ref_ptr<osg::Program> GeometryPool::getOrCreateProgram(LayerTypes& layerTypes)
{
//OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_programMapMutex);
ProgramMap::iterator itr = _programMap.find(layerTypes);
if (itr!=_programMap.end())
ProgramMap::iterator p_itr = _programMap.find(layerTypes);
if (p_itr!=_programMap.end())
{
// OSG_NOTICE<<") returning existing Program "<<itr->second.get()<<std::endl;
return itr->second.get();
// OSG_NOTICE<<") returning existing Program "<<p_itr->second.get()<<std::endl;
return p_itr->second.get();
}
#if 1

View File

@@ -64,8 +64,8 @@ TerrainTechnique::TerrainTechnique():
setThreadSafeRefUnref(true);
}
TerrainTechnique::TerrainTechnique(const TerrainTechnique& TerrainTechnique,const osg::CopyOp& copyop):
osg::Object(TerrainTechnique,copyop),
TerrainTechnique::TerrainTechnique(const TerrainTechnique& tt,const osg::CopyOp& copyop):
osg::Object(tt,copyop),
_terrainTile(0)
{
}

View File

@@ -324,10 +324,10 @@ void WhiteListTileLoadedCallback::loaded(osgTerrain::TerrainTile* tile, const os
for(unsigned int i=0; i<tile->getNumColorLayers(); ++i)
{
osgTerrain::Layer* layer = tile->getColorLayer(i);
osgTerrain::ImageLayer* imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (imageLayer)
osgTerrain::ImageLayer* color_imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (color_imageLayer)
{
readImageLayer(imageLayer, options);
readImageLayer(color_imageLayer, options);
continue;
}
@@ -372,12 +372,12 @@ void WhiteListTileLoadedCallback::loaded(osgTerrain::TerrainTile* tile, const os
for(unsigned int i=0; i<tile->getNumColorLayers(); ++i)
{
osgTerrain::Layer* layer = tile->getColorLayer(i);
osgTerrain::ImageLayer* imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (imageLayer)
osgTerrain::ImageLayer* color_imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (color_imageLayer)
{
if (imageLayer->getImage()!=0)
if (color_imageLayer->getImage()!=0)
{
validLayer = imageLayer;
validLayer = color_imageLayer;
}
continue;
}
@@ -417,10 +417,10 @@ void WhiteListTileLoadedCallback::loaded(osgTerrain::TerrainTile* tile, const os
for(unsigned int i=0; i<tile->getNumColorLayers(); ++i)
{
osgTerrain::Layer* layer = tile->getColorLayer(i);
osgTerrain::ImageLayer* imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (imageLayer)
osgTerrain::ImageLayer* color_imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer);
if (color_imageLayer)
{
if (imageLayer->getImage()==0)
if (color_imageLayer->getImage()==0)
{
tile->setColorLayer(i, validLayer);
break;