pxStream.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _T3D_PHYSICS_PXSTREAM_H_
  23. #define _T3D_PHYSICS_PXSTREAM_H_
  24. #ifndef _PHYSX_H_
  25. #include "T3D/physics/physX/px.h"
  26. #endif
  27. #ifndef _MEMSTREAM_H_
  28. #include "core/stream/memStream.h"
  29. #endif
  30. class PxMemStream : public NxStream
  31. {
  32. public:
  33. PxMemStream();
  34. virtual ~PxMemStream();
  35. void resetPosition();
  36. // NxStream
  37. NxU8 readByte() const;
  38. NxU16 readWord() const;
  39. NxU32 readDword() const;
  40. float readFloat() const;
  41. double readDouble() const;
  42. void readBuffer( void *buffer, NxU32 size ) const;
  43. NxStream& storeByte( NxU8 b );
  44. NxStream& storeWord( NxU16 w );
  45. NxStream& storeDword( NxU32 d );
  46. NxStream& storeFloat( NxReal f );
  47. NxStream& storeDouble( NxF64 f );
  48. NxStream& storeBuffer( const void* buffer, NxU32 size );
  49. protected:
  50. mutable MemStream mMemStream;
  51. };
  52. class PxConsoleStream : public NxUserOutputStream
  53. {
  54. protected:
  55. // NxUserOutputStream
  56. void reportError( NxErrorCode code, const char *message, const char* file, int line );
  57. NxAssertResponse reportAssertViolation( const char *message, const char *file, int line );
  58. void print( const char *message );
  59. public:
  60. PxConsoleStream();
  61. ~PxConsoleStream();
  62. };
  63. #endif // _T3D_PHYSICS_PXSTREAM_H_