Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

light_c.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: light_c.cpp,v 1.6 2004/04/12 13:36:40 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 
00022    You should have received a copy of the GNU General Public License
00023    along with this program; if not, write to the Free Software
00024    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025 */
00026 #include "light.h"
00027 
00028 using namespace boost;
00029 using namespace kerosin;
00030 using namespace zeitgeist;
00031 using namespace salt;
00032 
00033 FUNCTION(Light,setRadius)
00034 {
00035     float inRadius;
00036 
00037     if (
00038         (in.GetSize() != 1) ||
00039         (! in.GetValue(in.begin(), inRadius))
00040         )
00041         {
00042             return false;
00043         }
00044 
00045     obj->SetRadius(inRadius);
00046     return true;
00047 }
00048 
00049 FUNCTION(Light,getRadius)
00050 {
00051     return obj->GetRadius();
00052 }
00053 
00054 static bool readRGBA(const zeitgeist::ParameterList& in, RGBA& m)
00055 {
00056     if (
00057         (in.GetSize() != 4) ||
00058         (! in.GetValue(in[0], m.r())) ||
00059         (! in.GetValue(in[1], m.g())) ||
00060         (! in.GetValue(in[2], m.b())) ||
00061         (! in.GetValue(in[3], m.a()))
00062         )
00063         {
00064             return false;
00065         }
00066 
00067     return true;
00068 }
00069 
00070 FUNCTION(Light,setDiffuse)
00071 {
00072     RGBA m;
00073     if (! readRGBA(in,m))
00074         {
00075             return false;
00076         }
00077 
00078     obj->SetDiffuse(m);
00079     return true;
00080 }
00081 
00082 FUNCTION(Light,setAmbient)
00083 {
00084     RGBA m;
00085     if (! readRGBA(in,m))
00086         {
00087             return false;
00088         }
00089 
00090     obj->SetAmbient(m);
00091     return true;
00092 }
00093 
00094 FUNCTION(Light,setSpecular)
00095 {
00096     RGBA m;
00097     if (! readRGBA(in,m))
00098         {
00099             return false;
00100         }
00101 
00102     obj->SetSpecular(m);
00103     return true;
00104 }
00105 
00106 void CLASS(Light)::DefineClass()
00107 {
00108     DEFINE_BASECLASS(oxygen/BaseNode);
00109     DEFINE_FUNCTION(setRadius);
00110     DEFINE_FUNCTION(getRadius);
00111     DEFINE_FUNCTION(setAmbient);
00112     DEFINE_FUNCTION(setDiffuse);
00113     DEFINE_FUNCTION(setSpecular);
00114 }

Generated on Thu Apr 6 15:25:38 2006 for rcssserver3d by  doxygen 1.4.4