Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/3D/a3dl/light.hh

Go to the documentation of this file.
00001 /*
00002     This file is part of the Virtual Object System of
00003     the Interreality project (http://interreality.org).
00004 
00005     Copyright (C) 2001, 2002 Peter Amstutz
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 
00021     Peter Amstutz <tetron@interreality.org>
00022 */
00023 #ifndef _LIGHT_HH_
00024 #define _LIGHT_HH_
00025 
00026 #if defined(_WIN32) && defined(_MSC_VER)
00027 # ifdef A3DL_EXPORTS
00028 #  define A3DL_API __declspec(dllexport)
00029 # else
00030 #  define A3DL_API __declspec(dllimport)
00031 # endif
00032 #else
00033 # define A3DL_API
00034 #endif
00035 
00036 #include <vos/corelibs/vos/vos.hh>
00037 #include <vos/metaobjects/property/property.hh>
00038 
00039 namespace A3DL 
00040 {
00041     class A3DL_API Light : public virtual MetaObject
00042     {
00043     protected:
00044         PropertyAccessControl* accesscontrol;
00045     public:
00046         Light(MetaObject* superobject);
00047         virtual ~Light();
00048 
00049         void setPropertyAccessControl(PropertyAccessControl* pac) { accesscontrol = pac; }
00050         PropertyAccessControl* getPropertyAccessControl(){ return accesscontrol; }
00051 
00052         /** Set position of this light.
00053             @param x X translation, relative to origin of parent object
00054             @param y Y translation, relative to origin of parent object
00055             @param z Z translation, relative to origin of parent object
00056             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00057         */
00058         virtual void setPosition(double x, double y, double z) throw(NoSuchObjectError);
00059 
00060         /** Get position of this light.
00061             @param x X translation, relative to origin of parent object
00062             @param y Y translation, relative to origin of parent object
00063             @param z Z translation, relative to origin of parent object
00064             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00065         */
00066         virtual void getPosition(double& x, double& y, double& z) throw(NoSuchObjectError);
00067 
00068         /** Set light radius.  Light falls off as a function of of the
00069             proportional distance between the center and radius
00070             distance.  You could also think of this (along with the
00071             intensity or saturation of the light's color) it as a
00072             brightness factor.
00073             @param r 
00074             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00075         */
00076         virtual void setRadius(double r) throw(NoSuchObjectError);
00077 
00078         /** Get light radius.  See setRadius() to see what this value means.
00079             @return the light radius
00080         */
00081         virtual double getRadius() throw(NoSuchObjectError);
00082 
00083         /** Set the light's color.  Components are specified between 0
00084             (black) and 1 (full saturation).
00085             @param r the red component
00086             @param g the green component
00087             @param b the blue component
00088         */
00089         virtual void setColor(double r, double g, double b) throw(NoSuchObjectError);
00090         /** Get the light's color.  See setColor() for details.
00091             @param r the red component
00092             @param g the green component
00093             @param b the blue component
00094          */
00095         virtual void getColor(double& r, double& g, double& b) throw(NoSuchObjectError);
00096 
00097         /** Set light's "static" property. Should only be set once, at creation.  */
00098         virtual void setStatic(bool is_static) throw(NoSuchObjectError);
00099 
00100         /** Get light's "static" property. */
00101         virtual bool getStatic() throw(NoSuchObjectError) ;
00102 
00103         /** Initialize subproperties: 
00104          * position=(0,0,0), radius=1, color=(1,1,1).
00105          * @param is_static If true, this will be a static light, and the
00106          * properties cannot be changed. (Allows optimizations by rendering
00107          * agent). Default is false.
00108          * @param access    Access control object for subproperties. Default is
00109          * none.
00110          * @warning sets <i>No</i> access control by default!
00111          */
00112         virtual void initialize(bool is_static, PropertyAccessControl* access =
00113 NULL);
00114 
00115         virtual void initialize() {
00116             initialize(false, NULL);
00117         }
00118 
00119         virtual const string getType();
00120         static void registerExtenders();
00121         static MetaObject* new_Light(MetaObject* superobject, const string& type);  
00122     };
00123 }
00124 
00125 #endif

Generated on Tue Aug 12 03:55:36 2003 for Interreality Project - VOS by doxygen 1.3.2