00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 }