PhotonMapBehaviour.h

Go to the documentation of this file.
00001 /* $Id:$ */
00002 
00003 #ifndef __PHOTON_MAP_BEHAVIOUR_H
00004 #define __PHOTON_MAP_BEHAVIOUR_H
00005 
00006 #include <esg/SGAttribute.h>
00007 
00014 namespace esg {
00015 
00016 class OGSCENE_EXPORT PhotonMapBehaviour : public SGAttribute {
00017     public:
00018         enum Behaviour {
00019             NOTHING = 0,
00020             MAKE_CAUSTICS,
00021             ACCEPT_CAUSTICS,
00022             ACCEPT_GLOBAL_PHOTONS
00023         };
00024 
00025     protected:
00026         int _behaviour;
00027     
00028     protected:
00029         virtual void _duplicate_attributes (const SGAttribute& src) {
00030             SGAttribute::_duplicate_attributes(src);
00031             _behaviour = ((PhotonMapBehaviour&)src)._behaviour;
00032         }
00033 
00034         PhotonMapBehaviour () {}
00035   
00036     public:
00040         PhotonMapBehaviour(int b) : _behaviour(b) {}
00041 
00045         virtual void acceptVisitor (Visitor& visitor) {
00046             visitor.visitPhotonMapBehaviour(this);
00047         }
00048 
00052         virtual SGAttribute* clone () const {
00053             PhotonMapBehaviour* pRet = new PhotonMapBehaviour;
00054             pRet->_duplicate_attributes(*this);
00055             return pRet;
00056         }
00057 
00063         void addBehaviour(int b) { _behaviour |= b; }
00064 
00070         void setBehaviour(int b) { _behaviour = b; }
00071 
00075         void setMakeCaustic(void) {_behaviour |= MAKE_CAUSTICS; }
00076 
00080         void setAcceptCaustics(void) {_behaviour |= ACCEPT_CAUSTICS; }
00081 
00085         void setAcceptGlobalPhotons(void) {
00086             _behaviour |= ACCEPT_GLOBAL_PHOTONS;
00087         }
00088 
00094         void unsetBehaviour(int b) { _behaviour &= ~b; }
00095 
00099         void unsetMakeCaustic(void) {_behaviour &= ~MAKE_CAUSTICS; }
00100 
00104         void unsetAcceptCaustics(void) { _behaviour &= ~ACCEPT_CAUSTICS; }
00105 
00109         void unsetAcceptGlobalPhotons(void) {
00110             _behaviour &= ~ACCEPT_GLOBAL_PHOTONS;
00111         }
00112 
00116         int  getBehaviour(void) const { return _behaviour; }
00117 
00121         bool acceptsGlobalPhotons(void) const {
00122             return (_behaviour & ACCEPT_GLOBAL_PHOTONS);
00123         }
00124 
00128         bool acceptsCaustics(void) const {
00129             return (_behaviour & ACCEPT_CAUSTICS);
00130         }
00131 
00135         bool makesCaustics (void) const {
00136             return (_behaviour & MAKE_CAUSTICS);
00137         }
00138 };
00139     
00140 }; // namespace
00141 
00142 #endif // __PHOTON_MAP_BEHAVIOUR_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6