From: <and...@us...> - 2008-02-16 01:42:54
|
Revision: 570 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=570&view=rev Author: andy_miller Date: 2008-02-15 17:43:00 -0800 (Fri, 15 Feb 2008) Log Message: ----------- More Thirdparty Cleanup Removed Paths: ------------- trunk/python-ogre/ThirdParty/nxogre/FireState.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsBoxShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCompoundShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConeShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexCast.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexHullShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCylinderShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugContact.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugDrawer.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugLines.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMeshToShapeConverter.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMinkowskiSumShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMultiSphereShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsSphereShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsStaticPlaneShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsTriangleShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsTrimeshShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamics6DofConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsConeTwistConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsHingeConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsPoint2pointConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsRaycastVehicle.cpp Deleted: trunk/python-ogre/ThirdParty/nxogre/FireState.cpp =================================================================== --- trunk/python-ogre/ThirdParty/nxogre/FireState.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/nxogre/FireState.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1 +0,0 @@ -// FireState Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsBoxShape.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsBoxShape.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsBoxShape.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,49 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" - -#include "Utils/OgreBulletConverter.h" -#include "Shapes/OgreBulletCollisionsBoxShape.h" -#include "Debug/OgreBulletCollisionsDebugLines.h" - -using namespace Ogre; -using namespace OgreBulletCollisions; - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - BoxCollisionShape::BoxCollisionShape(const Vector3 &bodyBounds): - CollisionShape() - { - mShape = new btBoxShape(OgreBtConverter::to(bodyBounds)); - } - // ------------------------------------------------------------------------- - BoxCollisionShape::~BoxCollisionShape() - { - } -} - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCompoundShape.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCompoundShape.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCompoundShape.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,93 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" -#include "Utils/OgreBulletConverter.h" - -#include "Shapes/OgreBulletCollisionsCompoundShape.h" - -using namespace Ogre; -using namespace OgreBulletCollisions; - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - CompoundCollisionShape::CompoundCollisionShape(): - CollisionShape() - { - mShape = new btCompoundShape(); - } - // ------------------------------------------------------------------------- - CompoundCollisionShape::~CompoundCollisionShape() - { - } - // ------------------------------------------------------------------------- - void CompoundCollisionShape::addChildShape(CollisionShape *shape, const Vector3 &pos, const Quaternion &quat) - { - btTransform localTrans; - - //localTrans.setIdentity(); - //localTrans effectively shifts the center of mass with respect to the chassis - localTrans.setOrigin (OgreBtConverter::to(pos)); - localTrans.setRotation (OgreBtConverter::to(quat)); - - static_cast <btCompoundShape *> (mShape)->addChildShape(localTrans, shape->getBulletShape()); - - mShapes.push_back (shape); - } - // ------------------------------------------------------------------------- - bool CompoundCollisionShape::drawWireFrame(DebugLines *wire, - const Ogre::Vector3 &pos, - const Ogre::Quaternion &quat) const - { - bool isVisual = false; - btCompoundShape * const myBtCompoundShape = static_cast <btCompoundShape *> (mShape); - int numChildShapes = myBtCompoundShape->getNumChildShapes (); - - int i; - for (std::vector<CollisionShape *>::const_iterator itShape = mShapes.begin(); - itShape != mShapes.end(); ++itShape) - { - const btCollisionShape * const shape = (*itShape)->getBulletShape(); - for (i = 0; i < numChildShapes; i++) - { - if (myBtCompoundShape->getChildShape (i) == shape) - break; - } - assert (i < numChildShapes); - - const btTransform &localTrans = myBtCompoundShape->getChildTransform (i); - - const Vector3 pos (BtOgreConverter::to(localTrans.getOrigin ())); - const Quaternion quat( BtOgreConverter::to(localTrans.getRotation ())); - - if ((*itShape)->drawWireFrame(wire, pos, quat)) - isVisual = true; - } - return isVisual; - } -} - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConeShape.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConeShape.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConeShape.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,54 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" - -#include "Shapes/OgreBulletCollisionsConeShape.h" -#include "Debug/OgreBulletCollisionsDebugLines.h" - -using namespace Ogre; -using namespace OgreBulletCollisions; - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - ConeCollisionShape::ConeCollisionShape(Real radius, Real height, const Vector3 &axe): - CollisionShape() - { - if (axe == Vector3::UNIT_Y) - mShape = new btConeShape (btScalar (radius), btScalar (height)); - else if (axe == Vector3::UNIT_X) - mShape = new btConeShapeX (btScalar (radius), btScalar (height)); - else - mShape = new btConeShapeZ (btScalar (radius), btScalar (height)); - - } - // ------------------------------------------------------------------------- - ConeCollisionShape::~ConeCollisionShape () - { - } -} - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexCast.h =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexCast.h 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexCast.h 2008-02-16 01:43:00 UTC (rev 570) @@ -1,47 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#ifndef _OGREBULLETCOLLISIONS_BoxShape_H -#define _OGREBULLETCOLLISIONS_BoxShape_H - -#include "OgreBulletCollisionsPreRequisites.h" - -#include "OgreBulletCollisionsShape.h" - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - // basic BoxShape - class BoxCollisionShape : public CollisionShape - { - public: - BoxCollisionShape(const Ogre::Vector3 &boxBounds); - virtual ~BoxCollisionShape(); - - }; -} -#endif //_OGREBULLETCOLLISIONS_BoxShape_H - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexHullShape.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexHullShape.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexHullShape.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,55 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" - -#include "Shapes/OgreBulletCollisionsConvexHullShape.h" -#include "Debug/OgreBulletCollisionsDebugLines.h" - -using namespace Ogre; -using namespace OgreBulletCollisions; - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - ConvexHullCollisionShape::ConvexHullCollisionShape(const Real* points, int numPoints, int stride): - CollisionShape() - { - mShape = new btConvexHullShape((btScalar*) points, numPoints, stride); - } - // ------------------------------------------------------------------------- - ConvexHullCollisionShape::ConvexHullCollisionShape(): - CollisionShape() - { - mShape = new btConvexHullShape(); - } - // ------------------------------------------------------------------------- - ConvexHullCollisionShape::~ConvexHullCollisionShape() - { - } - -} - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCylinderShape.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCylinderShape.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCylinderShape.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,54 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" -#include "Utils/OgreBulletConverter.h" - -#include "Shapes/OgreBulletCollisionsCylinderShape.h" -#include "Debug/OgreBulletCollisionsDebugLines.h" - -using namespace Ogre; -using namespace OgreBulletCollisions; - -namespace OgreBulletCollisions -{ - // ------------------------------------------------------------------------- - CylinderCollisionShape::CylinderCollisionShape(const Vector3 &halfExtents, const Vector3 &axe): - CollisionShape() - { - if (axe == Vector3::UNIT_X) - mShape = new btCylinderShapeX(OgreBtConverter::to(halfExtents)); - else if (axe == Vector3::UNIT_Y) - mShape = new btCylinderShape (OgreBtConverter::to(halfExtents)); - else if (axe == Vector3::UNIT_Z) - mShape = new btCylinderShapeZ(OgreBtConverter::to(halfExtents)); - } - // ------------------------------------------------------------------------- - CylinderCollisionShape::~CylinderCollisionShape() - { - } -} - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugContact.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugContact.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugContact.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,650 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - - -#include "OgreBulletCollisions.h" - -#include "Ogre.h" -#include "OgreFontManager.h" - -#include "Debug/OgreBulletCollisionsDebugContact.h" -#include "OgreBulletCollisionsShape.h" -#include "OgreBulletCollisionsObject.h" -#include "OgreBulletCollisionsWorld.h" - -using namespace Ogre; - -#define POS_TEX_BINDING 0 -#define COLOUR_BINDING 1 - -namespace OgreBulletCollisions -{ - //------------------------------------------------------------------------------------------------ - DebugContact::DebugContact(const String &name, CollisionsWorld *world) : - _name(name), - _world(world), - _enabled(false) - { - // scene node - _node = _world->getSceneManager()->getRootSceneNode ()->createChildSceneNode (); - - // sphere attach to contact point - _point = _world->getSceneManager()->createEntity(name + String("_debug_point"), "sphere.mesh"); - _point_node = _node->createChildSceneNode (); - _point_node->attachObject (_point); - _point_node->setScale(0.001, 0.001, 0.001); - - // normal direction debug - _normal = new DebugNormal(); - _node->attachObject (_normal); - - // text info on contact - _text = new DebugContactText(name + String("_debug_text"), _node->createChildSceneNode ()); - _text->setPosition (Vector3(0,5,0)); - _text->setCaption ("-"); - _text->setVisible (false); - - _node->setVisible (false); - } - //------------------------------------------------------------------------------------------------ - DebugContact::~DebugContact() - { - delete _text; - - _point_node->detachObject (_point->getName ()); - _node->detachObject (_normal->getName ()); - - _world->getSceneManager()->destroyEntity (_point->getName ()); - - _node->detachAllObjects (); - _node->removeAndDestroyAllChildren (); - - delete _normal; - } - //------------------------------------------------------------------------------------------------ - void DebugContact::update(const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth) - { - _node->setPosition (pt); - - _point_node->setPosition (depth * normal); - - //String contactLabel("p: "); - //contactLabel = contactLabel + StringConverter::toString(contact->getPosition()); - //contactLabel = contactLabel + ", n: "; - //contactLabel = contactLabel + StringConverter::toString(contact->getNormal()); - //_text->setCaption (contactLabel); - //_text->setVisible (false); - - //_text->setPosition (contact->getPosition () + Vector3(0,5,0)); - - _normal->update (normal, pt, depth); - } - //------------------------------------------------------------------------------------------------ - bool DebugContact::isEnabled () const - { - return _enabled; - } - //------------------------------------------------------------------------------------------------ - void DebugContact::setEnabled (bool enable) - { - _enabled = enable; - _node->setVisible (_enabled); - }; - //------------------------------------------------------------------------------------------------ - void DebugNormal::update(const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth) - { - DebugLines::clear (); - // set normal following contact normal - //contact->_normal - //contact->_position - DebugLines::addLine (Vector3::ZERO, - 5*normal); - DebugLines::draw (); - } - //------------------------------------------------------------------------------------------------ - DebugContactText::DebugContactText(const String &name, - SceneNode *node, - const String &caption, - const String &fontName, - int charHeight, - const ColourValue &color) - : mpCam(NULL) - , mpWin(NULL) - , mpFont(NULL) - , mName(name) - , mCaption(caption) - , mFontName(fontName) - , mCharHeight(charHeight) - , mColor(color) - , mType("DebugContact") - , mTimeUntilNextToggle(0) - , mSpaceWidth(0) - , mUpdateColors(true) - , mOnTop(false) - , mHorizontalAlignment(H_LEFT) - , mVerticalAlignment(V_BELOW) - , mAdditionalHeight(0.0) - , mNode(node) - - { - if (name.empty()) - Exception(Exception::ERR_INVALIDPARAMS, "Trying to create DebugContact without name", "DebugContact::DebugContact"); -// -// if (caption.empty()) -// Exception(Exception::ERR_INVALIDPARAMS, "Trying to create DebugContact without caption", "DebugContact::DebugContact"); - - mRenderOp.vertexData = NULL; - this->setFontName(mFontName); - //this->_setupGeometry(); - mNode->attachObject(this); - } - //------------------------------------------------------------------------------------------------ - DebugContactText::~DebugContactText() - { - mNode->detachObject(this->getName()); - if (mRenderOp.vertexData) - delete mRenderOp.vertexData; - } -#if (OGRE_VERSION >= ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0) - void DebugContactText::visitRenderables(Renderable::Visitor* visitor, - bool debugRenderables) - { - visitor->visit(this, 0, false); - } -#endif - //------------------------------------------------------------------------------------------------ - void DebugContactText::setPosition(const Vector3 &pos) - { - mNode->setPosition (pos); - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setFontName(const String &fontName) - { - if((Ogre::MaterialManager::getSingletonPtr()->resourceExists(mName + "Material"))) - { - Ogre::MaterialManager::getSingleton().remove(mName + "Material"); - } - - if (mFontName != fontName || mpMaterial.isNull() || !mpFont) - { - mFontName = fontName; - mpFont = (Font *)FontManager::getSingleton().getByName(mFontName).getPointer(); - if (!mpFont) - Exception(Exception::ERR_ITEM_NOT_FOUND, "Could not find font " + fontName, "DebugContact::setFontName"); - - mpFont->load(); - if (!mpMaterial.isNull()) - { - MaterialManager::getSingletonPtr()->remove(mpMaterial->getName()); - mpMaterial.setNull(); - } - - mpMaterial = mpFont->getMaterial()->clone(mName + "Material"); - if (!mpMaterial->isLoaded()) - mpMaterial->load(); - - mpMaterial->setDepthCheckEnabled(!mOnTop); - //mpMaterial->setDepthBias(!mOnTop); - mpMaterial->setDepthBias(0,!mOnTop); - mpMaterial->setDepthWriteEnabled(mOnTop); - mpMaterial->setLightingEnabled(false); - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setCaption(const String &caption) - { - if (caption != mCaption) - { - mCaption = caption; - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setColor(const ColourValue &color) - { - if (color != mColor) - { - mColor = color; - mUpdateColors = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setCharacterHeight(unsigned int height) - { - if (height != mCharHeight) - { - mCharHeight = height; - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setSpaceWidth(unsigned int width) - { - if (width != mSpaceWidth) - { - mSpaceWidth = width; - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setTextAlignment(const HorizontalAlignment& horizontalAlignment, const VerticalAlignment& verticalAlignment) - { - if(mHorizontalAlignment != horizontalAlignment) - { - mHorizontalAlignment = horizontalAlignment; - mNeedUpdate = true; - } - if(mVerticalAlignment != verticalAlignment) - { - mVerticalAlignment = verticalAlignment; - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::setAdditionalHeight( Real height ) - { - if( mAdditionalHeight != height ) - { - mAdditionalHeight = height; - mNeedUpdate = true; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::showOnTop(bool show) - { - if( mOnTop != show && !mpMaterial.isNull() ) - { - mOnTop = show; - mpMaterial->setDepthBias(0,!mOnTop); - mpMaterial->setDepthCheckEnabled(!mOnTop); - mpMaterial->setDepthWriteEnabled(mOnTop); - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::_setupGeometry() - { - assert(mpFont); - assert(!mpMaterial.isNull()); - - unsigned int vertexCount = static_cast<unsigned int>(mCaption.size() * 6); - - if (mRenderOp.vertexData) - { - // Removed this test as it causes problems when replacing a caption - // of the same size: replacing "Hello" with "hello" - // as well as when changing the text alignment - //if (mRenderOp.vertexData->vertexCount != vertexCount) - { - delete mRenderOp.vertexData; - mRenderOp.vertexData = NULL; - mUpdateColors = true; - } - } - - if (!mRenderOp.vertexData) - mRenderOp.vertexData = new VertexData(); - - mRenderOp.indexData = 0; - mRenderOp.vertexData->vertexStart = 0; - mRenderOp.vertexData->vertexCount = vertexCount; - mRenderOp.operationType = RenderOperation::OT_TRIANGLE_LIST; - mRenderOp.useIndexes = false; - - VertexDeclaration *decl = mRenderOp.vertexData->vertexDeclaration; - VertexBufferBinding *bind = mRenderOp.vertexData->vertexBufferBinding; - size_t offset = 0; - - // create/bind positions/tex.ccord. buffer - if (!decl->findElementBySemantic(VES_POSITION)) - decl->addElement(POS_TEX_BINDING, offset, VET_FLOAT3, VES_POSITION); - - offset += VertexElement::getTypeSize(VET_FLOAT3); - - if (!decl->findElementBySemantic(VES_TEXTURE_COORDINATES)) - decl->addElement(POS_TEX_BINDING, offset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0); - - HardwareVertexBufferSharedPtr ptbuf = HardwareBufferManager::getSingleton().createVertexBuffer(decl->getVertexSize(POS_TEX_BINDING), - mRenderOp.vertexData->vertexCount, - HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); - bind->setBinding(POS_TEX_BINDING, ptbuf); - - // Colours - store these in a separate buffer because they change less often - if (!decl->findElementBySemantic(VES_DIFFUSE)) - decl->addElement(COLOUR_BINDING, 0, VET_COLOUR, VES_DIFFUSE); - - HardwareVertexBufferSharedPtr cbuf = HardwareBufferManager::getSingleton().createVertexBuffer(decl->getVertexSize(COLOUR_BINDING), - mRenderOp.vertexData->vertexCount, - HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); - bind->setBinding(COLOUR_BINDING, cbuf); - - size_t charlen = mCaption.size(); - Real *pPCBuff = static_cast<Real*>(ptbuf->lock(HardwareBuffer::HBL_DISCARD)); - - float largestWidth = 0; - float left = 0 * 2.0 - 1.0; - float top = -((0 * 2.0) - 1.0); - - // Derive space width from a capital A - if (mSpaceWidth == 0) - mSpaceWidth = mpFont->getGlyphAspectRatio('A') * mCharHeight * 2.0; - - // for calculation of AABB - Ogre::Vector3 min, max, currPos; - Ogre::Real maxSquaredRadius; - bool first = true; - - // Use iterator - String::iterator i, iend; - iend = mCaption.end(); - bool newLine = true; - Real len = 0.0f; - - if(mVerticalAlignment == DebugContactText::V_ABOVE) - { - // Raise the first line of the caption - top += mCharHeight; - for (i = mCaption.begin(); i != iend; ++i) - { - if (*i == '\n') - top += mCharHeight * 2.0; - } - } - - for (i = mCaption.begin(); i != iend; ++i) - { - if (newLine) - { - len = 0.0f; - for (String::iterator j = i; j != iend && *j != '\n'; j++) - { - if (*j == ' ') - len += mSpaceWidth; - else - len += mpFont->getGlyphAspectRatio(*j) * mCharHeight * 2.0; - } - newLine = false; - } - - if (*i == '\n') - { - left = 0 * 2.0 - 1.0; - top -= mCharHeight * 2.0; - newLine = true; - continue; - } - - if (*i == ' ') - { - // Just leave a gap, no tris - left += mSpaceWidth; - // Also reduce tri count - mRenderOp.vertexData->vertexCount -= 6; - continue; - } - - Real horiz_height = mpFont->getGlyphAspectRatio(*i); - - //mpFont->getGlyphTexCoords(*i, u1, v1, u2, v2); - const Font::UVRect &uvRect = mpFont->getGlyphTexCoords(*i); - const Real u1 = uvRect.left; - const Real u2 = uvRect.right; - const Real v1 = uvRect.top; - const Real v2 = uvRect.bottom; - - // each vert is (x, y, z, u, v) - //------------------------------------------------------------------------------------- - // First tri - // - // Upper left - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u1; - *pPCBuff++ = v1; - - // Deal with bounds - if(mHorizontalAlignment == DebugContactText::H_LEFT) - currPos = Ogre::Vector3(left, top, -1.0); - else - currPos = Ogre::Vector3(left - (len / 2), top, -1.0); - if (first) - { - min = max = currPos; - maxSquaredRadius = currPos.squaredLength(); - first = false; - } - else - { - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - } - - top -= mCharHeight * 2.0; - - // Bottom left - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u1; - *pPCBuff++ = v2; - - // Deal with bounds - if(mHorizontalAlignment == DebugContactText::H_LEFT) - currPos = Ogre::Vector3(left, top, -1.0); - else - currPos = Ogre::Vector3(left - (len / 2), top, -1.0); - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - - top += mCharHeight * 2.0; - left += horiz_height * mCharHeight * 2.0; - - // Top right - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u2; - *pPCBuff++ = v1; - //------------------------------------------------------------------------------------- - - // Deal with bounds - if(mHorizontalAlignment == DebugContactText::H_LEFT) - currPos = Ogre::Vector3(left, top, -1.0); - else - currPos = Ogre::Vector3(left - (len / 2), top, -1.0); - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - - //------------------------------------------------------------------------------------- - // Second tri - // - // Top right (again) - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u2; - *pPCBuff++ = v1; - - currPos = Ogre::Vector3(left, top, -1.0); - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - - top -= mCharHeight * 2.0; - left -= horiz_height * mCharHeight * 2.0; - - // Bottom left (again) - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u1; - *pPCBuff++ = v2; - - currPos = Ogre::Vector3(left, top, -1.0); - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - - left += horiz_height * mCharHeight * 2.0; - - // Bottom right - if(mHorizontalAlignment == DebugContactText::H_LEFT) - *pPCBuff++ = left; - else - *pPCBuff++ = left - (len / 2); - *pPCBuff++ = top; - *pPCBuff++ = -1.0; - *pPCBuff++ = u2; - *pPCBuff++ = v2; - //------------------------------------------------------------------------------------- - - currPos = Ogre::Vector3(left, top, -1.0); - min.makeFloor(currPos); - max.makeCeil(currPos); - maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength()); - - // Go back up with top - top += mCharHeight * 2.0; - - float currentWidth = (left + 1)/2 - 0; - if (currentWidth > largestWidth) - largestWidth = currentWidth; - } - - // Unlock vertex buffer - ptbuf->unlock(); - - // update AABB/Sphere radius - mAABB = Ogre::AxisAlignedBox(min, max); - mRadius = Ogre::Math::Sqrt(maxSquaredRadius); - - if (mUpdateColors) - this->_updateColors(); - - mNeedUpdate = false; - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::_updateColors(void) - { - assert(mpFont); - assert(!mpMaterial.isNull()); - - // Convert to system-specific - RGBA color; - Root::getSingleton().convertColourValue(mColor, &color); - HardwareVertexBufferSharedPtr vbuf = mRenderOp.vertexData->vertexBufferBinding->getBuffer(COLOUR_BINDING); - RGBA *pDest = static_cast<RGBA*>(vbuf->lock(HardwareBuffer::HBL_DISCARD)); - for (unsigned int i = 0; i < mRenderOp.vertexData->vertexCount; ++i) - *pDest++ = color; - vbuf->unlock(); - mUpdateColors = false; - } - //------------------------------------------------------------------------------------------------ - const Quaternion& DebugContactText::getWorldOrientation(void) const - { - assert(mpCam); - return const_cast<Quaternion&>(mpCam->getDerivedOrientation()); - } - //------------------------------------------------------------------------------------------------ - const Vector3& DebugContactText::getWorldPosition(void) const - { - assert(mParentNode); - return mParentNode->_getDerivedPosition(); - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::getWorldTransforms(Matrix4 *xform) const - { - if (this->isVisible() && mpCam) - { - Matrix3 rot3x3, scale3x3 = Matrix3::IDENTITY; - - // store rotation in a matrix - mpCam->getDerivedOrientation().ToRotationMatrix(rot3x3); - - // parent node position - Vector3 ppos = mParentNode->_getDerivedPosition() + Vector3::UNIT_Y*mAdditionalHeight; - - // apply scale - scale3x3[0][0] = mParentNode->_getDerivedScale().x / 2; - scale3x3[1][1] = mParentNode->_getDerivedScale().y / 2; - scale3x3[2][2] = mParentNode->_getDerivedScale().z / 2; - - // apply all transforms to xform - *xform = (rot3x3 * scale3x3); - xform->setTrans(ppos); - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::getRenderOperation(RenderOperation &op) - { - if (this->isVisible()) - { - if (mNeedUpdate) - this->_setupGeometry(); - if (mUpdateColors) - this->_updateColors(); - op = mRenderOp; - } - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::_notifyCurrentCamera(Camera *cam) - { - mpCam = cam; - } - //------------------------------------------------------------------------------------------------ - void DebugContactText::_updateRenderQueue(RenderQueue* queue) - { - if (this->isVisible()) - { - if (mNeedUpdate) - this->_setupGeometry(); - if (mUpdateColors) - this->_updateColors(); - - queue->addRenderable(this, mRenderQueueID, OGRE_RENDERABLE_DEFAULT_PRIORITY); - // queue->addRenderable(this, mRenderQueueID, RENDER_QUEUE_SKIES_LATE); - } - } -} Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugDrawer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugDrawer.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugDrawer.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,237 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" - -#include "Debug/OgreBulletCollisionsDebugDrawer.h" -#include "Utils/OgreBulletConverter.h" - -using namespace OgreBulletCollisions; -using namespace Ogre; - -//------------------------------------------------------------------------------------------------ -DebugDrawer::DebugDrawer() : - DebugLines(), - btIDebugDraw(), - mDebugMode(0) -{ -} -//------------------------------------------------------------------------------------------------ -DebugDrawer::~DebugDrawer() -{ -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::reportErrorWarning(const char* warningString) -{ - Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(warningString); -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDrawAabb(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DrawAabb; - else - mDebugMode &= ~btIDebugDraw::DBG_DrawAabb; -} -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDrawAabb () const {return (mDebugMode & btIDebugDraw::DBG_DrawAabb) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDrawWireframe () const {return (mDebugMode & btIDebugDraw::DBG_DrawWireframe) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDrawFeaturesText () const {return (mDebugMode & btIDebugDraw::DBG_DrawFeaturesText) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDrawContactPoints () const {return (mDebugMode & btIDebugDraw::DBG_DrawContactPoints) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesNoDeactivation () const {return (mDebugMode & btIDebugDraw::DBG_NoDeactivation) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesNoHelpText () const {return (mDebugMode & btIDebugDraw::DBG_NoHelpText) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDrawText () const {return (mDebugMode & btIDebugDraw::DBG_DrawText) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesProfileTimings () const {return (mDebugMode & btIDebugDraw::DBG_ProfileTimings) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesEnableSatComparison () const {return (mDebugMode & btIDebugDraw::DBG_EnableSatComparison) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesDisableBulletLCP () const {return (mDebugMode & btIDebugDraw::DBG_DisableBulletLCP) != 0;}; -//------------------------------------------------------------------------------------------------ -bool DebugDrawer::doesEnableCCD () const {return (mDebugMode & btIDebugDraw::DBG_EnableCCD) != 0;}; -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDrawWireframe(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DrawWireframe; - else - mDebugMode &= ~btIDebugDraw::DBG_DrawWireframe; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDrawFeaturesText(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DrawFeaturesText; - else - mDebugMode &= ~btIDebugDraw::DBG_DrawFeaturesText; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDrawContactPoints(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DrawContactPoints; - else - mDebugMode &= ~btIDebugDraw::DBG_DrawContactPoints; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setNoDeactivation(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_NoDeactivation; - else - mDebugMode &= ~btIDebugDraw::DBG_NoDeactivation; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setNoHelpText(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_NoHelpText; - else - mDebugMode &= ~btIDebugDraw::DBG_NoHelpText; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDrawText(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DrawText; - else - mDebugMode &= ~btIDebugDraw::DBG_DrawText; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setProfileTimings(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_ProfileTimings; - else - mDebugMode &= ~btIDebugDraw::DBG_ProfileTimings; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setEnableSatComparison(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_EnableSatComparison; - else - mDebugMode &= ~btIDebugDraw::DBG_EnableSatComparison; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setDisableBulletLCP (bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_DisableBulletLCP ; - else - mDebugMode &= ~btIDebugDraw::DBG_DisableBulletLCP ; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::setEnableCCD(bool enable) -{ - if (enable) - mDebugMode |= btIDebugDraw::DBG_EnableCCD; - else - mDebugMode &= ~btIDebugDraw::DBG_EnableCCD; -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawAabb(const btVector3& from,const btVector3& to,const btVector3& color) -{ - if (mDebugMode & btIDebugDraw::DBG_DrawAabb) - { - drawAabb (BtOgreConverter::to(from), BtOgreConverter::to(to), BtOgreConverter::to (color)); - } -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color) -{ - if (mDebugMode > 0) - { - drawLine (BtOgreConverter::to(from), BtOgreConverter::to(to), BtOgreConverter::to (color)); - } -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB, - btScalar distance,int lifeTime,const btVector3& color) -{ - if (mDebugMode & btIDebugDraw::DBG_DrawContactPoints) - { - // - } -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawAabb (const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color) -{ - if (mDebugMode & btIDebugDraw::DBG_DrawAabb) - { - Vector3 halfExtents = (to-from)* 0.5f; - Vector3 center = (to+from) *0.5f; - int i,j; - - Vector3 edgecoord(1.f,1.f,1.f),pa,pb; - for (i=0;i<4;i++) - { - for (j=0;j<3;j++) - { - pa = Vector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pa+=center; - - int othercoord = j%3; - edgecoord[othercoord]*=-1.f; - pb = Vector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pb+=center; - - drawLine(pa,pb,color); - } - edgecoord = Vector3(-1.f,-1.f,-1.f); - if (i<3) - edgecoord[i]*=-1.f; - } - } -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawLine(const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color) -{ - if (mDebugMode > 0) - { - addLine (from, to); - } -} -//------------------------------------------------------------------------------------------------ -void DebugDrawer::drawContactPoint(const Ogre::Vector3& PointOnB,const Ogre::Vector3& normalOnB, - Real distance,int lifeTime,const Ogre::Vector3& color) -{ - if (mDebugMode & btIDebugDraw::DBG_DrawContactPoints) - { - - } - //... -} -//------------------------------------------------------------------------------------------------ - Deleted: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugLines.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugLines.cpp 2008-02-16 01:41:26 UTC (rev 569) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugLines.cpp 2008-02-16 01:43:00 UTC (rev 570) @@ -1,162 +0,0 @@ -/*************************************************************************** - -This source file is part of OGREBULLET -(Object-oriented Graphics Rendering Engine Bullet Wrapper) -For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 - -Copyright (c) 2007 tua...@gm... - - - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------ -*/ - -#include "OgreBulletCollisions.h" - -#include "Debug/OgreBulletCollisionsDebugLines.h" -#include "Utils/OgreBulletConverter.h" - -using namespace OgreBulletCollisions; -using namespace Ogre; - -//------------------------------------------------------------------------------------------------ -bool DebugLines::_materials_created = false; -//------------------------------------------------------------------------------------------------ -DebugLines::DebugLines() : SimpleRenderable() -{ - mRenderOp.vertexData = new Ogre::VertexData(); - _drawn = false; - - if (!_materials_created) - { - MaterialPtr red = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Disabled","OgreBulletCollisions"); - MaterialPtr green = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Enabled","OgreBulletCollisions"); - MaterialPtr blue = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Static","OgreBulletCollisions"); - - red->setReceiveShadows(false); - red->getTechnique(0)->setLightingEnabled(true); - red->getTechnique(0)->getPass(0)->setSelfIllumination(1,0,0); - - green->setReceiveShadows(false); - green->getTechnique(0)->setLightingEnabled(true); - green->getTechnique(0)->getPass(0)->setSelfIllumination(0,1,0); - - blue->setReceiveShadows(false); - blue->getTechnique(0)->setLightingEnabled(true); - blue->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,1); - - _materials_created = true; - } - setCastShadows (false); - this->setMaterial("OgreBulletCollisionsDebugLines/Enabled"); -} - - -//------------------------------------------------------------------------------------------------ -void DebugLines::clear() -{ - if (_drawn) - { - _drawn = false; - _points.clear(); - delete mRenderOp.vertexData; - - mRenderOp.vertexData = new Ogre::VertexData(); - } -} -//------------------------------------------------------------------------------------------------ -DebugLines::~DebugLines(void) -{ - clear(); - - delete mRenderOp.vertexData; -} -//------------------------------------------------------------------------------------------------ -void DebugLines::draw() -{ - if (_drawn || _points.empty()) - return; - else - _drawn = true; - - // Initialization stuff - mRenderOp.indexData = 0; - mRenderOp.vertexData->vertexCount = _points.size(); - mRenderOp.vertexData->vertexStart = 0; - mRenderOp.operationType = RenderOperation::OT_LINE_LIST; - mRenderOp.useIndexes = false; - - Ogre::VertexDeclaration *decl = mRenderOp.vertexData->vertexDeclaration; - Ogre::VertexBufferBinding *bind = mRenderOp.vertexData->vertexBufferBinding; - - decl->addElement(0, 0, VET_FLOAT3, VES_POSITION); - - HardwareVertexBufferSharedPtr vbuf = - HardwareBufferManager::getSingleton().createVertexBuffer( - decl->getVertexSize(0), - mRenderOp.vertexData->vertexCount, - HardwareBuffer::HBU_STATIC_WRITE_ONLY); - - bind->setBinding(0, vbuf); - - // Drawing stuff - unsigned int size = (unsigned int)_points.size(); - Ogre::Vector3 vaabMin = _points[0]; - Ogre::Vector3 vaabMax = _points[0]; - - float *prPos = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD)); - - for(unsigned int i = 0; i < size; i++) - { - *prPos++ = _points[i].x; - *prPos++ = _points[i].y; - *prPos++ = _points[i].z; - - if (_points[i].x < vaabMin.x) - vaabMin.x = _points[i].x; - if (_points[i].y < vaabMin.y) - vaabMin.y = _points[i].y; - if (_points[i].z < vaabMin.z) - vaabMin.z = _points[i].z; - - if (_points[i].x > vaabMax.x) - vaabMax.x = _points[i].x; - if (_points[i].y > vaabMax.y) - vaabMax.y = _points[i].y; - if (_points[i].z > vaabMax.z) - vaabMax.z = _points[i].z; - } - - vbuf->unlock(); - - mBox.setExtents(vaabMin, vaabMax); -} -//-------------------------------------------------------------------------... [truncated message content] |