#include <stdlib.h>#include <stdio.h>#include "OSGConfig.h"#include <iostream>#include "OSGVRMLFile.h"#include <OSGFieldType.h>#include <OSGSFSysTypes.h>#include <OSGMFSysTypes.h>#include <OSGSFBaseTypes.h>#include <OSGMFBaseTypes.h>#include <OSGSFMathTypes.h>#include <OSGMFMathTypes.h>#include <OSGSFVecTypes.h>#include <OSGMFVecTypes.h>#include <OSGMFFieldContainerTypes.h>#include <OSGSFFieldContainerTypes.h>#include <OSGImageFields.h>#include <OSGGeoProperty.h>#include <OSGTime.h>#include <OSGSimpleAttachments.h>#include <OSGChunkMaterial.h>#include <OSGMaterialChunk.h>#include <OSGMaterialGroup.h>#include <OSGTextureChunk.h>#include <OSGImage.h>#include <OSGSceneFileHandler.h>Go to the source code of this file.
Namespaces | |
| namespace | osg |
Defines | |
| #define | OSG_COMPILEVRMLLOADERINST |
Functions | |
| static Action::ResultE | modifyMaterial (NodePtr &node) |
Variables | |
| osg::Time | startTime = 0. |
| osg::Time | useTime = 0. |
| osg::Time | findTime = 0. |
| static Char8 | cvsid_cpp [] = "@(#)$Id: $" |
| static Char8 | cvsid_hpp [] = OSGVRMLFILE_HEADER_CVSID |
| #define OSG_COMPILEVRMLLOADERINST |
Definition at line 39 of file OSGVRMLFile.cpp.
| static Action::ResultE modifyMaterial | ( | NodePtr & | node | ) | [static] |
Definition at line 2767 of file OSGVRMLFile.cpp.
References osg::beginEditCP(), osg::ChunkMaterialBase::ChunksFieldMask, osg::Action::Continue, osg::AttachmentPtr::dcast(), osg::AttachmentContainerPtr::dcast(), osg::BlendChunkBase::DestFactorFieldMask, osg::MaterialChunkBase::DiffuseFieldMask, osg::endEditCP(), osg::TextureChunkBase::EnvModeFieldMask, osg::BlendChunkBase::getClassType(), osg::MaterialChunkBase::getClassType(), osg::TextureChunkBase::getClassType(), osg::NodePtr::getCore(), osg::NullFC, and osg::BlendChunkBase::SrcFactorFieldMask.
Referenced by osg::VRMLFile::getRoot().
02768 { 02769 MaterialGroupPtr mg = MaterialGroupPtr::dcast(node->getCore()); 02770 02771 if(mg == NullFC) 02772 return Action::Continue; 02773 02774 ChunkMaterialPtr cmat = ChunkMaterialPtr::dcast(mg->getMaterial()); 02775 02776 if(cmat == NullFC) 02777 return Action::Continue; 02778 02779 TextureChunkPtr texc = TextureChunkPtr::dcast(cmat->find(TextureChunk::getClassType())); 02780 02781 if(texc == NullFC) 02782 return Action::Continue; 02783 02784 MaterialChunkPtr matc = MaterialChunkPtr::dcast(cmat->find(MaterialChunk::getClassType())); 02785 02786 if(matc == NullFC) 02787 { 02788 // no material chunk so we use the replace mode. 02789 beginEditCP(texc, TextureChunk::EnvModeFieldMask); 02790 texc->setEnvMode(GL_REPLACE); 02791 endEditCP(texc, TextureChunk::EnvModeFieldMask); 02792 return Action::Continue; 02793 } 02794 02795 if(matc != NullFC) 02796 { 02797 ImagePtr img = texc->getImage(); 02798 02799 beginEditCP(texc, TextureChunk::EnvModeFieldMask); 02800 texc->setEnvMode(GL_MODULATE); 02801 endEditCP(texc, TextureChunk::EnvModeFieldMask); 02802 if(img != NullFC && img->getBpp() > 2) 02803 { 02804 // for color textures the texture replaces only the diffuse part. 02805 beginEditCP(matc, MaterialChunk::DiffuseFieldMask); 02806 matc->setDiffuse(Color4f(1.0f, 1.0f, 1.0f, 1.0f)); 02807 endEditCP(matc, MaterialChunk::DiffuseFieldMask); 02808 } 02809 02810 02811 // check for textures with alpha 02812 if(!matc->isTransparent() && img != NullFC && 02813 img->getBpp() == 4) 02814 { 02815 BlendChunkPtr blendc = BlendChunkPtr::dcast(cmat->find(BlendChunk::getClassType())); 02816 if(blendc == NullFC) 02817 { 02818 blendc = OSG::BlendChunk::create(); 02819 02820 beginEditCP(blendc, BlendChunk::SrcFactorFieldMask | 02821 BlendChunk::DestFactorFieldMask); 02822 blendc->setSrcFactor (GL_SRC_ALPHA); 02823 blendc->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); 02824 endEditCP(blendc, BlendChunk::SrcFactorFieldMask | 02825 BlendChunk::DestFactorFieldMask); 02826 02827 beginEditCP(cmat, ChunkMaterial::ChunksFieldMask); 02828 cmat->addChunk(blendc); 02829 endEditCP (cmat, ChunkMaterial::ChunksFieldMask); 02830 } 02831 } 02832 } 02833 02834 return Action::Continue; 02835 }
| osg ::Time startTime = 0. |
Definition at line 96 of file OSGVRMLFile.cpp.
Referenced by osg::GroupSockConnection::connectSocket(), osg::VRMLFile::createStandardPrototypes(), osg::VRMLFile::scanFile(), and osg::VRMLFile::scanStream().
| osg ::Time useTime = 0. |
Definition at line 97 of file OSGVRMLFile.cpp.
Referenced by osg::VRMLFile::scanFile(), osg::VRMLFile::scanStream(), and osg::VRMLFile::use().
| osg ::Time findTime = 0. |
Definition at line 98 of file OSGVRMLFile.cpp.
Char8 cvsid_cpp[] = "@(#)$Id: $" [static] |
Definition at line 3213 of file OSGVRMLFile.cpp.
Char8 cvsid_hpp[] = OSGVRMLFILE_HEADER_CVSID [static] |
Definition at line 3214 of file OSGVRMLFile.cpp.
1.5.5