Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
9
10
#include "PxConfig.h"
11
#include "characterkinematic/PxExtended.h"
12
#include "foundation/PxVec3.h"
13
#include "
math/vector.h
"
14
#include "foundation/PxVec4.h"
15
#include "foundation/PxMat44.h"
16
#include "
math/transform.h
"
17
18
//------------------------------------------------------------------------------
21
inline
physx::PxVec3
22
Neb2PxVec
(
const
Math::vector
& vec)
23
{
24
return
physx::PxVec3(vec.
x
, vec.
y
, vec.
z
);
25
}
26
27
//--------------------------------------------------------------------------
30
inline
physx::PxExtendedVec3
31
Neb2PxExtentedVec3
(
const
Math::vec3
& vec)
32
{
33
return
physx::PxExtendedVec3(vec.
x
, vec.
y
, vec.
z
);
34
}
35
36
//------------------------------------------------------------------------------
39
inline
physx::PxVec3
40
Neb2PxPnt
(
const
Math::point
& vec)
41
{
42
return
physx::PxVec3(vec.
x
, vec.
y
, vec.
z
);
43
}
44
45
//------------------------------------------------------------------------------
48
inline
Math::vector
49
Px2NebVec
(
const
physx::PxVec3& vec)
50
{
51
return
Math::vector
(vec.x, vec.y, vec.z);
52
}
53
54
//------------------------------------------------------------------------------
57
inline
Math::vec4
58
Px2Nebfloat4
(
const
physx::PxVec4& vec)
59
{
60
return
Math::vec4
(vec.x, vec.y, vec.z, vec.w);
61
}
62
63
//------------------------------------------------------------------------------
66
inline
Math::point
67
Px2NebPoint
(
const
physx::PxVec3& vec)
68
{
69
return
Math::point
(vec.x, vec.y, vec.z);
70
}
71
72
//------------------------------------------------------------------------------
75
inline
physx::PxVec4
76
Neb2PxVec4
(
const
Math::vec4
& vec)
77
{
78
return
physx::PxVec4(vec.
x
, vec.
y
, vec.
z
, vec.
w
);
79
}
80
81
//------------------------------------------------------------------------------
84
inline
physx::PxQuat
85
Neb2PxQuat
(
const
Math::quat
& vec)
86
{
87
return
physx::PxQuat(vec.
x
, vec.
y
, vec.
z
, vec.
w
);
88
}
89
90
//------------------------------------------------------------------------------
93
inline
Math::quat
94
Px2NebQuat
(
const
physx::PxQuat& vec)
95
{
96
return
Math::quat
(vec.x, vec.y, vec.z, vec.w);
97
}
98
99
//------------------------------------------------------------------------------
102
inline
physx::PxMat44
103
Neb2PxMat
(
const
Math::mat4
& mat)
104
{
105
return
physx::PxMat44(
Neb2PxVec4
(mat.
row0
),
Neb2PxVec4
(mat.
row1
),
Neb2PxVec4
(mat.
row2
),
Neb2PxVec4
(mat.
row3
));
106
}
107
108
//------------------------------------------------------------------------------
111
inline
physx::PxTransform
112
Neb2PxTrans
(
const
Math::mat4
& mat)
113
{
114
return
physx::PxTransform(
Neb2PxMat
(mat));
115
}
116
117
//------------------------------------------------------------------------------
120
inline
physx::PxTransform
121
Neb2PxTrans
(
const
Math::vec3
& position,
const
Math::quat
& orientation)
122
{
123
return
physx::PxTransform(
Neb2PxVec
(position),
Neb2PxQuat
(orientation));
124
}
125
126
//------------------------------------------------------------------------------
129
inline
physx::PxTransform
130
Neb2PxTrans
(
const
Math::transform
& trans)
131
{
132
n_assert
(trans.
scale
==
Math::_plus1
);
133
return
physx::PxTransform(
Neb2PxVec
(trans.
position
),
Neb2PxQuat
(trans.
rotation
));
134
}
135
136
inline
Math::transform
137
Px2NebTrans
(
const
physx::PxTransform& trans)
138
{
139
return
Math::transform
(
Px2NebVec
(trans.p),
Px2NebQuat
(trans.q));
140
}
141
142
//------------------------------------------------------------------------------
145
inline
Math::mat4
146
Px2NebMat
(
const
physx::PxTransform& mat)
147
{
148
Math::quat
q =
Px2NebQuat
(mat.q);
149
Math::vec4
p =
Px2NebPoint
(mat.p);
150
Math::mat4
m =
Math::rotationquat
(q);
151
m.
position
= p;
152
return
m;
153
}
Math::transform
Simple transform using position, quaternion, and scale.
Definition
transform.h:18
Math::transform::position
Math::vec3 position
Definition
transform.h:31
Math::transform::scale
Math::vec3 scale
Definition
transform.h:33
Math::transform::rotation
Math::quat rotation
Definition
transform.h:32
n_assert
#define n_assert(exp)
Definition
debug.h:50
Math::_plus1
static const f32x4 _plus1
Definition
vec3.h:31
Math::rotationquat
mat4 rotationquat(const quat &q)
TODO: rewrite using SSE.
Definition
mat4.cc:178
Math::mat4
A 4x4 single point precision float matrix.
Definition
mat4.h:49
Math::mat4::row3
vec4 row3
Definition
mat4.h:143
Math::mat4::position
vec4 position
Definition
mat4.h:123
Math::mat4::row1
vec4 row1
Definition
mat4.h:141
Math::mat4::row0
vec4 row0
Definition
mat4.h:140
Math::mat4::row2
vec4 row2
Definition
mat4.h:142
Math::point
Represents a 3D point in space.
Definition
point.h:22
Math::point::z
float z
Definition
point.h:78
Math::point::x
float x
Definition
point.h:78
Math::point::y
float y
Definition
point.h:78
Math::quat
A quaternion is usually used to represent an orientation in 3D space.
Definition
quat.h:30
Math::quat::y
float y
Definition
quat.h:78
Math::quat::z
float z
Definition
quat.h:78
Math::quat::w
float w
Definition
quat.h:78
Math::quat::x
float x
Definition
quat.h:78
Math::vec3
A 3D vector.
Definition
vec3.h:37
Math::vec3::x
float x
Definition
vec3.h:93
Math::vec3::z
float z
Definition
vec3.h:93
Math::vec3::y
float y
Definition
vec3.h:93
Math::vec4
A 4D vector.
Definition
vec4.h:24
Math::vec4::y
float y
Definition
vec4.h:95
Math::vec4::z
float z
Definition
vec4.h:95
Math::vec4::w
float w
Definition
vec4.h:95
Math::vec4::x
float x
Definition
vec4.h:95
Math::vector
A vector is a 3D direction in space.
Definition
vector.h:22
Math::vector::z
float z
Definition
vector.h:85
Math::vector::x
float x
Definition
vector.h:85
Math::vector::y
float y
Definition
vector.h:85
transform.h
Px2NebQuat
Math::quat Px2NebQuat(const physx::PxQuat &vec)
Definition
utils.h:94
Px2NebVec
Math::vector Px2NebVec(const physx::PxVec3 &vec)
Definition
utils.h:49
Px2NebPoint
Math::point Px2NebPoint(const physx::PxVec3 &vec)
Definition
utils.h:67
Neb2PxMat
physx::PxMat44 Neb2PxMat(const Math::mat4 &mat)
Definition
utils.h:103
Px2Nebfloat4
Math::vec4 Px2Nebfloat4(const physx::PxVec4 &vec)
Definition
utils.h:58
Px2NebMat
Math::mat4 Px2NebMat(const physx::PxTransform &mat)
Definition
utils.h:146
Px2NebTrans
Math::transform Px2NebTrans(const physx::PxTransform &trans)
Definition
utils.h:137
Neb2PxTrans
physx::PxTransform Neb2PxTrans(const Math::mat4 &mat)
Definition
utils.h:112
Neb2PxVec4
physx::PxVec4 Neb2PxVec4(const Math::vec4 &vec)
Definition
utils.h:76
Neb2PxExtentedVec3
physx::PxExtendedVec3 Neb2PxExtentedVec3(const Math::vec3 &vec)
Definition
utils.h:31
Neb2PxQuat
physx::PxQuat Neb2PxQuat(const Math::quat &vec)
Definition
utils.h:85
Neb2PxVec
physx::PxVec3 Neb2PxVec(const Math::vector &vec)
PhysX utils for conversion of datatypes.
Definition
utils.h:22
Neb2PxPnt
physx::PxVec3 Neb2PxPnt(const Math::point &vec)
Definition
utils.h:40
vector.h
code
physics
physics
utils.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.