interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/metaobjects/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 <http://www.interreality.org>
00022 */
00023 #ifndef _LIGHT_HH_
00024 #define _LIGHT_HH_
00025 
00026 
00027 #include "a3dldefs.hh"
00028 #include <vos/vos/vos.hh>
00029 
00030 #ifndef A3DL_EXPORTS
00031 IMPORT_METAOBJECT_FACTORIES(A3DL_Light)
00032 #endif
00033 
00034     /** @class Light light.hh vos/metaobjects/a3dl/light.hh
00035      *  @ingroup libmetaobject_a3dl
00036      *  An omnidirectional point light.
00037      */
00038 namespace A3DL
00039 {
00040     class A3DL_API Light : public VOS::MetaObject
00041     {
00042     public:
00043         Light(VOS::VobjectBase* superobject);
00044         virtual ~Light();
00045 
00046         /** Set position of this light.
00047             @param x X translation, relative to origin of parent object
00048             @param y Y translation, relative to origin of parent object
00049             @param z Z translation, relative to origin of parent object
00050             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00051         */
00052         virtual void setPosition(double x, double y, double z);
00053 
00054         /** Get position of this light.
00055             @param x X translation, relative to origin of parent object
00056             @param y Y translation, relative to origin of parent object
00057             @param z Z translation, relative to origin of parent object
00058             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00059         */
00060         virtual void getPosition(double& x, double& y, double& z);
00061 
00062         /** Set light radius.  Light falls off as a function of of the
00063             proportional distance between the center and radius
00064             distance.  You could also think of this (along with the
00065             intensity or saturation of the light's color) it as a
00066             brightness factor.
00067             @param r
00068             @throws NoSuchObjectError if "position" subobject does not exist, or is not a property.
00069         */
00070         virtual void setRadius(double r);
00071 
00072         /** Get light radius.  See setRadius() to see what this value means.
00073             @return the light radius
00074         */
00075         virtual double getRadius();
00076 
00077         /** Set the light's color.  Components are specified between 0
00078             (black) and 1 (full saturation).
00079             @param r the red component
00080             @param g the green component
00081             @param b the blue component
00082         */
00083         virtual void setColor(float r, float g, float b);
00084 
00085         /** Get the light's color.  See setColor() for details.
00086             @param r the red component
00087             @param g the green component
00088             @param b the blue component
00089          */
00090         virtual void getColor(float& r, float& g, float& b);
00091 
00092         /** Set light's "static" property. Should only be set once, at creation.  */
00093         virtual void setStatic(bool is_static);
00094 
00095         /** Get light's "static" property. */
00096         virtual bool getStatic();
00097 
00098         virtual VUtil::vRef<VOS::Property> getPositionObj();
00099         virtual VUtil::vRef<VOS::Property> getRadiusObj();
00100         virtual VUtil::vRef<VOS::Property> getColorObj();
00101 
00102         /** Initialize subproperties:
00103          * position=(0,0,0), radius=1, color=(1,1,1).
00104          */
00105         virtual void doInitialize();
00106 
00107         virtual const std::string getVOSType();
00108         static VOS::MetaObject* new_Light(VOS::VobjectBase* superobject, const std::string& type);
00109     };
00110 }
00111 
00112 #endif