00001 //----------------------------------------------------------------------------------- 00002 // 00003 // Pro-Vocation Light Engine (PVLE) 00004 // Copyright (C) 2007-2009 Sukender, KinoX & Buzib 00005 // For more information, contact us : sukender@free.fr 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // For any use that is not compatible with the terms of the GNU 00013 // General Public License, please contact the authors for alternative 00014 // licensing options. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with this program; if not, write to the Free Software Foundation, Inc., 00023 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00024 // 00025 //----------------------------------------------------------------------------------- 00026 00027 #include <PVLE/Config.h> 00028 00029 #ifdef PVLE_PHYSICS_KEEP_DEPRECATED_TRANSFORMS 00030 00031 #include <PVLE/Physics/Transform.h> 00032 #include <PVLE/Physics/Space.h> 00033 #include <PVLE/Util/Log.h> 00034 00035 namespace Physics { 00036 00037 void Transform::setEncapsulated(Geom * pGeom) { 00038 ASSERT(pGeom); 00039 00040 if (pEncapsulated.valid()) { 00041 LOG_WARN << __PVLE_METHOD__ << "Setting encapsulated geom on an already-bound transform : old encapsulated has no body, and is in no space." << std::endl; 00042 /* 00043 // Attach old child to ??? (the space of this transform ?) 00044 pEncapsulated-> 00045 // Attach old child to ??? (the body of this transform ?) 00046 pEncapsulated->setBody(); 00047 */ 00048 } 00049 pEncapsulated = pGeom; 00050 pGeomH = pGeom->getHandler(); 00051 gameplayDensity = pGeom->getGameplayDensity(); 00052 surface = pGeom->surface; 00053 pContainer = pGeom->getCollisionContainer(); 00054 00055 // Detach encapsulated from its body (ODE doc) 00056 pBody = pGeom->getBody(); 00057 // pGeom->setBody(NULL); 00058 00059 // Detach encapsulated from its space (ODE doc) 00060 Space * pParentSpace = pGeom->getParentSpace(); 00061 if (pParentSpace){ 00062 pParentSpace->add(this); 00063 pParentSpace->remove(pGeom); 00064 } 00065 dGeomTransformSetGeom(this->id, pGeom->id); 00066 } 00067 00068 } // namespace Physics 00069 00070 #endif // PVLE_PHYSICS_KEEP_DEPRECATED_TRANSFORMS