#include <OSGPhongMaterial.h>
Inheritance diagram for osg::PhongMaterial:

Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| virtual StatePtr | makeState (void) |
| virtual void | rebuildState (void) |
| virtual bool | isTransparent (void) const |
| static ChunkMaterialPtr | createChunkMaterial (void) |
Rendering | |
| StatePtr | getState (void) |
| *typedef TypedFunctor1Base< Action::ResultE, PtrCallArg< DrawActionBase > > | DrawFunctor |
Public Types | |
| typedef PhongMaterialPtr | Ptr |
| enum | { AmbientFieldId = Inherited::NextFieldId, DiffuseFieldId = AmbientFieldId + 1, SpecularFieldId = DiffuseFieldId + 1, ShininessFieldId = SpecularFieldId + 1, EmissionFieldId = ShininessFieldId + 1, TransparencyFieldId = EmissionFieldId + 1, LitFieldId = TransparencyFieldId + 1, ColorMaterialFieldId = LitFieldId + 1, NextFieldId = ColorMaterialFieldId + 1 } |
Public Member Functions | |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Field Get | |
| *SFColor3f * | getSFAmbient (void) |
| Get the PhongMaterial::_sfAmbient field. | |
| SFColor3f * | getSFDiffuse (void) |
| Get the PhongMaterial::_sfDiffuse field. | |
| SFColor3f * | getSFSpecular (void) |
| Get the PhongMaterial::_sfSpecular field. | |
| SFReal32 * | getSFShininess (void) |
| Get the PhongMaterial::_sfShininess field. | |
| SFColor3f * | getSFEmission (void) |
| Get the PhongMaterial::_sfEmission field. | |
| SFReal32 * | getSFTransparency (void) |
| Get the PhongMaterial::_sfTransparency field. | |
| SFBool * | getSFLit (void) |
| Get the PhongMaterial::_sfLit field. | |
| SFGLenum * | getSFColorMaterial (void) |
| Get the PhongMaterial::_sfColorMaterial field. | |
| Color3f & | getAmbient (void) |
| Get the value of the PhongMaterial::_sfAmbient field. | |
| const Color3f & | getAmbient (void) const |
| Get the value of the PhongMaterial::_sfAmbient field. | |
| Color3f & | getDiffuse (void) |
| Get the value of the PhongMaterial::_sfDiffuse field. | |
| const Color3f & | getDiffuse (void) const |
| Get the value of the PhongMaterial::_sfDiffuse field. | |
| Color3f & | getSpecular (void) |
| Get the value of the PhongMaterial::_sfSpecular field. | |
| const Color3f & | getSpecular (void) const |
| Get the value of the PhongMaterial::_sfSpecular field. | |
| Real32 & | getShininess (void) |
| Get the value of the PhongMaterial::_sfShininess field. | |
| const Real32 & | getShininess (void) const |
| Get the value of the PhongMaterial::_sfShininess field. | |
| Color3f & | getEmission (void) |
| Get the value of the PhongMaterial::_sfEmission field. | |
| const Color3f & | getEmission (void) const |
| Get the value of the PhongMaterial::_sfEmission field. | |
| Real32 & | getTransparency (void) |
| Get the value of the PhongMaterial::_sfTransparency field. | |
| const Real32 & | getTransparency (void) const |
| Get the value of the PhongMaterial::_sfTransparency field. | |
| bool & | getLit (void) |
| Get the value of the PhongMaterial::_sfLit field. | |
| const bool & | getLit (void) const |
| Get the value of the PhongMaterial::_sfLit field. | |
| GLenum & | getColorMaterial (void) |
| Get the value of the PhongMaterial::_sfColorMaterial field. | |
| const GLenum & | getColorMaterial (void) const |
| Get the value of the PhongMaterial::_sfColorMaterial field. | |
Field Set | |
| *void | setAmbient (const Color3f &value) |
| Set the value of the PhongMaterial::_sfAmbient field. | |
| void | setDiffuse (const Color3f &value) |
| Set the value of the PhongMaterial::_sfDiffuse field. | |
| void | setSpecular (const Color3f &value) |
| Set the value of the PhongMaterial::_sfSpecular field. | |
| void | setShininess (const Real32 &value) |
| Set the value of the PhongMaterial::_sfShininess field. | |
| void | setEmission (const Color3f &value) |
| Set the value of the PhongMaterial::_sfEmission field. | |
| void | setTransparency (const Real32 &value) |
| Set the value of the PhongMaterial::_sfTransparency field. | |
| void | setLit (const bool &value) |
| Set the value of the PhongMaterial::_sfLit field. | |
| void | setColorMaterial (const GLenum &value) |
| Set the value of the PhongMaterial::_sfColorMaterial field. | |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
Copy | |
| *virtual FieldContainerPtr | shallowCopy (void) const |
Rendering | |
| *virtual void | draw (DrawFunctor &func, DrawActionBase *action) |
| virtual void | draw (Geometry *geo, DrawActionBase *action) |
Access | |
| *bool | addChunk (StateChunkPtr chunk, Int32 slot=State::AutoSlotReplace) |
| bool | subChunk (StateChunkPtr chunk, Int32 slot=State::AutoSlotReplace) |
| Int32 | find (StateChunkPtr chunk) |
| StateChunkPtr | find (const FieldContainerType &type, Int32 slot=State::AutoSlotReplace) |
| virtual bool | operator== (const Material &other) |
Comparison | |
| virtual bool | operator== (const Material &other) const |
| *virtual bool | operator< (const Material &other) const |
| virtual bool | operator!= (const Material &other) const |
Field Get | |
| *MFStateChunkPtr * | getMFChunks (void) |
| Get the ChunkMaterial::_mfChunks field. | |
| MFInt32 * | getMFSlots (void) |
| Get the ChunkMaterial::_mfSlots field. | |
| StateChunkPtr & | getChunks (const UInt32 index) |
| Get the value of the index element the ChunkMaterial::_mfChunks field. | |
| MFStateChunkPtr & | getChunks (void) |
| Get the ChunkMaterial::_mfChunks field. | |
| const MFStateChunkPtr & | getChunks (void) const |
| Get the ChunkMaterial::_mfChunks field. | |
| Int32 & | getSlots (const UInt32 index) |
| Get the value of the index element the ChunkMaterial::_mfSlots field. | |
| MFInt32 & | getSlots (void) |
| Get the ChunkMaterial::_mfSlots field. | |
| const MFInt32 & | getSlots (void) const |
| Get the ChunkMaterial::_mfSlots field. | |
Field Get | |
| *SFInt32 * | getSFSortKey (void) |
| Get the Material::_sfSortKey field. | |
| Int32 & | getSortKey (void) |
| Get the value of the Material::_sfSortKey field. | |
| const Int32 & | getSortKey (void) const |
| Get the value of the Material::_sfSortKey field. | |
Field Set | |
| *void | setSortKey (const Int32 &value) |
| Set the value of the Material::_sfSortKey field. | |
Static Public Member Functions | |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Construction | |
| *static PhongMaterialPtr | create (void) |
| create a new instance of the class | |
| static PhongMaterialPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Class Get | |
| *static const char * | getClassname (void) |
Static Public Attributes | |
| static const osg::BitVector | AmbientFieldMask |
| static const osg::BitVector | DiffuseFieldMask |
| static const osg::BitVector | SpecularFieldMask |
| static const osg::BitVector | ShininessFieldMask |
| static const osg::BitVector | EmissionFieldMask |
| static const osg::BitVector | TransparencyFieldMask |
| static const osg::BitVector | LitFieldMask |
| static const osg::BitVector | ColorMaterialFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const osg::BitVector | ChunksFieldMask |
| static const osg::BitVector | SlotsFieldMask |
| static const osg::BitVector | SortKeyFieldMask |
| static const BitVector | AttachmentsFieldMask |
| static const BitVector | NextFieldMask |
Constants | |
| *static const Int32 | NoStateSorting = 0x7fffffff |
Protected Member Functions | |
Constructors | |
| * | PhongMaterial (void) |
| PhongMaterial (const PhongMaterial &source) | |
Destructors | |
| *virtual | ~PhongMaterial (void) |
Sync | |
| *void | executeSyncImpl (PhongMaterialBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (ChunkMaterialBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (MaterialBase *pOther, const BitVector &whichField) |
Protected Attributes | |
| StatePtr | _pState |
Fields | |
| *SFColor3f | _sfAmbient |
| SFColor3f | _sfDiffuse |
| SFColor3f | _sfSpecular |
| SFReal32 | _sfShininess |
| SFColor3f | _sfEmission |
| SFReal32 | _sfTransparency |
| SFBool | _sfLit |
| SFGLenum | _sfColorMaterial |
Fields | |
| *MFStateChunkPtr | _mfChunks |
| MFInt32 | _mfSlots |
Fields | |
| *SFInt32 | _sfSortKey |
Private Types | |
| typedef PhongMaterialBase | Inherited |
Private Member Functions | |
| void | prepareLocalChunks (void) |
| void | createFragmentProgram (void) |
| void | operator= (const PhongMaterial &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
Private Attributes | |
| MaterialChunkPtr | _materialChunk |
| BlendChunkPtr | _blendChunk |
| VertexProgramChunkPtr | _vpChunk |
| FragmentProgramChunkPtr | _fpChunk |
Static Private Attributes | |
| static UInt32 | _arbFragmentProgram |
Friends | |
| class | FieldContainer |
| class | PhongMaterialBase |
Definition at line 59 of file OSGPhongMaterial.h.
|
|
Reimplemented from osg::PhongMaterialBase. Definition at line 63 of file OSGPhongMaterial.h. |
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 97 of file OSGPhongMaterialBase.h. |
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 99 of file OSGPhongMaterialBase.h. 00100 { 00101 AmbientFieldId = Inherited::NextFieldId, 00102 DiffuseFieldId = AmbientFieldId + 1, 00103 SpecularFieldId = DiffuseFieldId + 1, 00104 ShininessFieldId = SpecularFieldId + 1, 00105 EmissionFieldId = ShininessFieldId + 1, 00106 TransparencyFieldId = EmissionFieldId + 1, 00107 LitFieldId = TransparencyFieldId + 1, 00108 ColorMaterialFieldId = LitFieldId + 1, 00109 NextFieldId = ColorMaterialFieldId + 1 00110 };
|
|
|
Definition at line 189 of file OSGPhongMaterial.cpp. 00189 : 00190 Inherited(), 00191 _materialChunk(NullFC), 00192 _blendChunk(NullFC), 00193 _vpChunk(NullFC), 00194 _fpChunk(NullFC) 00195 { 00196 }
|
|
|
Definition at line 198 of file OSGPhongMaterial.cpp. References _arbFragmentProgram, and osg::Window::registerExtension(). 00198 : 00199 Inherited(source), 00200 _materialChunk(source._materialChunk), 00201 _blendChunk(source._blendChunk), 00202 _vpChunk(source._vpChunk), 00203 _fpChunk(source._fpChunk) 00204 { 00205 _arbFragmentProgram = Window::registerExtension("GL_ARB_fragment_program"); 00206 }
|
|
|
Definition at line 208 of file OSGPhongMaterial.cpp. References _blendChunk, _fpChunk, _materialChunk, _vpChunk, and osg::subRefCP(). 00209 { 00210 subRefCP(_materialChunk); 00211 subRefCP(_blendChunk); 00212 subRefCP(_vpChunk); 00213 subRefCP(_fpChunk); 00214 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterial. Definition at line 276 of file OSGPhongMaterial.cpp. References osg::ChunkMaterial::changed(). 00277 { 00278 Inherited::changed(whichField, origin); 00279 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterial. Definition at line 281 of file OSGPhongMaterial.cpp. References SLOG. 00283 { 00284 SLOG << "Dump PhongMaterial NI" << std::endl; 00285 }
|
|
|
|
|
Check if the Material (i.e. any of its chunks) is transparent.. Reimplemented from osg::ChunkMaterial. Definition at line 406 of file OSGPhongMaterial.cpp. References osg::Eps, osg::PhongMaterialBase::getTransparency(), and osg::ChunkMaterial::isTransparent(). Referenced by makeState(), and rebuildState(). 00407 { 00408 return ((getTransparency() > Eps) || (Inherited::isTransparent())); 00409 }
|
|
|
Definition at line 411 of file OSGPhongMaterial.cpp. References _arbFragmentProgram, _phong_fp_begin_prg, _phong_fp_end_prg, _phong_vp_prg, osg::beginEditCP(), osg::ChunkMaterialBase::ChunksFieldMask, osg::FragmentProgramChunkBase::create(), osg::VertexProgramChunkBase::create(), osg::MaterialChunkBase::create(), osg::ChunkMaterialBase::create(), osg::endEditCP(), osg::Window::hasCommonExtension(), and osg::Window::registerExtension(). 00412 { 00413 _arbFragmentProgram = Window::registerExtension("GL_ARB_fragment_program"); 00414 00415 ChunkMaterialPtr cmat = ChunkMaterial::create(); 00416 00417 MaterialChunkPtr matc = MaterialChunk::create(); 00418 beginEditCP(matc); 00419 matc->setAmbient(Color4f(0.1, 0.1, 0.2, 1.0)); 00420 matc->setDiffuse(Color4f(0.2, 0.2, 0.8, 1.0)); 00421 matc->setSpecular(Color4f(0.8, 0.8, 0.8, 1.0)); 00422 matc->setShininess(100); 00423 endEditCP(matc); 00424 00425 beginEditCP(cmat, ChunksFieldMask); 00426 cmat->addChunk(matc); 00427 endEditCP(cmat, ChunksFieldMask); 00428 00429 // phong shading without a fragment shader looks quite black ;-) 00430 // all cards with a fragment shader should also have a vertex shader. 00431 if(Window::hasCommonExtension(_arbFragmentProgram)) 00432 { 00433 VertexProgramChunkPtr vpc = VertexProgramChunk::create(); 00434 beginEditCP(vpc); 00435 vpc->setProgram(_phong_vp_prg); 00436 endEditCP(vpc); 00437 00438 FragmentProgramChunkPtr fpc = FragmentProgramChunk::create(); 00439 std::string phong_fp_prg = _phong_fp_begin_prg + _phong_fp_end_prg; 00440 beginEditCP(fpc); 00441 fpc->setProgram(phong_fp_prg); 00442 endEditCP(fpc); 00443 00444 beginEditCP(cmat, ChunksFieldMask); 00445 cmat->addChunk(vpc); 00446 cmat->addChunk(fpc); 00447 endEditCP(cmat, ChunksFieldMask); 00448 } 00449 return cmat; 00450 }
|
|
|
|
|
Reimplemented from osg::ChunkMaterial. Definition at line 174 of file OSGPhongMaterial.cpp.
|
|
|
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 58 of file OSGPhongMaterialBase.inl. References osg::PhongMaterialBase::_type. Referenced by osg::PhongMaterialBase::create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 65 of file OSGPhongMaterialBase.inl. References osg::PhongMaterialBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 184 of file OSGPhongMaterialBase.cpp. References osg::PhongMaterialBase::_type. 00185 { 00186 return _type; 00187 }
|
|