RavEngine
Loading...
Searching...
No Matches
CmVisualization.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef CM_VISUALIZATION_H
30#define CM_VISUALIZATION_H
31
32#include "foundation/PxTransform.h"
33#include "common/PxRenderOutput.h"
34#include "PxConstraintDesc.h"
35
36namespace physx
37{
38namespace Cm
39{
40 // PT: the force-inlined functions in PxRenderOutput generate a lot of code. Use these non-inlined functions instead.
41 PX_PHYSX_COMMON_API void renderOutputDebugBox(PxRenderOutput& out, const PxBounds3& box);
42 PX_PHYSX_COMMON_API void renderOutputDebugCircle(PxRenderOutput& out, PxU32 s, PxReal r);
43 PX_PHYSX_COMMON_API void renderOutputDebugBasis(PxRenderOutput& out, const PxDebugBasis& basis);
44 PX_PHYSX_COMMON_API void renderOutputDebugArrow(PxRenderOutput& out, const PxDebugArrow& arrow);
45
46 PX_PHYSX_COMMON_API void visualizeJointFrames(PxRenderOutput& out,
47 PxReal scale,
48 const PxTransform& parent,
49 const PxTransform& child);
50
51 PX_PHYSX_COMMON_API void visualizeLinearLimit(PxRenderOutput& out,
52 PxReal scale,
53 const PxTransform& t0,
54 const PxTransform& t1,
55 PxReal value,
56 bool active);
57
58 PX_PHYSX_COMMON_API void visualizeAngularLimit(PxRenderOutput& out,
59 PxReal scale,
60 const PxTransform& t0,
61 PxReal lower,
62 PxReal upper,
63 bool active);
64
65 PX_PHYSX_COMMON_API void visualizeLimitCone(PxRenderOutput& out,
66 PxReal scale,
67 const PxTransform& t,
68 PxReal ySwing,
69 PxReal zSwing,
70 bool active);
71
72 PX_PHYSX_COMMON_API void visualizeDoubleCone(PxRenderOutput& out,
73 PxReal scale,
74 const PxTransform& t,
75 PxReal angle,
76 bool active);
77
79 {
80 PxF32 mFrameScale;
81 PxF32 mLimitScale;
82 PxRenderOutput& mCmOutput;
83
84 //Not possible to implement
86
87 ConstraintImmediateVisualizer(PxF32 frameScale, PxF32 limitScale, PxRenderOutput& output) :
88 mFrameScale (frameScale),
89 mLimitScale (limitScale),
90 mCmOutput (output)
91 {
92 }
93
94 virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child)
95 {
96 Cm::visualizeJointFrames(mCmOutput, mFrameScale, parent, child);
97 }
98
99 virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, PxReal value, bool active)
100 {
101 Cm::visualizeLinearLimit(mCmOutput, mLimitScale, t0, t1, value, active);
102 }
103
104 virtual void visualizeAngularLimit(const PxTransform& t0, PxReal lower, PxReal upper, bool active)
105 {
106 Cm::visualizeAngularLimit(mCmOutput, mLimitScale, t0, lower, upper, active);
107 }
108
109 virtual void visualizeLimitCone(const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ, bool active)
110 {
111 Cm::visualizeLimitCone(mCmOutput, mLimitScale, t, tanQSwingY, tanQSwingZ, active);
112 }
113
114 virtual void visualizeDoubleCone(const PxTransform& t, PxReal angle, bool active)
115 {
116 Cm::visualizeDoubleCone(mCmOutput, mLimitScale, t, angle, active);
117 }
118
119 virtual void visualizeLine( const PxVec3& p0, const PxVec3& p1, PxU32 color)
120 {
121 mCmOutput << color;
122 mCmOutput.outputSegment(p0, p1);
123 }
124 };
125}
126
127}
128
129#endif
API used to visualize details about a constraint.
Definition PxConstraintDesc.h:256
Definition PxRenderOutput.h:50
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
3 Element vector class.
Definition PxVec3.h:50
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition CmVisualization.h:79
virtual void visualizeLimitCone(const PxTransform &t, PxReal tanQSwingY, PxReal tanQSwingZ, bool active)
Visualize limit cone.
Definition CmVisualization.h:109
virtual void visualizeLine(const PxVec3 &p0, const PxVec3 &p1, PxU32 color)
Visualize line.
Definition CmVisualization.h:119
virtual void visualizeLinearLimit(const PxTransform &t0, const PxTransform &t1, PxReal value, bool active)
Visualize joint linear limit.
Definition CmVisualization.h:99
virtual void visualizeJointFrames(const PxTransform &parent, const PxTransform &child)
Visualize joint frames.
Definition CmVisualization.h:94
virtual void visualizeAngularLimit(const PxTransform &t0, PxReal lower, PxReal upper, bool active)
Visualize joint angular limit.
Definition CmVisualization.h:104
virtual void visualizeDoubleCone(const PxTransform &t, PxReal angle, bool active)
Visualize joint double cone.
Definition CmVisualization.h:114