Revision: 602
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=602&view=rev
Author: andy_miller
Date: 2008-06-21 23:25:12 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
Added missing nxogre files
Added Paths:
-----------
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacterSweep.h
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.cpp 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,186 @@
+/** \file NxOgreCharacter.cpp
+ * \see NxOgreCharacter.h
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "NxOgreStable.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreCharacter.h"
+#include "NxOgreScene.h"
+#include "NxOgreNxActorController.h"
+#include "NxOgreKinematicCharacter.h"
+
+#include "NxOgreCharacterModel.h"
+#include "NxOgreCharacterMovementModel.h"
+
+#include "NxOgreVoidPointer.h"
+#include "NxOgreTimeStep.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+/////////////////////////////////////////////////////////////
+
+void CharacterParams::setToDefault() {
+
+#if (NX_USE_CHARACTER_API == 1)
+ mControllerType = CT_KINEMATIC;
+#else
+ mControllerType = CT_NXACTOR;
+#endif
+
+ mControllerPtr = 0;
+ mStepOffset = 0.0f;
+ mSlopeLimit = 0.0f;
+ mUpDirection = NX_AXIS_PLUS_Y;
+ //mGroupMask;
+ mControllerCollisionShape = 0;
+
+}
+
+/////////////////////////////////////////////////////////////
+
+Character::Character(const NxString& identifier, Pose pose, CharacterModel* model, CharacterParams params, Scene* scene)
+: mName(identifier), mModel(model), mOwner(scene), mVoidPointer(0)
+{
+
+ if (model == 0) {
+ NxThrow("Character Model pointer is null!");
+ mDead = true;
+ return;
+ }
+
+ if (params.mControllerType == params.CT_PTR && params.mControllerPtr == 0) {
+ NxThrow("ControllerType is custom but given pointer is null!");
+ mDead = true;
+ return;
+ }
+
+ mVoidPointer = new VoidPointer(this, NxOgreClass_Character);
+
+ // (TODO) Pass on voidpointer to controllers here.
+ if (params.mControllerType == CharacterParams::CT_NXACTOR) {
+ mController = NxNew(NxActorController)(pose, params.mControllerCollisionShape, scene, mVoidPointer);
+ }
+#if (NX_USE_CHARACTER_API == 1)
+ else if (params.mControllerType == CharacterParams::CT_KINEMATIC) {
+ mController = NxNew(KinematicCharacter)(pose, params.mControllerCollisionShape, scene, mVoidPointer);
+ }
+#endif
+ else {
+ mController = params.mControllerPtr;
+ NxWatch(CharacterController, mController);
+ }
+
+ // Watch Model and set the garbage collection mode.
+ NxWatch(CharacterModel, mModel);
+ mModel->setGC();
+
+ // Current movement model to default.
+ mCurrentMovement = mModel->mDefaultMovementModel;
+
+ // Reset all movemenet models to this.
+ for (CharacterMovementModel* model = mModel->mMovementModels.begin(); model = mModel->mMovementModels.next();) {
+ model->reset(this);
+ }
+
+ mCurrentMovement->enter(0, mController->getPose());
+
+ mOwner->_registerCharacter(mName, this);
+}
+
+/////////////////////////////////////////////////////////////
+
+Character::~Character() {
+
+ mOwner->_unregisterCharacter(mName);
+
+ mCurrentMovement->exit();
+
+ // Delete bleh bleh here.
+ if (mModel->mDeletionPolicy == GC_Delete)
+ NxDelete(mModel);
+
+
+ delete mController;
+ delete mVoidPointer;
+
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::simulate(const TimeStep& ts) {
+
+ mCurrentMovement->simulate(ts.Delta);
+
+ // get new movement vector
+ const NxVec3 movementVector = mCurrentMovement->getGlobalMovementVector(ts.Delta);
+
+ // get controller to move that vector.
+ mController->move(movementVector);
+
+ mCurrentMovement->setPose(mController->getPose());
+ mCurrentMovement->simulateAfter(ts.Delta);
+
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::forward() {
+ mCurrentMovement->forward();
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::backward() {
+ mCurrentMovement->backward();
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::left() {
+ mCurrentMovement->left();
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::right() {
+ mCurrentMovement->right();
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::up() {
+ mCurrentMovement->up();
+}
+
+/////////////////////////////////////////////////////////////
+
+void Character::down() {
+ mCurrentMovement->down();
+}
+
+/////////////////////////////////////////////////////////////
+
+}; // End of Character namespace.
+}; // End of NxOgre namespace.
+
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacter.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,199 @@
+/** \file NxOgreCharacter.h
+ * \brief Header for the CharacterParams and Character classes.
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __NXOGRE_CHARACTER_H__
+#define __NXOGRE_CHARACTER_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreParams.h"
+#include "NxOgrePose.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+
+ class NxPublicClass CharacterParams : public Params {
+
+ public:
+
+ CharacterParams() {
+ setToDefault();
+ }
+
+ CharacterParams(const char* p) {
+ process(p);
+ }
+
+ CharacterParams(NxString p) {
+ process(p);
+ }
+
+ void setToDefault();
+
+ enum ControllerType {
+#if (NX_USE_CHARACTER_API == 1)
+ CT_KINEMATIC,
+#endif
+ CT_NXACTOR,
+ CT_PTR
+ };
+
+ ControllerType mControllerType;
+ CharacterController* mControllerPtr;
+
+ NxReal mStepOffset;
+ NxRadian mSlopeLimit;
+ NxAxisType mUpDirection;
+ NxGroupsMask mGroupMask;
+
+ /** \brief Collision shape for NxActor and NxCharacter controllers.
+ \note The function "setToDefault" sets the pointer to zero. You
+ have to assign one after setting the basic params using
+ the new operator or the SimpleShape::createShapeFromString method
+
+ \see Controllers for what shapes they can and cannot use
+ \see SimpleShape::createShapeFromString
+
+
+ */
+
+ SimpleShape* mControllerCollisionShape;
+
+
+ };
+
+ /////////////////////////////////////////////////////////
+
+ /** Character
+
+ */
+ class NxPublicClass Character {
+
+ public:
+
+ enum LocalMovementDirection {
+ LMD_FORWARD = 0,
+ LMD_BACKWARD = 1,
+ LMD_LEFT = 2,
+ LMD_RIGHT = 3,
+ LMB_UP = 4,
+ LMB_DOWN = 5
+ };
+
+ Character(const NxString& identifier, Pose, CharacterModel*, CharacterParams, Scene*);
+ virtual ~Character();
+
+ NxString getName() const {return mName;}
+
+ virtual void simulate(const TimeStep&);
+
+ CharacterController* getController() const {
+ return mController;
+ }
+
+ CharacterModel* getModel() const {
+ return mModel;
+ }
+
+ CharacterMovementModel* getCurrentMovementModel() const {
+ return mCurrentMovement;
+ }
+
+ void setModel(CharacterModel* newModel) {
+ mModel = newModel;
+ resetMovement();
+ }
+
+ void resetMovement() {}
+ void setMovement(NxString movement);
+ void setMovement(Ogre::Vector3 movementVector);
+ void setLocalMovement(Ogre::Vector3 movementVector);
+
+ inline void forward();
+ inline void backward();
+ inline void left();
+ inline void right();
+ inline void up();
+ inline void down();
+
+ void injectMovement(LocalMovementDirection);
+ void setDirection(const NxQuat& orientation);
+ void setDirection(const Ogre::Quaternion& orientation);
+ void moveTowards(Ogre::Vector3 globalPosition, NxReal force);
+ void setYaw(NxRadian Yaw);
+ void setYaw(Ogre::Radian Yaw);
+ void setPitch(NxRadian Pitch);
+ void setPitch(Ogre::Radian Pitch);
+ void setRoll(NxRadian Roll);
+ void setRoll(Ogre::Radian Roll);
+
+
+ /** \brief Forces height to a new one, without a transitional movement period.
+ Forces the local height of the character shape to a new one whilst moving
+ the character to half-height below.
+
+ \param height Height of the character
+ */
+ void setHeight(NxReal height);
+
+
+ /** \brief Forces height to a new one, with a transitional movement period.
+ Forces the local height of the character shape to a new one whilst leaving it
+ at the existing position. Naturaly gravity or a custom vector will kick in and
+ move the character into the correct new position over the upcoming frames.
+
+ \param height Height of the character
+ */
+ void changeHeight(NxReal height);
+
+ void setSize(const NxVec3& size);
+ void setSize(const float2& size);
+
+ void setGravityEnabled(bool);
+ bool isGravityEnabled();
+
+ bool isDead() const {return mDead;}
+
+ protected:
+
+ CharacterController* mController;
+ CharacterModel* mModel;
+ CharacterMovementModel* mCurrentMovement;
+
+ NxString mName;
+ Scene* mOwner;
+ VoidPointer* mVoidPointer;
+
+ private:
+
+ bool mDead;
+
+ };
+
+ ////////////////////////////////////////////
+};// End of CharacterSystem
+};// End of namespace
+
+#endif
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.cpp 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,45 @@
+/** \file NxOgreCharacterController.cpp
+ * \see NxOgreCharacterController.h
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "NxOgreStable.h"
+
+#include "NxOgreCharacterController.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+////////////////////////////////////////////////////
+
+CharacterController::CharacterController(Scene* scene, VoidPointer*)
+: mScene(scene) {
+
+}
+
+////////////////////////////////////////////////////
+
+CharacterController::~CharacterController() {
+
+}
+
+////////////////////////////////////////////////////
+
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace.
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterController.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,96 @@
+/** \file NxOgreCharacterController.h
+ * \brief Header for the CharacterController class.
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef __NXOGRE_CHARACTER_CONTROLLER_H__
+#define __NXOGRE_CHARACTER_CONTROLLER_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+ class NxPublicClass CharacterController {
+
+ friend class Character;
+
+ public:
+
+ CharacterController(Scene*, VoidPointer*);
+ virtual ~CharacterController();
+
+ virtual NxActorGroup getActorGroup() {return 0;}
+ virtual NxCollisionGroup getCollisionGroup() {return 0;}
+
+ virtual void setActorGroup(NxActorGroup) {}
+ virtual void setCollisionGroup(NxCollisionGroup) {}
+
+ virtual void init(NxMat34 pose) {}
+
+ virtual void move(const NxVec3& direction) {}
+
+ virtual void setPosition(const NxVec3& position) {}
+ virtual NxVec3 getPosition() const {return NxVec3(0,0,0);}
+
+ virtual void setOrientation(const NxQuat& orientation) {}
+ virtual NxQuat getOrientation() const {NxQuat quat;quat.id();return quat;}
+
+ virtual NxMat34 getPose() const {NxMat34 m;m.id();return m;}
+
+ virtual void setSize(const NxVec3& size) {}
+ virtual void getSize(NxVec3& size) {}
+
+ virtual void setSize(const float2& size) {}
+ virtual void getSize(float2& size) {}
+
+ virtual void setStepSize(NxReal stepSize) {}
+ virtual NxReal getStepSize() const {return 0;}
+
+ virtual void setSlopeLimit(NxRadian slopeLimit) {}
+ virtual NxRadian getSlopeLimit() const {return 0;}
+
+ virtual void setGravityEnabled(bool gravity) {}
+ virtual bool getGravityEnabled() const {return false;}
+
+ virtual void setUpDirection(NxVec3 upDirection) {}
+ virtual NxVec3 getUpDirection() const {return NxVec3(0,0,0);}
+
+
+ virtual NxString getType() { return NxString("CharacterController"); };
+
+ /////////////////////////////////////////////////
+
+ Scene* mScene;
+
+ private:
+
+
+ };
+
+ ////////////////////////////////////////////
+
+};// End of CharacterSystem namespace.
+};// End of NxOgre namespace.
+
+#endif
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.cpp 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,26 @@
+/** \file NxOgreCharacterModel.cpp
+ * \see NxOgreCharacterModel.h
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "NxOgreStable.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+# include "NxOgreCharacterModel.h"
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterModel.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,63 @@
+/** \file NxOgreCharacterModel.h
+ * \brief Header for the CharacterModel class.
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __NXOGRE_CHARACTER_MODEL_H__
+#define __NXOGRE_CHARACTER_MODEL_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreContainer.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+ class NxPublicClass CharacterModel {
+
+ friend class Character;
+
+ public:
+
+ virtual ~CharacterModel() {}
+
+ CharacterMovementModel* mDefaultMovementModel;
+ CharacterMovementModels mMovementModels;
+
+ protected:
+
+ virtual void setGC() {
+ mDeletionPolicy = GC_Delete;
+ }
+
+ GarbageCollectionPolicy mDeletionPolicy;
+
+ private:
+
+ };
+
+ ////////////////////////////////////////////
+
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace.
+
+#endif
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.cpp 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,28 @@
+/** \file NxOgreCharacterMovementModel.cpp
+ * \see NxOgreCharacterMovementModel.h
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "NxOgreStable.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreCharacterMovementModel.h"
+
+
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreCharacterMovementModel.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,95 @@
+/** \file NxOgreCharacterMovementModel.h
+ * \brief Header for the CharacterMovementModel class.
+ * \version 1.0-20
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __NXOGRE_CHARACTER_MOVEMENT_MODEL_H__
+#define __NXOGRE_CHARACTER_MOVEMENT_MODEL_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreHelpers.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+ class NxPublicClass CharacterMovementModel {
+
+ public:
+
+ virtual void enter(CharacterMovementModel* from, NxMat34 pose) {mPose = pose;mMovement.zero();mOrientation.id();}
+ virtual NxMat34 exit() {return mPose;}
+
+ virtual void simulate(NxReal dTime) {}
+ virtual void simulateAfter(NxReal dTime) {}
+ virtual void reset(Character* c) {mCharacter = c;}// mPose = c->getPose();}
+ virtual void forward() {}
+ virtual void backward() {}
+ virtual void left() {}
+ virtual void right() {}
+ virtual void up() {}
+ virtual void down() {}
+
+ virtual void setYaw(NxRadian yaw) {
+ // mOrientation
+ }
+
+ void setPose(NxMat34 pose) {mPose = pose;}
+ virtual void setPitch(NxRadian pitch) {}
+ virtual void setRoll(NxRadian roll) {}
+
+ virtual void setOrientation(NxQuat orientation) {}
+ virtual NxQuat getOrientation() { NxQuat quat;
+ mPose.M.toQuat(quat);
+ return quat;}
+
+ virtual NxString getType() {return NxString("Default");}
+
+ virtual NxVec3 getGlobalMovementVector(NxReal dT) {
+ return (mOrientation * mMovement) * dT;
+ }
+
+ virtual NxVec3 getMovementVector() {
+ return mMovement;
+ }
+
+ virtual NxQuat getGlobalOrientation() {
+ return mOrientation;
+ }
+
+ protected:
+
+ Character* mCharacter;
+ NxMat34 mPose;
+ NxVec3 mMovement;
+ NxQuat mOrientation;
+
+ private:
+
+ };
+
+ ////////////////////////////////////////////
+
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace.
+
+#endif
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.cpp 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,204 @@
+/** \file NxOgreKinematicCharacter.cpp
+ * \see NxOgreKinematicCharacter.h
+ * \version 1.0-21
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "NxOgreStable.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreKinematicCharacter.h"
+#include "NxOgreSimpleShape.h"
+#include "NxOgreVoidPointer.h"
+#include "NxOgreScene.h"
+
+// BoxController.cpp, 42
+#define NX_KINEMATIC_CHARACTER_SHAPE_DELTA 0.8
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+////////////////////////////////////////////////////
+
+KinematicCharacter::KinematicCharacter(NxMat34 pose, SimpleShape* shape, Scene* scene, VoidPointer* vptr)
+: CharacterController(scene, vptr), mActor(0), mUserData(0), mShapeUserData(0)
+{
+ NxActorDesc a_desc;
+ NxBodyDesc b_desc;
+ a_desc.body = &b_desc;
+
+ if (shape->getType() == SimpleShape::SST_Box) {
+
+ SimpleBox* box = shape->getAsBox();
+ NxBoxShapeDesc shape_desc;
+ shape_desc.dimensions = (box->getDimensionsAsNxVec3() * 0.5f) * NX_KINEMATIC_CHARACTER_SHAPE_DELTA;
+ mShapeUserData = NxNew(VoidPointer)(vptr->Ptr, NxOgreClass_CharacterShape, vptr->RenderPtr);
+ shape_desc.userData = mShapeUserData;
+ a_desc.shapes.pushBack(&shape_desc);
+
+ }
+ else if (shape->getType() == SimpleShape::SST_Capsule) {
+
+ SimpleCapsule* capsule = shape->getAsCapsule();
+ NxCapsuleShapeDesc shape_desc;
+ shape_desc.radius = capsule->getRadius() * NX_KINEMATIC_CHARACTER_SHAPE_DELTA;
+ shape_desc.height = capsule->getHeight() * NX_KINEMATIC_CHARACTER_SHAPE_DELTA;
+ mShapeUserData = NxNew(VoidPointer)(vptr->Ptr, NxOgreClass_CharacterShape, vptr->RenderPtr);
+ shape_desc.userData = mShapeUserData;
+ a_desc.shapes.pushBack(&shape_desc);
+
+ }
+ else {
+ NxThrow("Invalid shape passed to KinematicCharacter must be capsule or box");
+ return;
+ }
+
+ a_desc.density = 10.0f;
+ a_desc.globalPose = pose;
+ b_desc.flags |= NX_BF_KINEMATIC;
+ a_desc.userData = (void*) vptr;
+
+ NxDelete(shape);
+
+ mActor = mScene->getNxScene()->createActor(a_desc);
+
+}
+
+////////////////////////////////////////////////////
+
+KinematicCharacter::~KinematicCharacter() {
+ NxDelete(mShapeUserData);
+ if (mActor)
+ mScene->getNxScene()->releaseActor(*mActor);
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::init(NxMat34 pose) {
+ // move mActor to pose.
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::move(const NxVec3& direction) {
+ // Ahhh. So temp, so very temp.
+ mActor->moveGlobalPosition(getPosition() + direction);
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setPosition(const NxVec3& position) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxVec3 KinematicCharacter::getPosition() const {
+ // Temp.
+ return mActor->getGlobalPosition();
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setOrientation(const NxQuat& orientation) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxQuat KinematicCharacter::getOrientation() const {
+ NxQuat q;q.id();
+ return q;
+}
+
+////////////////////////////////////////////////////
+
+NxMat34 KinematicCharacter::getPose() const {
+ // Temp.
+ return mActor->getGlobalPose();
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setSize(const NxVec3& size) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxVec3 KinematicCharacter::getSize() const {
+ return NxVec3(0,0,0);
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setStepSize(NxReal stepSize) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxReal KinematicCharacter::getStepSize() const {
+ return 0;
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setSlopeLimit(NxRadian slopeLimit) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxRadian KinematicCharacter::getSlopeLimit() const {
+ return 0;
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setGravityEnabled(bool gravity) {
+
+}
+
+////////////////////////////////////////////////////
+
+bool KinematicCharacter::getGravityEnabled() const {
+ return false;
+}
+
+////////////////////////////////////////////////////
+
+void KinematicCharacter::setUpDirection(NxVec3 upDirection) {
+
+}
+
+////////////////////////////////////////////////////
+
+NxVec3 KinematicCharacter::getUpDirection() const {
+ return NxVec3(0,0,0);
+}
+
+////////////////////////////////////////////////////
+
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace.
+
+#undef NX_KINEMATIC_CHARACTER_SHAPE_DELTA
+
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacter.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,107 @@
+/** \file NxOgreKinematicCharacter.h
+ * \brief Header for the KinematicCharacter class.
+ * \version 1.0-21
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __NXOGRE_KINEMATIC_CHARACTER_H__
+#define __NXOGRE_KINEMATIC_CHARACTER_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreCharacterController.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+
+ /** \brief Kinematic based Character.
+ */
+ class NxPublicClass KinematicCharacter : public CharacterController {
+
+ friend class Character;
+
+ protected:
+
+ KinematicCharacter(NxMat34 pose, SimpleShape*, Scene*, VoidPointer*);
+
+ public:
+
+ virtual ~KinematicCharacter();
+
+
+ NxActorGroup getActorGroup() {return 0;}
+ NxCollisionGroup getCollisionGroup() {return 0;}
+
+ void setActorGroup(NxActorGroup) {}
+ void setCollisionGroup(NxCollisionGroup) {}
+
+ NxActor* getActor() {
+ return mActor;
+ }
+
+ VoidPointer* getUserData() {
+ return mUserData;
+ }
+
+ protected:
+
+ void init(NxMat34 pose);
+
+ void move(const NxVec3& direction);
+
+ void setPosition(const NxVec3& position);
+ NxVec3 getPosition() const;
+
+ void setOrientation(const NxQuat& orientation);
+ NxQuat getOrientation() const;
+
+ NxMat34 getPose() const;
+
+ void setSize(const NxVec3& size);
+ NxVec3 getSize() const;
+
+ void setStepSize(NxReal stepSize);
+ NxReal getStepSize() const;
+
+ void setSlopeLimit(NxRadian slopeLimit);
+ NxRadian getSlopeLimit() const;
+
+ void setGravityEnabled(bool gravity);
+ bool getGravityEnabled() const;
+
+ void setUpDirection(NxVec3 upDirection);
+ NxVec3 getUpDirection() const;
+
+ virtual NxString getType() const { return NxString("NxActorController"); };
+
+ private:
+
+ NxActor* mActor;
+ VoidPointer* mUserData;
+ VoidPointer* mShapeUserData;
+ NxVec3 mUpDirection;
+
+ };
+
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace.
+
+#endif
+#endif
Added: trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacterSweep.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacterSweep.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/NxOgreKinematicCharacterSweep.h 2008-06-22 06:25:12 UTC (rev 602)
@@ -0,0 +1,41 @@
+/** \file NxOgreKinematicCharacter.h
+ * \brief Header for the KinematicCharacter class.
+ * \version 1.0-21
+ *
+ * \licence NxOgre a wrapper for the PhysX physics library.
+ * Copyright (C) 2005-8 Robin Southern of NxOgre.org http://www.nxogre.org
+ * This library 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.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __NXOGRE_KINEMATIC_CHARACTER_SWEEP_H__
+#define __NXOGRE_KINEMATIC_CHARACTER_SWEEP_H__
+
+#include "NxOgrePrerequisites.h"
+
+#if (NX_USE_LEGACY_NXCONTROLLER == 0)
+
+#include "NxOgreCharacterController.h"
+
+namespace NxOgre {
+namespace CharacterSystem {
+namespace Kinematic {
+ // Lots of classes, defines, structs and what not go in here.
+
+}; // End of Kinematic namespace.
+}; // End of CharacterSystem namespace.
+}; // End of NxOgre namespace
+
+#endif
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|