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

planecollider_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) 2003 Koblenz University
00006 $Id: planecollider_c.cpp,v 1.8 2004/04/15 18:34:06 rollmark Exp $
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; version 2 of the License.
00011 
00012 This program 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
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 */
00021 
00022 #include "planecollider.h"
00023 
00024 using namespace boost;
00025 using namespace zeitgeist;
00026 using namespace oxygen;
00027 using namespace salt;
00028 
00029 FUNCTION(PlaneCollider,setParams)
00030 {
00031     if (in.GetSize() == 4)
00032         {
00033             // try to read 4 floats
00034             float inF[4];
00035             int i;
00036             for (i=0;i<4;++i)
00037                 {
00038                     if (! in.GetValue(in[i],inF[i]))
00039                         {
00040                             break;
00041                         }
00042                 }
00043 
00044             if (i == 4)
00045                 {
00046                     obj->SetParams(inF[0],inF[1],inF[2],inF[3]);
00047                     return true;
00048                 }
00049         }
00050 
00051     // try to read two Vector3f
00052     Vector3f inPos;
00053     Vector3f inNormal;
00054 
00055     ParameterList::TVector::const_iterator iter = in.begin();
00056     if (
00057         (! in.AdvanceValue(iter,inPos)) ||
00058         (! in.AdvanceValue(iter,inNormal))
00059         )
00060         {
00061             return false;
00062         }
00063 
00064     obj->SetParams(inPos,inNormal);
00065     return true;
00066 }
00067 
00068 FUNCTION(PlaneCollider,getPointDepth)
00069 {
00070     Vector3f inPos;
00071 
00072     if (
00073         (in.GetSize() == 0) ||
00074         (! in.GetValue(in.begin(), inPos))
00075         )
00076         {
00077             return 0;
00078         }
00079 
00080     return obj->GetPointDepth(inPos);
00081 }
00082 
00083 void CLASS(PlaneCollider)::DefineClass()
00084 {
00085     DEFINE_BASECLASS(oxygen/Collider);
00086     DEFINE_FUNCTION(setParams);
00087     DEFINE_FUNCTION(getPointDepth);
00088 }

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