Panda3D

physxHeightField.h

00001 // Filename: physxHeightField.h
00002 // Created by:  enn0x (15Oct09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PHYSXHEIGHTFIELD_H
00016 #define PHYSXHEIGHTFIELD_H
00017 
00018 #include "pandabase.h"
00019 #include "luse.h"
00020 
00021 #include "physxObject.h"
00022 #include "physxContactReport.h"
00023 #include "physxControllerReport.h"
00024 #include "physxTriggerReport.h"
00025 #include "physx_includes.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : PhysxHeightField
00029 // Description : A height field object. 
00030 //               Height fields work in a similar way as triangle
00031 //               meshes specified to act as height fields, with
00032 //               some important differences:
00033 //
00034 //               Triangle meshes can be made of nonuniform geometry,
00035 //               while height fields are regular, rectangular grids.
00036 //               This means that with PhysxHeightField, you
00037 //               sacrifice flexibility in return for improved
00038 //               performance and decreased memory consumption.
00039 //
00040 //               Height fields are referenced by shape instances of
00041 //               type PhysxHeightFieldShape.
00042 //
00043 //               To create an instance of this class call
00044 //               PhysxManager::create_height_field(), and
00045 //               PhysxHeightField::release() to release it. This is
00046 //               only possible once you have released all of its
00047 //               PhysxHeightFiedShape instances before.
00048 ////////////////////////////////////////////////////////////////////
00049 class EXPCL_PANDAPHYSX PhysxHeightField : public PhysxObject {
00050 
00051 PUBLISHED:
00052   void release();
00053 
00054   unsigned int get_reference_count() const;
00055   float get_height(float x, float y) const;
00056 
00057   INLINE void ls() const;
00058   INLINE void ls(ostream &out, int indent_level=0) const;
00059 
00060 public:
00061   INLINE PhysxHeightField();
00062   INLINE ~PhysxHeightField();
00063 
00064   INLINE NxHeightField *ptr() const { return _ptr; };
00065 
00066   void link(NxHeightField *ptr);
00067   void unlink();
00068 
00069 private:
00070   NxHeightField *_ptr;
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 public:
00074   static TypeHandle get_class_type() {
00075     return _type_handle;
00076   }
00077   static void init_type() {
00078     PhysxObject::init_type();
00079     register_type(_type_handle, "PhysxHeightField", 
00080                   PhysxObject::get_class_type());
00081   }
00082   virtual TypeHandle get_type() const {
00083     return get_class_type();
00084   }
00085   virtual TypeHandle force_init_type() {
00086     init_type();
00087     return get_class_type();
00088   }
00089 
00090 private:
00091   static TypeHandle _type_handle;
00092 };
00093 
00094 #include "physxHeightField.I"
00095 
00096 #endif // PHYSXHEIGHTFIELD_H
 All Classes Functions Variables Enumerations