From: Oliver O. <fr...@us...> - 2007-06-17 13:39:37
|
Update of /cvsroot/simspark/simspark/spark/kerosin/sceneserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21072/kerosin/sceneserver Modified Files: axis.cpp light.cpp staticmesh.cpp staticmesh.h staticmesh_c.cpp Log Message: merge from projectx branch Index: axis.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/axis.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** axis.cpp 15 Apr 2007 12:19:53 -0000 1.4 --- axis.cpp 17 Jun 2007 13:38:31 -0000 1.5 *************** *** 1,22 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; version 2 of the License. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "axis.h" --- 1,22 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; version 2 of the License. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "axis.h" Index: light.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/light.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** light.cpp 15 Mar 2007 07:26:26 -0000 1.2 --- light.cpp 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 27,31 **** #include <zeitgeist/logserver/logserver.h> #include <kerosin/openglserver/openglwrapper.h> - #include <kerosin/renderserver/renderserver.h> using namespace boost; --- 27,30 ---- Index: staticmesh.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/staticmesh.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** staticmesh.cpp 15 Mar 2007 07:26:26 -0000 1.3 --- staticmesh.cpp 17 Jun 2007 13:38:31 -0000 1.4 *************** *** 33,37 **** using namespace oxygen; ! StaticMesh::StaticMesh() : mScale(1.0f,1.0f,1.0f) { } --- 33,41 ---- using namespace oxygen; ! StaticMesh::StaticMesh() : mScale(1.0f,1.0f,1.0f), ! mCastShadows(true), ! mUseExternalMesh(false), ! mExternalMeshName(""), ! mExternalMeshScale(1.0f,1.0f,1.0f) { } *************** *** 228,229 **** --- 232,288 ---- } + + /** returns the materials used to render the mesh */ + const StaticMesh::TMaterialList& + StaticMesh::GetMaterials() const + { + return mMaterials; + } + + bool + StaticMesh::CastShadows() const + { + return mCastShadows; + } + + void + StaticMesh::SetCastShadows(bool shadows) + { + mCastShadows = shadows; + } + + void + StaticMesh::SetUseExternalMesh(bool external) + { + mUseExternalMesh = external; + } + + bool + StaticMesh::UseExternalMesh() const + { + return mUseExternalMesh; + } + + void + StaticMesh::SetExternalMeshName(const std::string& name) + { + mExternalMeshName = name; + } + + const std::string& + StaticMesh::GetExternalMeshName() const + { + return mExternalMeshName; + } + + void + StaticMesh::SetExternalMeshScale(const salt::Vector3f& scale) + { + mExternalMeshScale = scale; + } + + const salt::Vector3f& + StaticMesh::ExternalMeshScale() const + { + return mExternalMeshScale; + } Index: staticmesh_c.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/staticmesh_c.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** staticmesh_c.cpp 5 Dec 2005 21:38:23 -0000 1.1 --- staticmesh_c.cpp 17 Jun 2007 13:38:31 -0000 1.2 *************** *** 54,63 **** if ( ! (in.GetSize() == 0) || ! (! in.GetValue(in[0], inScale)) ) ! { ! return false; ! } obj->SetScale(inScale); --- 54,63 ---- if ( ! (in.GetSize() != 3) || ! (! in.GetValue(in.begin(), inScale)) ) ! { ! return false; ! } obj->SetScale(inScale); *************** *** 65,68 **** --- 65,133 ---- } + FUNCTION(StaticMesh,setCastShadows) + { + bool shadows; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in[0], shadows)) + ) + { + return false; + } + + obj->SetCastShadows(shadows); + return true; + } + + FUNCTION(StaticMesh,setUseExternalMesh) + { + bool external; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in[0], external)) + ) + { + return false; + } + + obj->SetUseExternalMesh(external); + return true; + } + + + FUNCTION(StaticMesh,setExternalMeshName) + { + std::string name; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in[0], name)) + ) + { + return false; + } + obj->SetExternalMeshName(name); + return true; + } + + FUNCTION(StaticMesh,setExternalMeshScale) + { + Vector3f inScale; + std::cerr << "*********************************************************************************\n"; + if ( + (in.GetSize() != 3) || + (! in.GetValue(in.begin(), inScale)) + ) + { + return false; + } + std::cerr << "setting External Mesh scale to " << inScale << "\n*********************************************************************************\n"; + + obj->SetExternalMeshScale(inScale); + return true; + } + void CLASS(StaticMesh)::DefineClass() { *************** *** 70,72 **** --- 135,141 ---- DEFINE_FUNCTION(load); DEFINE_FUNCTION(setScale); + DEFINE_FUNCTION(setCastShadows) + DEFINE_FUNCTION(setUseExternalMesh) + DEFINE_FUNCTION(setExternalMeshName) + DEFINE_FUNCTION(setExternalMeshScale) } Index: staticmesh.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/staticmesh.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** staticmesh.h 5 Dec 2005 21:38:23 -0000 1.1 --- staticmesh.h 17 Jun 2007 13:38:31 -0000 1.2 *************** *** 42,46 **** public: typedef std::vector<oxygen::IndexBuffer> TIndexBuffers; ! // // Function --- 42,46 ---- public: typedef std::vector<oxygen::IndexBuffer> TIndexBuffers; ! typedef std::vector<boost::shared_ptr<Material> > TMaterialList; // // Function *************** *** 83,86 **** --- 83,126 ---- const zeitgeist::ParameterList& GetMeshParameter(); + /** returns the materials used to render the mesh */ + const TMaterialList& GetMaterials() const; + + /** a hint for the graphics engine if the mesh casts shadows or now. + By default, StaticMeshes cast shadows. The respective graphics engine + might ignore this flag if the GE cannot cast shadows. + */ + bool CastShadows() const; + + /** set the flag if the mesh should cast shadows or not. + The actual graphics engine might ignore this flag if it cannot render + shadows or disables shadows globally. + */ + void SetCastShadows(bool shadows); + + /** Set the flag if the GE should use an external mesh for rendering. + By default, using external meshes is switched off. For this to work, + the external mesh name has to be set. + */ + void SetUseExternalMesh(bool external = true); + /** Get the flag if the GE should use an external mesh for rendering. + If set to true, the GE can use a different (possibly more advanced) + mesh. The hint for the kind of external mesh should be given by the + Get/SetExternalMeshName() methods of this class. + */ + bool UseExternalMesh() const; + /** Set the name of the external mesh. + \string name the external mesh name + */ + void SetExternalMeshName(const std::string& name); + /** Get the name of the external mesh to use. + \return the name + */ + const std::string& GetExternalMeshName() const; + //! Set an additional scale for the external mesh + void SetExternalMeshScale(const salt::Vector3f& scale); + /** Get the external mesh scale. + @return the external mesh scale */ + const salt::Vector3f& ExternalMeshScale() const; + // // Members *************** *** 94,98 **** /** the materials used to render the mesh */ ! std::vector<boost::shared_ptr<Material> > mMaterials; /** the name of the loaded mesh */ --- 134,138 ---- /** the materials used to render the mesh */ ! TMaterialList mMaterials; /** the name of the loaded mesh */ *************** *** 101,104 **** --- 141,154 ---- /** the list of parameters the mesh was loaded with */ zeitgeist::ParameterList mMeshParameter; + + //! the flag if the mesh should cast shadows + bool mCastShadows; + + //! the flag if the GE can use an external mesh + bool mUseExternalMesh; + //! the external mesh name + std::string mExternalMeshName; + //! additional scale factors along each axis for external meshes + salt::Vector3f mExternalMeshScale; }; |