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 dy = (float(r) - mid)*div;
|
||||
float r = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
|
||||
if (r < 0.0f) r = 0.0f;
|
||||
osg::Vec4 color = centerColour*r + backgroudColour*(1.0f - r);
|
||||
float pr = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
|
||||
if (pr < 0.0f) pr = 0.0f;
|
||||
osg::Vec4 color = centerColour*pr + backgroudColour*(1.0f - pr);
|
||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||
*ptr++ = (unsigned char)((color[2])*255.0f);
|
||||
|
@ -108,7 +108,7 @@ typedef vector<BufferConfig> BufferConfigList;
|
||||
|
||||
vector<FboConfig> validConfigs;
|
||||
// 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
|
||||
// to find valid ones.
|
||||
@ -406,10 +406,10 @@ AppState::AppState(osgViewer::Viewer* viewer_)
|
||||
|
||||
void AppState::setStateFromConfig(const FboConfig& config)
|
||||
{
|
||||
Camera* camera = viewer->getSlave(0)._camera.get();
|
||||
setAttachmentsFromConfig(camera, config);
|
||||
Camera* cam = viewer->getSlave(0)._camera.get();
|
||||
setAttachmentsFromConfig(cam, config);
|
||||
osgViewer::Renderer* renderer
|
||||
= dynamic_cast<osgViewer::Renderer*>(camera->getRenderer());
|
||||
= dynamic_cast<osgViewer::Renderer*>(cam->getRenderer());
|
||||
if (renderer)
|
||||
renderer->setCameraRequiresSetUp(true);
|
||||
if (configText.valid())
|
||||
@ -954,8 +954,8 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
gc->setResizedCallback(new ResizedCallback(appState.get()));
|
||||
const GraphicsContext::Traits* traits = gc->getTraits();
|
||||
width = traits->width;
|
||||
height = traits->height;
|
||||
int width = traits->width;
|
||||
int height = traits->height;
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
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);
|
||||
if (loadedModel.valid()) group->addChild(loadedModel);
|
||||
|
||||
for(Tracks::iterator itr = tracks.begin();
|
||||
itr != tracks.end();
|
||||
++itr)
|
||||
for(Tracks::iterator titr = tracks.begin();
|
||||
titr != tracks.end();
|
||||
++titr)
|
||||
{
|
||||
Track* track = itr->get();
|
||||
Track* track = titr->get();
|
||||
|
||||
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;
|
||||
|
||||
for(Tracks::iterator itr = tracks.begin();
|
||||
itr != tracks.end();
|
||||
++itr)
|
||||
for(Tracks::iterator titr = tracks.begin();
|
||||
titr != tracks.end();
|
||||
++titr)
|
||||
{
|
||||
Track* track = itr->get();
|
||||
Track* track = titr->get();
|
||||
|
||||
fout<<"<trk>"<<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));
|
||||
|
||||
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
//stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
|
||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
osg::StateSet* ss = geom->getOrCreateStateSet();
|
||||
ss->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
//ss->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
|
||||
ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
|
||||
geode->addDrawable(geom);
|
||||
}
|
||||
|
@ -411,8 +411,8 @@ void DepthPeeling::createPeeling()
|
||||
_compositeCamera->setViewMatrix(osg::Matrix());
|
||||
_compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
|
||||
_compositeCamera->setCullCallback(new CullCallback(0, 0));
|
||||
osg::StateSet* stateSet = _compositeCamera->getOrCreateStateSet();
|
||||
stateSet->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||
osg::StateSet* ss = _compositeCamera->getOrCreateStateSet();
|
||||
ss->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||
_root->addChild(_compositeCamera.get());
|
||||
|
||||
// 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 dy = (float(r) - mid)*div;
|
||||
float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||
if (r<0.0f) r=0.0f;
|
||||
osg::Vec4 color = centerColour*r+backgroundColour*(1.0f-r);
|
||||
float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||
if (pr<0.0f) r=0.0f;
|
||||
osg::Vec4 color = centerColour*pr+backgroundColour*(1.0f-pr);
|
||||
// color.set(1.0f,1.0f,1.0f,0.5f);
|
||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||
|
@ -371,19 +371,19 @@ int main( int argc, char** argv )
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Camera* camera = viewer.getCamera();
|
||||
if ( !useLatLongHeight ) computeViewMatrix( camera, eye, hpr );
|
||||
else computeViewMatrixOnEarth( camera, scene.get(), latLongHeight, hpr );
|
||||
osg::Camera* viewer_camera = viewer.getCamera();
|
||||
if ( !useLatLongHeight ) computeViewMatrix( viewer_camera, eye, hpr );
|
||||
else computeViewMatrixOnEarth( viewer_camera, scene.get(), latLongHeight, hpr );
|
||||
|
||||
osg::ref_ptr<CustomRenderer> renderer = new CustomRenderer( camera );
|
||||
camera->setRenderer( renderer.get() );
|
||||
osg::ref_ptr<CustomRenderer> renderer = new CustomRenderer( viewer_camera );
|
||||
viewer_camera->setRenderer( renderer.get() );
|
||||
viewer.setThreadingModel( osgViewer::Viewer::SingleThreaded );
|
||||
|
||||
// Realize and initiate the first PagedLOD request
|
||||
viewer.realize();
|
||||
viewer.frame();
|
||||
|
||||
printer->init( camera );
|
||||
printer->init( viewer_camera );
|
||||
while ( !printer->done() )
|
||||
{
|
||||
viewer.advance();
|
||||
|
@ -1108,7 +1108,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (fov!=0.0)
|
||||
{
|
||||
double fovy, aspectRatio, zNear, zFar;
|
||||
double fovy, aspectRatio;
|
||||
viewer.getCamera()->getProjectionMatrix().getPerspective(fovy, aspectRatio, zNear, zFar);
|
||||
|
||||
std::cout << "Setting FOV to " << fov << std::endl;
|
||||
@ -1144,8 +1144,6 @@ int main(int argc, char** argv)
|
||||
while (!viewer.done())
|
||||
{
|
||||
{
|
||||
osgShadow::MinimalShadowMap * msm = dynamic_cast<osgShadow::MinimalShadowMap*>( shadowedScene->getShadowTechnique() );
|
||||
|
||||
if( msm ) {
|
||||
|
||||
// If scene decorated by CoordinateSystemNode try to find localToWorld
|
||||
@ -1198,8 +1196,6 @@ int main(int argc, char** argv)
|
||||
char filename[256];
|
||||
std::sprintf( filename, "shadowDump%d.osgt", dumpFileNo );
|
||||
|
||||
osgShadow::MinimalShadowMap * msm = dynamic_cast<osgShadow::MinimalShadowMap*>( shadowedScene->getShadowTechnique() );
|
||||
|
||||
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 dy = (float(r) - mid)*div;
|
||||
float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||
if (r<0.0f) r=0.0f;
|
||||
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-r);
|
||||
float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
|
||||
if (pr<0.0f) pr=0.0f;
|
||||
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-pr);
|
||||
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||
*ptr++ = (unsigned char)((color[2])*255.0f);
|
||||
|
@ -55,8 +55,6 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::GraphicsThread> > GraphicsThreads;
|
||||
|
||||
struct ReleaseBlockOnCompileCompleted : public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
||||
{
|
||||
|
||||
|
@ -11,21 +11,21 @@
|
||||
using namespace osg;
|
||||
|
||||
// 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 NOTIFICATION_MESSAGES 0
|
||||
|
||||
namespace osgCandidate {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask )
|
||||
VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask )
|
||||
{
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
VirtualProgram::VirtualProgram
|
||||
( const VirtualProgram& VirtualProgram, const osg::CopyOp& copyop ):
|
||||
osg::Program( VirtualProgram, copyop ),
|
||||
_shaderMap( VirtualProgram._shaderMap ),
|
||||
_mask( VirtualProgram._mask )
|
||||
( const VirtualProgram& vp, const osg::CopyOp& copyop ):
|
||||
osg::Program( vp, copyop ),
|
||||
_shaderMap( vp._shaderMap ),
|
||||
_mask( vp._mask )
|
||||
{
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +44,7 @@ osg::Shader * VirtualProgram::getShader
|
||||
osg::Shader * VirtualProgram::setShader
|
||||
( const std::string & shaderSemantic, osg::Shader * shader )
|
||||
{
|
||||
if( shader->getType() == osg::Shader::UNDEFINED )
|
||||
if( shader->getType() == osg::Shader::UNDEFINED )
|
||||
return NULL;
|
||||
|
||||
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 > & shaderCurrent = _shaderMap[ key ];
|
||||
|
||||
#if 0 // Good for debugging of shader linking problems.
|
||||
// Don't do it - User could use the name for its own purposes
|
||||
#if 0 // Good for debugging of shader linking problems.
|
||||
// Don't do it - User could use the name for its own purposes
|
||||
shaderNew->setName( shaderSemantic );
|
||||
#endif
|
||||
|
||||
@ -84,16 +84,16 @@ void VirtualProgram::apply( osg::State & state ) const
|
||||
#endif
|
||||
|
||||
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 );
|
||||
if( vp && ( vp->_mask & _mask ) ) {
|
||||
|
||||
#if NOTIFICATION_MESSAGES
|
||||
if( vp->getName().empty() )
|
||||
os << "VirtualProgram cumulate [ Unnamed VP ] apply" << std::endl;
|
||||
else
|
||||
else
|
||||
os << "VirtualProgram cumulate ["<< vp->getName() << "] apply" << std::endl;
|
||||
#endif
|
||||
|
||||
@ -136,7 +136,7 @@ void VirtualProgram::apply( osg::State & state ) const
|
||||
std::string strFragment;
|
||||
std::string strVertex;
|
||||
std::string strGeometry;
|
||||
|
||||
|
||||
for( ShaderList::iterator i = sl.begin(); i != sl.end(); ++i )
|
||||
{
|
||||
if( i->get()->getType() == osg::Shader::FRAGMENT )
|
||||
|
@ -766,7 +766,7 @@ int main( int argc, char **argv )
|
||||
{
|
||||
if (!arguments.isOption(pos))
|
||||
{
|
||||
std::string filename = arguments[pos];
|
||||
filename = arguments[pos];
|
||||
if (osgDB::getLowerCaseFileExtension(filename)=="dicom")
|
||||
{
|
||||
// not an option so assume string is a filename.
|
||||
|
Loading…
Reference in New Issue
Block a user