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

transform_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: transform_c.cpp,v 1.9 2004/04/28 14:41:03 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 
00023 #include "transform.h"
00024 
00025 using namespace boost;
00026 using namespace oxygen;
00027 using namespace zeitgeist;
00028 using namespace salt;
00029 
00030 FUNCTION(Transform,setLocalPos)
00031 {
00032     Vector3f inPos;
00033 
00034     if (
00035         (in.GetSize() == 0) ||
00036         (! in.GetValue(in.begin(), inPos))
00037         )
00038         {
00039             return false;
00040         }
00041 
00042     obj->SetLocalPos(inPos);
00043     return true;
00044 }
00045 
00046 FUNCTION(Transform,setLocalRotation)
00047 {
00048     Vector3f inRot;
00049 
00050     if (
00051         (in.GetSize() == 0) ||
00052         (! in.GetValue(in.begin(), inRot))
00053         )
00054         {
00055             return false;
00056         }
00057 
00058     obj->SetLocalRotation(inRot);
00059     return true;
00060 }
00061 
00062 FUNCTION(Transform,setLocalTransform)
00063 {
00064     // float InM00, float InM01, float InM02, float InM03,
00065     // float InM10, float InM11, float InM12, float InM13,
00066     // float InM20, float InM21, float InM22, float InM23,
00067     // float InM30, float InM31, float InM32, float InM33
00068 
00069     if (in.GetSize() != 16)
00070         {
00071             return false;
00072         }
00073 
00074     float m[16];
00075 
00076     ParameterList::TVector::const_iterator iter = in.begin();
00077     for (int i=0;i<16;++i)
00078         {
00079             if (! in.GetValue(iter,m[i]))
00080                 {
00081                     return false;
00082                 }
00083             ++iter;
00084         }
00085 
00086     obj->SetLocalTransform(Matrix(m));
00087     return true;
00088 }
00089 
00090 void CLASS(Transform)::DefineClass()
00091 {
00092   DEFINE_BASECLASS(oxygen/BaseNode);
00093   DEFINE_FUNCTION(setLocalPos);
00094   DEFINE_FUNCTION(setLocalRotation);
00095   DEFINE_FUNCTION(setLocalTransform);
00096 }

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