00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 #ifndef _OSGLIGHT_H_ 00041 #define _OSGLIGHT_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 #include <OSGConfig.h> 00047 #include <OSGLightBase.h> 00048 #include <OSGNodePtr.h> 00049 #include <OSGAction.h> 00050 #include <OSGLightChunk.h> 00051 00052 OSG_BEGIN_NAMESPACE 00053 00058 class OSG_SYSTEMLIB_DLLMAPPING Light : public LightBase 00059 { 00060 /*========================== PUBLIC =================================*/ 00061 public: 00062 00063 /*---------------------------------------------------------------------*/ 00067 void setAmbient ( Real32 rRed, 00068 Real32 rGreen, 00069 Real32 rBlue, 00070 Real32 rAlpha); 00071 void setDiffuse ( Real32 rRed, 00072 Real32 rGreen, 00073 Real32 rBlue, 00074 Real32 rAlpha); 00075 void setSpecular( Real32 rRed, 00076 Real32 rGreen, 00077 Real32 rBlue, 00078 Real32 rAlpha); 00079 00080 void setAmbient (const Color4f &col); 00081 void setDiffuse (const Color4f &col); 00082 void setSpecular(const Color4f &col); 00083 00085 /*---------------------------------------------------------------------*/ 00089 LightChunkPtr getChunk (void); 00090 virtual void makeChunk(void); 00091 00093 /*---------------------------------------------------------------------*/ 00097 virtual void changed(BitVector whichField, 00098 UInt32 origin ); 00099 00101 /*---------------------------------------------------------------------*/ 00105 virtual void dump( UInt32 uiIndent = 0, 00106 const BitVector bvFlags = 0) const; 00107 00109 /*========================= PROTECTED ===============================*/ 00110 protected: 00111 00112 typedef LightBase Inherited; 00113 00114 LightChunkPtr _pChunk; 00115 00116 /*---------------------------------------------------------------------*/ 00120 Light(void); 00121 Light(const Light &source); 00122 00124 /*---------------------------------------------------------------------*/ 00128 virtual ~Light(void); 00129 00131 /*---------------------------------------------------------------------*/ 00135 // Draw action: execute the OpenGL commands to set the light's parameters. 00136 Action::ResultE drawEnter (Action *action); 00137 Action::ResultE drawLeave (Action *action); 00138 00139 // generate draw tree 00140 Action::ResultE renderEnter(Action *action); 00141 Action::ResultE renderLeave(Action *action); 00142 00144 /*========================== PRIVATE ================================*/ 00145 private: 00146 00147 friend class FieldContainer; 00148 friend class LightBase; 00149 00150 static void initMethod( void ); 00151 00153 void operator =(const Light &source); 00154 }; 00155 00156 OSG_END_NAMESPACE 00157 00158 #include <OSGLightBase.inl> 00159 #include <OSGLight.inl> 00160 00161 #define OSGLIGHT_HEADER_CVSID "@(#)$Id: $" 00162 00163 #endif /* _OSGLIGHT_H_ */
1.4.3