| 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_VISUALDEBUGGER_H |
| 15 | #define PX_VISUALDEBUGGER_H |
| 16 | |
| 17 | |
| 18 | #ifdef PX_SUPPORT_VISUAL_DEBUGGER |
| 19 | #define PX_SUPPORT_VISUAL_DEBUGGER 1 |
| 20 | #include "foundation/PxSimpleTypes.h" |
| 21 | #include "foundation/PxVec3.h" |
| 22 | #else |
| 23 | #define PX_SUPPORT_VISUAL_DEBUGGER 0 |
| 24 | #endif |
| 25 | |
| 26 | /** \addtogroup pvd |
| 27 | @{ |
| 28 | */ |
| 29 | |
| 30 | #include "foundation/PxTransform.h" |
| 31 | #include "foundation/PxErrors.h" |
| 32 | #include "foundation/PxFlags.h" |
| 33 | |
| 34 | #ifndef PX_DOXYGEN |
| 35 | namespace physx { namespace debugger { namespace comm { |
| 36 | #endif |
| 37 | class PvdDataStream; |
| 38 | class PvdConnection; |
| 39 | #ifndef PX_DOXYGEN |
| 40 | }}} |
| 41 | #endif |
| 42 | |
| 43 | #ifndef PX_DOXYGEN |
| 44 | namespace physx |
| 45 | { |
| 46 | #endif |
| 47 | |
| 48 | class PxScene; |
| 49 | |
| 50 | /** |
| 51 | \brief PVD Flags. |
| 52 | */ |
| 53 | struct PxVisualDebuggerFlag |
| 54 | { |
| 55 | enum Enum |
| 56 | { |
| 57 | eTRANSMIT_CONTACTS = (1 << 0), //! Transmits contact stream to PVD. Disabled by default. |
| 58 | eTRANSMIT_SCENEQUERIES = (1 << 1), //! Transmits scene query stream to PVD. Disabled by default. |
| 59 | eTRANSMIT_CONSTRAINTS = (1 << 2) //! Transmits constraints visualize stream to PVD. Disabled by default. |
| 60 | }; |
| 61 | }; |
| 62 | |
| 63 | /** |
| 64 | \brief Bitfield that contains a set of raised flags defined in PxVisualDebuggerFlag. |
| 65 | |
| 66 | @see PxVisualDebuggerFlag |
| 67 | */ |
| 68 | typedef PxFlags<PxVisualDebuggerFlag::Enum, PxU8> PxVisualDebuggerFlags; |
| 69 | PX_FLAGS_OPERATORS(PxVisualDebuggerFlag::Enum, PxU8) |
| 70 | |
| 71 | |
| 72 | /** |
| 73 | \brief Class to communicate with the PhysX Visual Debugger. |
| 74 | */ |
| 75 | class PxVisualDebugger |
| 76 | { |
| 77 | public: |
| 78 | |
| 79 | /** |
| 80 | Disconnects the SDK from the PhysX Visual Debugger application. |
| 81 | If we are still connected, this will kill the entire debugger connection. |
| 82 | */ |
| 83 | virtual void disconnect() = 0; |
| 84 | |
| 85 | /** |
| 86 | * Checks if the connect state is paused. If it is, then this method will not |
| 87 | * return until the connection state changes or pvd disconnects. |
| 88 | */ |
| 89 | virtual void checkConnection() = 0; |
| 90 | |
| 91 | /** |
| 92 | returns the PVD connection that was passed to the SDK. |
| 93 | returns NULL if no connection is present. |
| 94 | */ |
| 95 | virtual physx::debugger::comm::PvdConnection* getPvdConnection() = 0; |
| 96 | |
| 97 | /** |
| 98 | \param scene The scene of which the PVD data stream should be returned. |
| 99 | returns the PVD data stream of a given scene. |
| 100 | returns NULL if no data stream is present. |
| 101 | */ |
| 102 | virtual physx::debugger::comm::PvdDataStream* getPvdDataStream(const PxScene& scene) = 0; |
| 103 | |
| 104 | /** |
| 105 | \deprecated |
| 106 | Controls if joint visualization info is sent to pvd. |
| 107 | \param inViz true if visualizations info is sent to PVD. |
| 108 | */ |
| 109 | PX_DEPRECATED void PX_INLINE setVisualizeConstraints( bool inViz ) { setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_CONSTRAINTS, inViz); } |
| 110 | /** |
| 111 | \deprecated |
| 112 | \return True when constraint viz info is sent to PVD. |
| 113 | */ |
| 114 | PX_DEPRECATED bool PX_INLINE isVisualizingConstraints() { return (getVisualDebuggerFlags() & PxVisualDebuggerFlag::eTRANSMIT_CONSTRAINTS) != 0;} |
| 115 | |
| 116 | /** |
| 117 | Sets the PVD flag. See PxVisualDebuggerFlags. |
| 118 | \param flag Flag to set. |
| 119 | \param value value the flag gets set to. |
| 120 | */ |
| 121 | virtual void setVisualDebuggerFlag(PxVisualDebuggerFlag::Enum flag, bool value) = 0; |
| 122 | |
| 123 | /** |
| 124 | Sets the PVD flags. See PxVisualDebuggerFlags. |
| 125 | \param flags Flags to set. |
| 126 | */ |
| 127 | virtual void setVisualDebuggerFlags(PxVisualDebuggerFlags flags) = 0; |
| 128 | |
| 129 | /** |
| 130 | Retrieves the PVD flags. See PxVisualDebuggerFlags. |
| 131 | */ |
| 132 | virtual PxU32 getVisualDebuggerFlags() = 0; |
| 133 | |
| 134 | /** |
| 135 | Updates the pose of a PVD camera. |
| 136 | \param name Name of camera to update. |
| 137 | \param origin The origin of the camera. |
| 138 | \param up The up vector of the camera. It should be the up vector of the game camera for PVD to update the view that matches the game. |
| 139 | The default up vector is the world up vector for a fixed PVD camera view. |
| 140 | \param target The target vector of the camera. |
| 141 | */ |
| 142 | virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0; |
| 143 | |
| 144 | /** |
| 145 | \brief send an error message to pvd. |
| 146 | \param code Error code, see #PxErrorCode |
| 147 | \param message Message to display. |
| 148 | \param file File error occured in. |
| 149 | \param line Line number error occured on. |
| 150 | */ |
| 151 | virtual void sendErrorMessage(PxErrorCode::Enum code, const char* message, const char* file, PxU32 line) = 0; |
| 152 | |
| 153 | protected: |
| 154 | virtual ~PxVisualDebugger() {} |
| 155 | }; |
| 156 | |
| 157 | #ifndef PX_DOXYGEN |
| 158 | } // namespace physx |
| 159 | #endif |
| 160 | |
| 161 | /** @} */ |
| 162 | #endif // PX_VISUALDEBUGGER_H |
| 163 | |