From 7bd70efba79ff81672272dd0dfcf0e5b49fe2a97 Mon Sep 17 00:00:00 2001 From: enn0x Date: Thu, 25 Mar 2010 21:29:52 +0000 Subject: [PATCH] Convenience classes for vehicles and wheels (no members or methods yet). --- panda/src/physx/Sources.pp | 24 +++--- panda/src/physx/physxObject.I | 1 + panda/src/physx/physxScene.I | 1 + panda/src/physx/physxScene.cxx | 22 +++--- panda/src/physx/physxScene.h | 14 ++-- panda/src/physx/physxVehicle.I | 59 +++++++++++++++ panda/src/physx/physxVehicle.cxx | 106 +++++++++++++++++++++++++++ panda/src/physx/physxVehicle.h | 86 ++++++++++++++++++++++ panda/src/physx/physxVehicleDesc.I | 58 +++++++++++++++ panda/src/physx/physxVehicleDesc.cxx | 29 ++++++++ panda/src/physx/physxVehicleDesc.h | 40 ++++++++++ panda/src/physx/physxWheel.I | 59 +++++++++++++++ panda/src/physx/physxWheel.cxx | 81 ++++++++++++++++++++ panda/src/physx/physxWheel.h | 77 +++++++++++++++++++ panda/src/physx/physxWheelDesc.I | 60 +++++++++++++++ panda/src/physx/physxWheelDesc.cxx | 29 ++++++++ panda/src/physx/physxWheelDesc.h | 41 +++++++++++ panda/src/physx/physx_composite.cxx | 8 +- 18 files changed, 760 insertions(+), 35 deletions(-) create mode 100644 panda/src/physx/physxVehicle.I create mode 100644 panda/src/physx/physxVehicle.cxx create mode 100644 panda/src/physx/physxVehicle.h create mode 100644 panda/src/physx/physxVehicleDesc.I create mode 100644 panda/src/physx/physxVehicleDesc.cxx create mode 100644 panda/src/physx/physxVehicleDesc.h create mode 100644 panda/src/physx/physxWheel.I create mode 100644 panda/src/physx/physxWheel.cxx create mode 100644 panda/src/physx/physxWheel.h create mode 100644 panda/src/physx/physxWheelDesc.I create mode 100644 panda/src/physx/physxWheelDesc.cxx create mode 100644 panda/src/physx/physxWheelDesc.h diff --git a/panda/src/physx/Sources.pp b/panda/src/physx/Sources.pp index fe6c950803..2946a650cf 100644 --- a/panda/src/physx/Sources.pp +++ b/panda/src/physx/Sources.pp @@ -119,12 +119,12 @@ physxTriangleMeshShapeDesc.I physxTriangleMeshShapeDesc.h \ physxTriggerReport.I physxTriggerReport.h \ physxUtilLib.I physxUtilLib.h \ + physxVehicle.I physxVehicle.h \ + physxVehicleDesc.I physxVehicleDesc.h \ + physxWheel.I physxWheel.h \ + physxWheelDesc.I physxWheel.h \ physxWheelShape.I physxWheelShape.h \ physxWheelShapeDesc.I physxWheelShapeDesc.h \ - #physxVehicleGears.I physxVehicleGears.h \ - #physxVehicleGearsDesc.I physxVehicleGearsDesc.h \ - #physxVehicleMotor.I physxVehicleMotor.h \ - #physxVehicleMotorDesc.I physxVehicleMotorDesc.h \ #define INCLUDED_SOURCES \ config_physx.cxx \ @@ -235,12 +235,12 @@ physxTriangleMeshShapeDesc.cxx \ physxTriggerReport.cxx \ physxUtilLib.cxx \ + physxVehicle.cxx \ + physxVehicleDesc.cxx \ + physxWheel.cxx \ + physxWheelDesc.cxx \ physxWheelShape.cxx \ physxWheelShapeDesc.cxx \ - #physxVehicleGears.cxx \ - #physxVehicleGearsDesc.cxx \ - #physxVehicleMotor.cxx \ - #physxVehicleMotorDesc.cxx \ #define INSTALL_HEADERS \ config_physx.h \ @@ -351,12 +351,12 @@ physxTriangleMeshShapeDesc.I physxTriangleMeshShapeDesc.h \ physxTriggerReport.I physxTriggerReport.h \ physxUtilLib.I physxUtilLib.h \ + physxVehicle.I physxVehicle.h \ + physxVehicleDesc.I physxVehicleDesc.h \ + physxWheel.I physxWheel.h \ + physxWheelDesc.I physxWheel.h \ physxWheelShape.I physxWheelShape.h \ physxWheelShapeDesc.I physxWheelShapeDesc.h \ - #physxVehicleGears.I physxVehicleGears.h \ - #physxVehicleGearsDesc.I physxVehicleGearsDesc.h \ - #physxVehicleMotor.I physxVehicleMotor.h \ - #physxVehicleMotorDesc.I physxVehicleMotorDesc.h \ #define IGATESCAN all diff --git a/panda/src/physx/physxObject.I b/panda/src/physx/physxObject.I index a84b3fb380..d4d7fc3cb9 100644 --- a/panda/src/physx/physxObject.I +++ b/panda/src/physx/physxObject.I @@ -22,6 +22,7 @@ INLINE PhysxObject:: PhysxObject() { + _error_type = ET_empty; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxScene.I b/panda/src/physx/physxScene.I index 86d4753339..ebf2255730 100644 --- a/panda/src/physx/physxScene.I +++ b/panda/src/physx/physxScene.I @@ -64,5 +64,6 @@ ls(ostream &out, int indent_level) const { _forcefields.ls(out, indent_level); _ffgroups.ls(out, indent_level); _controllers.ls(out, indent_level); + _vehicles.ls(out, indent_level); } diff --git a/panda/src/physx/physxScene.cxx b/panda/src/physx/physxScene.cxx index 3851a0dfcf..a56deee202 100644 --- a/panda/src/physx/physxScene.cxx +++ b/panda/src/physx/physxScene.cxx @@ -20,8 +20,8 @@ #include "physxControllerDesc.h" #include "physxSceneStats2.h" #include "physxConstraintDominance.h" -//#include "physxVehicle.h" -//#include "physxVehicleDesc.h" +#include "physxVehicle.h" +#include "physxVehicleDesc.h" TypeHandle PhysxScene::_type_handle; @@ -67,10 +67,10 @@ link(NxScene *scenePtr) { void PhysxScene:: unlink() { - // Destroy vehicles - //for (unsigned int i=0; i < _vehicles.size(); i++) { - // _vehicles[i]->release(); - //} + // Unlink vehicles + for (unsigned int i=0; i < _vehicles.size(); i++) { + _vehicles[i]->release(); + } // Unlink controllers NxU32 nControllers = _cm->getNbControllers(); @@ -183,10 +183,10 @@ simulate(float dt) { _pcollector_simulate.start(); // Update all vehicles - //for (unsigned int i=0; i < _vehicles.size(); i++) { - // PhysxVehicle *vehicle = _vehicles[i]; - // vehicle->update_vehicle(dt); - //} + for (unsigned int i=0; i < _vehicles.size(); i++) { + PhysxVehicle *vehicle = _vehicles[i]; + vehicle->update_vehicle(dt); + } // Update all controllers for (NxU32 i=0; i < _cm->getNbControllers(); i++) { @@ -856,7 +856,6 @@ get_force_field_shape_group(unsigned int idx) const { return groupPtr ? (PhysxForceFieldShapeGroup *)groupPtr->userData : NULL; } -/* //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_num_vehicles // Access: Published @@ -902,7 +901,6 @@ get_vehicle(unsigned int idx) const { return _vehicles[idx]; } -*/ //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_stats2 diff --git a/panda/src/physx/physxScene.h b/panda/src/physx/physxScene.h index 0950bf5228..535a6ac0f4 100644 --- a/panda/src/physx/physxScene.h +++ b/panda/src/physx/physxScene.h @@ -48,8 +48,8 @@ class PhysxRay; class PhysxRaycastHit; class PhysxRaycastReport; class PhysxSceneStats2; -//class PhysxVehicle; -//class PhysxVehicleDesc; +class PhysxVehicle; +class PhysxVehicleDesc; //////////////////////////////////////////////////////////////////// // Class : PhysxScene @@ -132,10 +132,10 @@ PUBLISHED: MAKE_SEQ(get_force_field_shape_groups, get_num_force_field_shape_groups, get_force_field_shape_group); // Vehicles - //unsigned int get_num_vehicles() const; - //PhysxVehicle *create_vehicle(PhysxVehicleDesc &desc); - //PhysxVehicle *get_vehicle(unsigned int idx) const; - //MAKE_SEQ(get_vehicles, get_num_vehicles, get_vehicle); + unsigned int get_num_vehicles() const; + PhysxVehicle *create_vehicle(PhysxVehicleDesc &desc); + PhysxVehicle *get_vehicle(unsigned int idx) const; + MAKE_SEQ(get_vehicles, get_num_vehicles, get_vehicle); // Raycast queries bool raycast_any_shape(const PhysxRay &ray, @@ -220,7 +220,7 @@ public: PhysxObjectCollection _forcefields; PhysxObjectCollection _ffgroups; PhysxObjectCollection _controllers; - //PhysxObjectCollection _vehicles; + PhysxObjectCollection _vehicles; PhysxMaterial *get_wheel_shape_material(); diff --git a/panda/src/physx/physxVehicle.I b/panda/src/physx/physxVehicle.I new file mode 100644 index 0000000000..d9f6db7f0e --- /dev/null +++ b/panda/src/physx/physxVehicle.I @@ -0,0 +1,59 @@ +// Filename: physxVehicle.I +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxVehicle:: +PhysxVehicle() : PhysxObject() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::Destructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxVehicle:: +~PhysxVehicle() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::ls +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void PhysxVehicle:: +ls() const { + + ls(nout); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::ls +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void PhysxVehicle:: +ls(ostream &out, int indent_level) const { + + indent(out, indent_level) << get_type().get_name() + << " (at 0x" << this << ")\n"; +} + diff --git a/panda/src/physx/physxVehicle.cxx b/panda/src/physx/physxVehicle.cxx new file mode 100644 index 0000000000..aa2cf6f9d4 --- /dev/null +++ b/panda/src/physx/physxVehicle.cxx @@ -0,0 +1,106 @@ +// Filename: physxVehicle.cxx +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "physxVehicle.h" +#include "physxActor.h" +#include "physxWheel.h" +#include "physxScene.h" + +TypeHandle PhysxVehicle::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::create +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void PhysxVehicle:: +create(PhysxScene *scene, PhysxVehicleDesc &desc) { + + nassertv(_error_type == ET_empty); + + _scene = scene; + + // TODO !!! + + _error_type = ET_ok; + _scene->_vehicles.add(this); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::release +// Access: Published +// Description: Destroys this vehicle. +//////////////////////////////////////////////////////////////////// +void PhysxVehicle:: +release() { + + nassertv(_error_type == ET_ok); + + _error_type = ET_released; + _scene->_vehicles.remove(this); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::update_vehicle +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void PhysxVehicle:: +update_vehicle(float dt) { + + nassertv(_error_type == ET_ok); + + // TODO !!! +} + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::get_actor +// Access: Published +// Description: Returns the actor for this vehicle. +//////////////////////////////////////////////////////////////////// +PhysxActor *PhysxVehicle:: +get_actor() const { + + nassertr(_error_type == ET_ok, NULL); + return _actor; +} +*/ + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::get_num_wheels +// Access: Published +// Description: Returns the number of wheels on this vehicle. +//////////////////////////////////////////////////////////////////// +unsigned int PhysxVehicle:: +get_num_wheels() const { + + nassertr(_error_type == ET_ok, 0); + return _wheels.size(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicle::get_wheel +// Access: Published +// Description: Returns the n-th wheel of this vehicle. +//////////////////////////////////////////////////////////////////// +PhysxWheel *PhysxVehicle:: +get_wheel(unsigned int idx) const { + + nassertr(_error_type == ET_ok, NULL); + return _wheels[idx]; +} +*/ + diff --git a/panda/src/physx/physxVehicle.h b/panda/src/physx/physxVehicle.h new file mode 100644 index 0000000000..2dc08dbf67 --- /dev/null +++ b/panda/src/physx/physxVehicle.h @@ -0,0 +1,86 @@ +// Filename: physxVehicle.h +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef PHYSXVEHICLE_H +#define PHYSXVEHICLE_H + +#include "pandabase.h" +#include "pointerToArray.h" + +#include "physxObject.h" +#include "physx_includes.h" + +class PhysxActor; +class PhysxWheel; +class PhysxScene; + +//////////////////////////////////////////////////////////////////// +// Class : PhysxVehicle +// Description : +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAPHYSX PhysxVehicle : public PhysxObject { + +PUBLISHED: + INLINE PhysxVehicle(); + INLINE ~PhysxVehicle(); + + //PhysxActor *get_actor() const; + + //unsigned int get_num_wheels() const; + //PhysxWheel *get_wheel(unsigned int idx) const; + //MAKE_SEQ(get_wheels, get_num_wheels, get_wheel); + + INLINE void ls() const; + INLINE void ls(ostream &out, int indent_level=0) const; + +private: + +//////////////////////////////////////////////////////////////////// +PUBLISHED: + void release(); + +public: + void create(PhysxScene *scene, PhysxVehicleDesc &desc); + void update_vehicle(float dt); + +private: + PTA(PT(PhysxWheel)) _wheels; + PT(PhysxActor) _actor; + PT(PhysxScene) _scene; + +//////////////////////////////////////////////////////////////////// +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + PhysxObject::init_type(); + register_type(_type_handle, "PhysxVehicle", + PhysxObject::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() { + init_type(); + return get_class_type(); + } + +private: + static TypeHandle _type_handle; +}; + +#include "physxVehicle.I" + +#endif // PHYSXVEHICLE_H diff --git a/panda/src/physx/physxVehicleDesc.I b/panda/src/physx/physxVehicleDesc.I new file mode 100644 index 0000000000..3e798b3984 --- /dev/null +++ b/panda/src/physx/physxVehicleDesc.I @@ -0,0 +1,58 @@ +// Filename: physxVehicleDesc.I +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicleDesc::Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxVehicleDesc:: +PhysxVehicleDesc() { + + set_to_default(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicleDesc::Destructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxVehicleDesc:: +~PhysxVehicleDesc() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicleDesc::set_to_default +// Access: Published +// Description: (re)sets the structure to the default. +//////////////////////////////////////////////////////////////////// +INLINE void PhysxVehicleDesc:: +set_to_default() { + + // TODO +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicleDesc::is_valid +// Access: Published +// Description: Returns true if the descriptor is valid. +//////////////////////////////////////////////////////////////////// +INLINE bool PhysxVehicleDesc:: +is_valid() const { + + return true; +} + diff --git a/panda/src/physx/physxVehicleDesc.cxx b/panda/src/physx/physxVehicleDesc.cxx new file mode 100644 index 0000000000..cbe88a6da6 --- /dev/null +++ b/panda/src/physx/physxVehicleDesc.cxx @@ -0,0 +1,29 @@ +// Filename: physxVehicleDesc.cxx +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "physxVehicleDesc.h" + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxVehicleDesc::add_wheel +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void PhysxVehicleDesc:: +add_wheel(PhysxWheelDesc *wheelDesc) { + + _wheels.push_back(wheelDesc); +} +*/ + diff --git a/panda/src/physx/physxVehicleDesc.h b/panda/src/physx/physxVehicleDesc.h new file mode 100644 index 0000000000..92fa67bb07 --- /dev/null +++ b/panda/src/physx/physxVehicleDesc.h @@ -0,0 +1,40 @@ +// Filename: physxVehicleDesc.h +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef PHYSXVEHICLEDESC_H +#define PHYSXVEHICLEDESC_H + +#include "pandabase.h" + +#include "physx_includes.h" + +//////////////////////////////////////////////////////////////////// +// Class : PhysxVehicleDesc +// Description : +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAPHYSX PhysxVehicleDesc : public ReferenceCount { + +PUBLISHED: + INLINE PhysxVehicleDesc(); + INLINE ~PhysxVehicleDesc(); + + INLINE void set_to_default(); + INLINE bool is_valid() const; + +public: +}; + +#include "physxVehicleDesc.I" + +#endif // PHYSXVEHICLEDESC_H diff --git a/panda/src/physx/physxWheel.I b/panda/src/physx/physxWheel.I new file mode 100644 index 0000000000..6656f998b9 --- /dev/null +++ b/panda/src/physx/physxWheel.I @@ -0,0 +1,59 @@ +// Filename: physxWheel.I +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxWheel:: +PhysxWheel() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::Destructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxWheel:: +~PhysxWheel() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::ls +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void PhysxWheel:: +ls() const { + + ls(nout); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::ls +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void PhysxWheel:: +ls(ostream &out, int indent_level) const { + + indent(out, indent_level) << get_type().get_name() + << " (at 0x" << this << ")\n"; +} + diff --git a/panda/src/physx/physxWheel.cxx b/panda/src/physx/physxWheel.cxx new file mode 100644 index 0000000000..d69ae091c1 --- /dev/null +++ b/panda/src/physx/physxWheel.cxx @@ -0,0 +1,81 @@ +// Filename: physxWheel.cxx +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "physxWheel.h" +#include "physxWheelDesc.h" +#include "physxWheelShape.h" + +TypeHandle PhysxWheel::_type_handle; + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::get_wheel_shape +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +PhysxWheelShape *PhysxWheel:: +get_wheel_shape() const { + + return _wheelShape; +} +*/ + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::attach_node_path +// Access: Published +// Description: Attaches a node path to this wheel. The node +// path's transform will be updated automatically. +// +// Note: any non-uniform scale or shear set on the +// NodePath's transform will be overwritten at the +// time of the first update. +//////////////////////////////////////////////////////////////////// +void PhysxWheel:: +attach_node_path(const NodePath &np) { + + nassertv(_error_type == ET_ok); + nassertv_always(!np.is_empty()); + _np = NodePath(np); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::detach_node_path +// Access: Published +// Description: Detaches a previously assigned NodePath from this +// wheel. The NodePath's transform will no longer +// be updated. +//////////////////////////////////////////////////////////////////// +void PhysxWheel:: +detach_node_path() { + + nassertv(_error_type == ET_ok); + _np = NodePath(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheel::get_node_path +// Access: Published +// Description: Retrieves a previously attached NodePath. An empty +// NodePath will be returned if no NodePath has been +// attached to this wheel. +//////////////////////////////////////////////////////////////////// +NodePath PhysxWheel:: +get_node_path() const { + + nassertr(_error_type == ET_ok, NodePath::fail()); + return _np; +} +*/ + diff --git a/panda/src/physx/physxWheel.h b/panda/src/physx/physxWheel.h new file mode 100644 index 0000000000..0a2cfc6415 --- /dev/null +++ b/panda/src/physx/physxWheel.h @@ -0,0 +1,77 @@ +// Filename: physxWheel.h +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef PHYSXWHEEL_H +#define PHYSXWHEEL_H + +#include "pandabase.h" +#include "nodePath.h" + +#include "physxObject.h" +#include "physx_includes.h" + +class PhysxWheelDesc; +class PhysxWheelShape; + +//////////////////////////////////////////////////////////////////// +// Class : PhysxWheel +// Description : +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAPHYSX PhysxWheel : public PhysxObject { + +PUBLISHED: + INLINE PhysxWheel(); + INLINE ~PhysxWheel(); + + //PhysxActor *get_touched_actor() const; + //PhysxWheelShape *get_wheel_shape() const; + + //void attach_node_path(const NodePath &np); + //void detach_node_path(); + //NodePath get_node_path() const; + + INLINE void ls() const; + INLINE void ls(ostream &out, int indent_level=0) const; + +public: + +private: + PT(PhysxWheelShape) _wheelShape; + NodePath _np; + +//////////////////////////////////////////////////////////////////// +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + PhysxObject::init_type(); + register_type(_type_handle, "PhysxWheel", + PhysxObject::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() { + init_type(); + return get_class_type(); + } + +private: + static TypeHandle _type_handle; +}; + +#include "physxWheel.I" + +#endif // PHYSXWHEEL_H diff --git a/panda/src/physx/physxWheelDesc.I b/panda/src/physx/physxWheelDesc.I new file mode 100644 index 0000000000..8027d50aab --- /dev/null +++ b/panda/src/physx/physxWheelDesc.I @@ -0,0 +1,60 @@ +// Filename: physxWheelDesc.I +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheelDesc::Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxWheelDesc:: +PhysxWheelDesc() { + + set_to_default(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheelDesc::Destructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE PhysxWheelDesc:: +~PhysxWheelDesc() { + +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheelDesc::set_to_default +// Access: Published +// Description: (re)sets the structure to the default. +//////////////////////////////////////////////////////////////////// +INLINE void PhysxWheelDesc:: +set_to_default() { + + // TODO +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheelDesc::is_valid +// Access: Published +// Description: Returns true if the descriptor is valid. +//////////////////////////////////////////////////////////////////// +INLINE bool PhysxWheelDesc:: +is_valid() const { + + // TODO + + return true; +} + diff --git a/panda/src/physx/physxWheelDesc.cxx b/panda/src/physx/physxWheelDesc.cxx new file mode 100644 index 0000000000..3bcfabff5a --- /dev/null +++ b/panda/src/physx/physxWheelDesc.cxx @@ -0,0 +1,29 @@ +// Filename: physxWheelDesc.cxx +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "physxWheelDesc.h" + +/* +//////////////////////////////////////////////////////////////////// +// Function: PhysxWheelDesc::set_wheel_radius +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void PhysxWheelDesc:: +set_wheel_radius(float wheelRadius) { + + _wheelRadius = wheelRadius; +} +*/ + diff --git a/panda/src/physx/physxWheelDesc.h b/panda/src/physx/physxWheelDesc.h new file mode 100644 index 0000000000..a987b57fdc --- /dev/null +++ b/panda/src/physx/physxWheelDesc.h @@ -0,0 +1,41 @@ +// Filename: physxWheelDesc.h +// Created by: enn0x (23Mar10) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef PHYSXWHEELDESC_H +#define PHYSXWHEELDESC_H + +#include "pandabase.h" +#include "lpoint3.h" + +#include "physx_includes.h" + +//////////////////////////////////////////////////////////////////// +// Class : PhysxWheelDesc +// Description : +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAPHYSX PhysxWheelDesc : public ReferenceCount { + +PUBLISHED: + INLINE PhysxWheelDesc(); + INLINE ~PhysxWheelDesc(); + + INLINE void set_to_default(); + INLINE bool is_valid() const; + +public: +}; + +#include "physxWheelDesc.I" + +#endif // PHYSXWHEELDESC_H diff --git a/panda/src/physx/physx_composite.cxx b/panda/src/physx/physx_composite.cxx index aa24f878a0..c0cd07946a 100644 --- a/panda/src/physx/physx_composite.cxx +++ b/panda/src/physx/physx_composite.cxx @@ -106,13 +106,13 @@ #include "physxTriangleMeshShapeDesc.cxx" #include "physxTriggerReport.cxx" #include "physxUtilLib.cxx" -//#include "physxVehicle.cxx" -//#include "physxVehicleDesc.cxx" +#include "physxVehicle.cxx" +#include "physxVehicleDesc.cxx" //#include "physxVehicleGears.cxx" //#include "physxVehicleGearsDesc.cxx" //#include "physxVehicleMotor.cxx" //#include "physxVehicleMotorDesc.cxx" -//#include "physxWheel.cxx" -//#include "physxWheelDesc.cxx" +#include "physxWheel.cxx" +#include "physxWheelDesc.cxx" #include "physxWheelShape.cxx" #include "physxWheelShapeDesc.cxx"