Nebula
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
10#include "PxConfig.h"
11#include "foundation/PxVec3.h"
12#include "math/vector.h"
13#include "foundation/PxVec4.h"
14#include "foundation/PxMat44.h"
15
16//------------------------------------------------------------------------------
19inline physx::PxVec3
21{
22 return physx::PxVec3(vec.x, vec.y, vec.z);
23}
24
25//------------------------------------------------------------------------------
28inline physx::PxVec3
30{
31 return physx::PxVec3(vec.x, vec.y, vec.z);
32}
33
34//------------------------------------------------------------------------------
37inline Math::vector
38Px2NebVec(const physx::PxVec3& vec)
39{
40 return Math::vector(vec.x, vec.y, vec.z);
41}
42
43//------------------------------------------------------------------------------
46inline Math::vec4
47Px2Nebfloat4(const physx::PxVec4& vec)
48{
49 return Math::vec4(vec.x, vec.y, vec.z, vec.w);
50}
51
52//------------------------------------------------------------------------------
55inline Math::point
56Px2NebPoint(const physx::PxVec3& vec)
57{
58 return Math::point(vec.x, vec.y, vec.z);
59}
60
61//------------------------------------------------------------------------------
64inline physx::PxVec4
66{
67 return physx::PxVec4(vec.x, vec.y, vec.z, vec.w);
68}
69
70//------------------------------------------------------------------------------
73inline physx::PxQuat
75{
76 return physx::PxQuat(vec.x, vec.y, vec.z, vec.w);
77}
78
79//------------------------------------------------------------------------------
82inline Math::quat
83Px2NebQuat(const physx::PxQuat& vec)
84{
85 return Math::quat(vec.x, vec.y, vec.z, vec.w);
86}
87
88//------------------------------------------------------------------------------
91inline physx::PxMat44
93{
94 return physx::PxMat44(Neb2PxVec4(mat.row0), Neb2PxVec4(mat.row1), Neb2PxVec4(mat.row2), Neb2PxVec4(mat.row3));
95}
96
97//------------------------------------------------------------------------------
100inline physx::PxTransform
102{
103 return physx::PxTransform(Neb2PxMat(mat));
104}
105
106//------------------------------------------------------------------------------
109inline physx::PxTransform
110Neb2PxTrans(const Math::vec3& position, const Math::quat& orientation)
111{
112 return physx::PxTransform(Neb2PxVec(position), Neb2PxQuat(orientation));
113}
114
115//------------------------------------------------------------------------------
118inline Math::mat4
119Px2NebMat(const physx::PxTransform& mat)
120{
121 Math::quat q = Px2NebQuat(mat.q);
122 Math::vec4 p = Px2NebPoint(mat.p);
124 m.position = p;
125 return m;
126}
mat4 rotationquat(const quat &q)
TODO: rewrite using SSE.
Definition mat4.cc:177
A 4x4 single point precision float matrix.
Definition mat4.h:47
vec4 row3
Definition mat4.h:136
vec4 position
Definition mat4.h:116
vec4 row1
Definition mat4.h:134
vec4 row0
Definition mat4.h:133
vec4 row2
Definition mat4.h:135
Represents a 3D point in space.
Definition point.h:22
float z
Definition point.h:78
float x
Definition point.h:78
float y
Definition point.h:78
A quaternion is usually used to represent an orientation in 3D space.
Definition quat.h:30
float y
Definition quat.h:78
float z
Definition quat.h:78
float w
Definition quat.h:78
float x
Definition quat.h:78
A 3D vector.
Definition vec3.h:39
A 4D vector.
Definition vec4.h:24
float y
Definition vec4.h:93
float z
Definition vec4.h:93
float w
Definition vec4.h:93
float x
Definition vec4.h:93
A vector is a 3D direction in space.
Definition vector.h:22
float z
Definition vector.h:85
float x
Definition vector.h:85
float y
Definition vector.h:85
Math::quat Px2NebQuat(const physx::PxQuat &vec)
Definition utils.h:83
Math::vector Px2NebVec(const physx::PxVec3 &vec)
Definition utils.h:38
Math::point Px2NebPoint(const physx::PxVec3 &vec)
Definition utils.h:56
physx::PxMat44 Neb2PxMat(const Math::mat4 &mat)
Definition utils.h:92
Math::vec4 Px2Nebfloat4(const physx::PxVec4 &vec)
Definition utils.h:47
Math::mat4 Px2NebMat(const physx::PxTransform &mat)
Definition utils.h:119
physx::PxTransform Neb2PxTrans(const Math::mat4 &mat)
Definition utils.h:101
physx::PxVec4 Neb2PxVec4(const Math::vec4 &vec)
Definition utils.h:65
physx::PxQuat Neb2PxQuat(const Math::quat &vec)
Definition utils.h:74
physx::PxVec3 Neb2PxVec(const Math::vector &vec)
PhysX utils for conversion of datatypes.
Definition utils.h:20
physx::PxVec3 Neb2PxPnt(const Math::point &vec)
Definition utils.h:29