Fixed shadows warnings
This commit is contained in:
parent
80e318ce15
commit
dbce12842e
@ -500,9 +500,9 @@ osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4&
|
|||||||
{
|
{
|
||||||
float dx = (float(c) - mid)*div;
|
float dx = (float(c) - mid)*div;
|
||||||
float dy = (float(r) - mid)*div;
|
float dy = (float(r) - mid)*div;
|
||||||
float r = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
|
float pr = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
|
||||||
if (r < 0.0f) r = 0.0f;
|
if (pr < 0.0f) pr = 0.0f;
|
||||||
osg::Vec4 color = centerColour*r + backgroudColour*(1.0f - r);
|
osg::Vec4 color = centerColour*pr + backgroudColour*(1.0f - pr);
|
||||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||||
*ptr++ = (unsigned char)((color[2])*255.0f);
|
*ptr++ = (unsigned char)((color[2])*255.0f);
|
||||||
|
@ -108,7 +108,7 @@ typedef vector<BufferConfig> BufferConfigList;
|
|||||||
|
|
||||||
vector<FboConfig> validConfigs;
|
vector<FboConfig> validConfigs;
|
||||||
// Ugly global variables for the viewport width and height
|
// Ugly global variables for the viewport width and height
|
||||||
int width, height;
|
// int width, height;
|
||||||
|
|
||||||
// This is only used when testing possible frame buffer configurations
|
// This is only used when testing possible frame buffer configurations
|
||||||
// to find valid ones.
|
// to find valid ones.
|
||||||
@ -406,10 +406,10 @@ AppState::AppState(osgViewer::Viewer* viewer_)
|
|||||||
|
|
||||||
void AppState::setStateFromConfig(const FboConfig& config)
|
void AppState::setStateFromConfig(const FboConfig& config)
|
||||||
{
|
{
|
||||||
Camera* camera = viewer->getSlave(0)._camera.get();
|
Camera* cam = viewer->getSlave(0)._camera.get();
|
||||||
setAttachmentsFromConfig(camera, config);
|
setAttachmentsFromConfig(cam, config);
|
||||||
osgViewer::Renderer* renderer
|
osgViewer::Renderer* renderer
|
||||||
= dynamic_cast<osgViewer::Renderer*>(camera->getRenderer());
|
= dynamic_cast<osgViewer::Renderer*>(cam->getRenderer());
|
||||||
if (renderer)
|
if (renderer)
|
||||||
renderer->setCameraRequiresSetUp(true);
|
renderer->setCameraRequiresSetUp(true);
|
||||||
if (configText.valid())
|
if (configText.valid())
|
||||||
@ -954,8 +954,8 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
gc->setResizedCallback(new ResizedCallback(appState.get()));
|
gc->setResizedCallback(new ResizedCallback(appState.get()));
|
||||||
const GraphicsContext::Traits* traits = gc->getTraits();
|
const GraphicsContext::Traits* traits = gc->getTraits();
|
||||||
width = traits->width;
|
int width = traits->width;
|
||||||
height = traits->height;
|
int height = traits->height;
|
||||||
if (arguments.argc()<=1)
|
if (arguments.argc()<=1)
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
|
@ -437,11 +437,11 @@ int main(int argv, char **argc)
|
|||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (loadedModel.valid()) group->addChild(loadedModel);
|
if (loadedModel.valid()) group->addChild(loadedModel);
|
||||||
|
|
||||||
for(Tracks::iterator itr = tracks.begin();
|
for(Tracks::iterator titr = tracks.begin();
|
||||||
itr != tracks.end();
|
titr != tracks.end();
|
||||||
++itr)
|
++titr)
|
||||||
{
|
{
|
||||||
Track* track = itr->get();
|
Track* track = titr->get();
|
||||||
|
|
||||||
group->addChild(createTrackModel(track, osg::Vec4(1.0,1.0,1.0,1.0)));
|
group->addChild(createTrackModel(track, osg::Vec4(1.0,1.0,1.0,1.0)));
|
||||||
|
|
||||||
@ -547,11 +547,11 @@ int main(int argv, char **argc)
|
|||||||
|
|
||||||
fout<<"<?xml version=\"1.0\" encoding=\"utf-8\"?><gpx version=\"1.0\" creator=\"osggpx\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/0\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"<<std::endl;
|
fout<<"<?xml version=\"1.0\" encoding=\"utf-8\"?><gpx version=\"1.0\" creator=\"osggpx\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/0\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"<<std::endl;
|
||||||
|
|
||||||
for(Tracks::iterator itr = tracks.begin();
|
for(Tracks::iterator titr = tracks.begin();
|
||||||
itr != tracks.end();
|
titr != tracks.end();
|
||||||
++itr)
|
++titr)
|
||||||
{
|
{
|
||||||
Track* track = itr->get();
|
Track* track = titr->get();
|
||||||
|
|
||||||
fout<<"<trk>"<<std::endl;
|
fout<<"<trk>"<<std::endl;
|
||||||
fout<<"<desc>The track description</desc>"<<std::endl;
|
fout<<"<desc>The track description</desc>"<<std::endl;
|
||||||
|
@ -174,10 +174,10 @@ osg::Camera* createHUD()
|
|||||||
|
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
||||||
|
|
||||||
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
osg::StateSet* ss = geom->getOrCreateStateSet();
|
||||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
ss->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||||
//stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
|
//ss->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
|
||||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
|
||||||
geode->addDrawable(geom);
|
geode->addDrawable(geom);
|
||||||
}
|
}
|
||||||
|
@ -411,8 +411,8 @@ void DepthPeeling::createPeeling()
|
|||||||
_compositeCamera->setViewMatrix(osg::Matrix());
|
_compositeCamera->setViewMatrix(osg::Matrix());
|
||||||
_compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
|
_compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
|
||||||
_compositeCamera->setCullCallback(new CullCallback(0, 0));
|
_compositeCamera->setCullCallback(new CullCallback(0, 0));
|
||||||
osg::StateSet* stateSet = _compositeCamera->getOrCreateStateSet();
|
osg::StateSet* ss = _compositeCamera->getOrCreateStateSet();
|
||||||
stateSet->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
ss->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||||
_root->addChild(_compositeCamera.get());
|
_root->addChild(_compositeCamera.get());
|
||||||
|
|
||||||
// solid geometry is blended first, transparency layers are blended in back to front order.
|
// solid geometry is blended first, transparency layers are blended in back to front order.
|
||||||
|
@ -127,9 +127,9 @@ osg::Image* createBillboardImage(const osg::Vec4& centerColour, unsigned int siz
|
|||||||
{
|
{
|
||||||
float dx = (float(c) - mid)*div;
|
float dx = (float(c) - mid)*div;
|
||||||
float dy = (float(r) - mid)*div;
|
float dy = (float(r) - mid)*div;
|
||||||
float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||||
if (r<0.0f) r=0.0f;
|
if (pr<0.0f) r=0.0f;
|
||||||
osg::Vec4 color = centerColour*r+backgroundColour*(1.0f-r);
|
osg::Vec4 color = centerColour*pr+backgroundColour*(1.0f-pr);
|
||||||
// color.set(1.0f,1.0f,1.0f,0.5f);
|
// color.set(1.0f,1.0f,1.0f,0.5f);
|
||||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||||
|
@ -371,19 +371,19 @@ int main( int argc, char** argv )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Camera* camera = viewer.getCamera();
|
osg::Camera* viewer_camera = viewer.getCamera();
|
||||||
if ( !useLatLongHeight ) computeViewMatrix( camera, eye, hpr );
|
if ( !useLatLongHeight ) computeViewMatrix( viewer_camera, eye, hpr );
|
||||||
else computeViewMatrixOnEarth( camera, scene.get(), latLongHeight, hpr );
|
else computeViewMatrixOnEarth( viewer_camera, scene.get(), latLongHeight, hpr );
|
||||||
|
|
||||||
osg::ref_ptr<CustomRenderer> renderer = new CustomRenderer( camera );
|
osg::ref_ptr<CustomRenderer> renderer = new CustomRenderer( viewer_camera );
|
||||||
camera->setRenderer( renderer.get() );
|
viewer_camera->setRenderer( renderer.get() );
|
||||||
viewer.setThreadingModel( osgViewer::Viewer::SingleThreaded );
|
viewer.setThreadingModel( osgViewer::Viewer::SingleThreaded );
|
||||||
|
|
||||||
// Realize and initiate the first PagedLOD request
|
// Realize and initiate the first PagedLOD request
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
|
|
||||||
printer->init( camera );
|
printer->init( viewer_camera );
|
||||||
while ( !printer->done() )
|
while ( !printer->done() )
|
||||||
{
|
{
|
||||||
viewer.advance();
|
viewer.advance();
|
||||||
|
@ -1108,7 +1108,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (fov!=0.0)
|
if (fov!=0.0)
|
||||||
{
|
{
|
||||||
double fovy, aspectRatio, zNear, zFar;
|
double fovy, aspectRatio;
|
||||||
viewer.getCamera()->getProjectionMatrix().getPerspective(fovy, aspectRatio, zNear, zFar);
|
viewer.getCamera()->getProjectionMatrix().getPerspective(fovy, aspectRatio, zNear, zFar);
|
||||||
|
|
||||||
std::cout << "Setting FOV to " << fov << std::endl;
|
std::cout << "Setting FOV to " << fov << std::endl;
|
||||||
@ -1144,8 +1144,6 @@ int main(int argc, char** argv)
|
|||||||
while (!viewer.done())
|
while (!viewer.done())
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
osgShadow::MinimalShadowMap * msm = dynamic_cast<osgShadow::MinimalShadowMap*>( shadowedScene->getShadowTechnique() );
|
|
||||||
|
|
||||||
if( msm ) {
|
if( msm ) {
|
||||||
|
|
||||||
// If scene decorated by CoordinateSystemNode try to find localToWorld
|
// If scene decorated by CoordinateSystemNode try to find localToWorld
|
||||||
@ -1198,8 +1196,6 @@ int main(int argc, char** argv)
|
|||||||
char filename[256];
|
char filename[256];
|
||||||
std::sprintf( filename, "shadowDump%d.osgt", dumpFileNo );
|
std::sprintf( filename, "shadowDump%d.osgt", dumpFileNo );
|
||||||
|
|
||||||
osgShadow::MinimalShadowMap * msm = dynamic_cast<osgShadow::MinimalShadowMap*>( shadowedScene->getShadowTechnique() );
|
|
||||||
|
|
||||||
if( msm ) msm->setDebugDump( filename );
|
if( msm ) msm->setDebugDump( filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4&
|
|||||||
{
|
{
|
||||||
float dx = (float(c) - mid)*div;
|
float dx = (float(c) - mid)*div;
|
||||||
float dy = (float(r) - mid)*div;
|
float dy = (float(r) - mid)*div;
|
||||||
float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||||
if (r<0.0f) r=0.0f;
|
if (pr<0.0f) pr=0.0f;
|
||||||
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-r);
|
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-pr);
|
||||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||||
*ptr++ = (unsigned char)((color[2])*255.0f);
|
*ptr++ = (unsigned char)((color[2])*255.0f);
|
||||||
|
@ -55,8 +55,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector< osg::ref_ptr<osg::GraphicsThread> > GraphicsThreads;
|
|
||||||
|
|
||||||
struct ReleaseBlockOnCompileCompleted : public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
struct ReleaseBlockOnCompileCompleted : public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -11,21 +11,21 @@
|
|||||||
using namespace osg;
|
using namespace osg;
|
||||||
|
|
||||||
// If graphics board has program linking problems set MERGE_SHADERS to 1
|
// If graphics board has program linking problems set MERGE_SHADERS to 1
|
||||||
// Merge shaders can be used to merge shaders strings into one shader.
|
// Merge shaders can be used to merge shaders strings into one shader.
|
||||||
#define MERGE_SHADERS 0
|
#define MERGE_SHADERS 0
|
||||||
#define NOTIFICATION_MESSAGES 0
|
#define NOTIFICATION_MESSAGES 0
|
||||||
|
|
||||||
namespace osgCandidate {
|
namespace osgCandidate {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask )
|
VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
VirtualProgram::VirtualProgram
|
VirtualProgram::VirtualProgram
|
||||||
( const VirtualProgram& VirtualProgram, const osg::CopyOp& copyop ):
|
( const VirtualProgram& vp, const osg::CopyOp& copyop ):
|
||||||
osg::Program( VirtualProgram, copyop ),
|
osg::Program( vp, copyop ),
|
||||||
_shaderMap( VirtualProgram._shaderMap ),
|
_shaderMap( vp._shaderMap ),
|
||||||
_mask( VirtualProgram._mask )
|
_mask( vp._mask )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -44,7 +44,7 @@ osg::Shader * VirtualProgram::getShader
|
|||||||
osg::Shader * VirtualProgram::setShader
|
osg::Shader * VirtualProgram::setShader
|
||||||
( const std::string & shaderSemantic, osg::Shader * shader )
|
( const std::string & shaderSemantic, osg::Shader * shader )
|
||||||
{
|
{
|
||||||
if( shader->getType() == osg::Shader::UNDEFINED )
|
if( shader->getType() == osg::Shader::UNDEFINED )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ShaderMap::key_type key( shaderSemantic, shader->getType() );
|
ShaderMap::key_type key( shaderSemantic, shader->getType() );
|
||||||
@ -52,8 +52,8 @@ osg::Shader * VirtualProgram::setShader
|
|||||||
ref_ptr< osg::Shader > shaderNew = shader;
|
ref_ptr< osg::Shader > shaderNew = shader;
|
||||||
ref_ptr< osg::Shader > & shaderCurrent = _shaderMap[ key ];
|
ref_ptr< osg::Shader > & shaderCurrent = _shaderMap[ key ];
|
||||||
|
|
||||||
#if 0 // Good for debugging of shader linking problems.
|
#if 0 // Good for debugging of shader linking problems.
|
||||||
// Don't do it - User could use the name for its own purposes
|
// Don't do it - User could use the name for its own purposes
|
||||||
shaderNew->setName( shaderSemantic );
|
shaderNew->setName( shaderSemantic );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -84,16 +84,16 @@ void VirtualProgram::apply( osg::State & state ) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ShaderMap shaderMap;
|
ShaderMap shaderMap;
|
||||||
for( State::AttributeVec::iterator i = av->begin(); i != av->end(); ++i )
|
for( State::AttributeVec::iterator ai = av->begin(); ai != av->end(); ++ai )
|
||||||
{
|
{
|
||||||
const osg::StateAttribute * sa = i->first;
|
const osg::StateAttribute * sa = ai->first;
|
||||||
const VirtualProgram * vp = dynamic_cast< const VirtualProgram *>( sa );
|
const VirtualProgram * vp = dynamic_cast< const VirtualProgram *>( sa );
|
||||||
if( vp && ( vp->_mask & _mask ) ) {
|
if( vp && ( vp->_mask & _mask ) ) {
|
||||||
|
|
||||||
#if NOTIFICATION_MESSAGES
|
#if NOTIFICATION_MESSAGES
|
||||||
if( vp->getName().empty() )
|
if( vp->getName().empty() )
|
||||||
os << "VirtualProgram cumulate [ Unnamed VP ] apply" << std::endl;
|
os << "VirtualProgram cumulate [ Unnamed VP ] apply" << std::endl;
|
||||||
else
|
else
|
||||||
os << "VirtualProgram cumulate ["<< vp->getName() << "] apply" << std::endl;
|
os << "VirtualProgram cumulate ["<< vp->getName() << "] apply" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ void VirtualProgram::apply( osg::State & state ) const
|
|||||||
std::string strFragment;
|
std::string strFragment;
|
||||||
std::string strVertex;
|
std::string strVertex;
|
||||||
std::string strGeometry;
|
std::string strGeometry;
|
||||||
|
|
||||||
for( ShaderList::iterator i = sl.begin(); i != sl.end(); ++i )
|
for( ShaderList::iterator i = sl.begin(); i != sl.end(); ++i )
|
||||||
{
|
{
|
||||||
if( i->get()->getType() == osg::Shader::FRAGMENT )
|
if( i->get()->getType() == osg::Shader::FRAGMENT )
|
||||||
|
@ -766,7 +766,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
if (!arguments.isOption(pos))
|
if (!arguments.isOption(pos))
|
||||||
{
|
{
|
||||||
std::string filename = arguments[pos];
|
filename = arguments[pos];
|
||||||
if (osgDB::getLowerCaseFileExtension(filename)=="dicom")
|
if (osgDB::getLowerCaseFileExtension(filename)=="dicom")
|
||||||
{
|
{
|
||||||
// not an option so assume string is a filename.
|
// not an option so assume string is a filename.
|
||||||
|
Loading…
Reference in New Issue
Block a user