| 1 | /* |
| 2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation |
| 6 | * and any modifications thereto. Any use, reproduction, disclosure or |
| 7 | * distribution of this software and related documentation without an express |
| 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 9 | */ |
| 10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
| 11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
| 12 | |
| 13 | |
| 14 | #ifndef PX_BINARY_CONVERTER_H |
| 15 | #define PX_BINARY_CONVERTER_H |
| 16 | /** \addtogroup extensions |
| 17 | @{ |
| 18 | */ |
| 19 | |
| 20 | #include "common/PxPhysXCommonConfig.h" |
| 21 | |
| 22 | #ifndef PX_DOXYGEN |
| 23 | namespace physx |
| 24 | { |
| 25 | #endif |
| 26 | |
| 27 | class PxInputStream; |
| 28 | class PxOutputStream; |
| 29 | |
| 30 | struct PxConverterReportMode |
| 31 | { |
| 32 | enum Enum |
| 33 | { |
| 34 | eNONE, //!< Silent mode. If enabled, no information is sent to the error stream. |
| 35 | eNORMAL, //!< Normal mode. If enabled, only important information is sent to the error stream. |
| 36 | eVERBOSE //!< Verbose mode. If enabled, detailed information is sent to the error stream. |
| 37 | }; |
| 38 | }; |
| 39 | |
| 40 | |
| 41 | /** |
| 42 | \brief Binary converter for serialized streams. |
| 43 | |
| 44 | The binary converter class is targeted at converting binary streams from authoring platforms, |
| 45 | such as windows, osx or linux to any game runtime platform supported by PhysX. Particularly |
| 46 | it is currently not supported to run the converter on a platforms that has an endian mismatch |
| 47 | with the platform corresponding to the source binary file and source meta data. |
| 48 | |
| 49 | If you want to use multiple threads for batch conversions, please create one instance |
| 50 | of this class for each thread. |
| 51 | |
| 52 | @see PxSerialization.createBinaryConverter |
| 53 | */ |
| 54 | class PxBinaryConverter |
| 55 | { |
| 56 | public: |
| 57 | |
| 58 | /** |
| 59 | \brief Releases binary converter |
| 60 | */ |
| 61 | virtual void release() = 0; |
| 62 | |
| 63 | /** |
| 64 | \brief Sets desired report mode. |
| 65 | |
| 66 | \param[in] mode Report mode |
| 67 | */ |
| 68 | virtual void setReportMode(PxConverterReportMode::Enum mode) = 0; |
| 69 | |
| 70 | /** |
| 71 | \brief Setups source and target meta-data streams |
| 72 | |
| 73 | The source meta data provided needs to have the same endianness as the platform the converter is run on. |
| 74 | The meta data needs to be set before calling the conversion method. |
| 75 | |
| 76 | \param[in] srcMetaData Source platform's meta-data stream |
| 77 | \param[in] dstMetaData Target platform's meta-data stream |
| 78 | |
| 79 | \return True if success |
| 80 | */ |
| 81 | virtual bool setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaData) = 0; |
| 82 | |
| 83 | /** |
| 84 | \brief Converts binary stream from source platform to target platform |
| 85 | |
| 86 | The converter needs to be configured with source and destination meta data before calling the conversion method. |
| 87 | The source meta data needs to correspond to the same platform as the source binary data. |
| 88 | |
| 89 | \param[in] srcStream Source stream |
| 90 | \param[in] srcSize Number of bytes to convert |
| 91 | \param[in] targetStream Target stream |
| 92 | |
| 93 | \return True if success |
| 94 | */ |
| 95 | virtual bool convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream) = 0; |
| 96 | |
| 97 | |
| 98 | protected: |
| 99 | PxBinaryConverter() {} |
| 100 | virtual ~PxBinaryConverter() {} |
| 101 | }; |
| 102 | |
| 103 | #ifndef PX_DOXYGEN |
| 104 | } // namespace physx |
| 105 | #endif |
| 106 | |
| 107 | /** @} */ |
| 108 | #endif |
| 109 | |