Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
blender
monado
Commits
68422f6e
Commit
68422f6e
authored
Feb 11, 2020
by
Jakob Bornecrantz
Browse files
d/ns: Fix all warnings and tidy code
parent
d4e034dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/xrt/drivers/north_star/distortion/deformation_northstar.cpp
View file @
68422f6e
...
...
@@ -221,10 +221,10 @@ OpticalSystem::SolveDisplayUVToRenderUV(Vector2 inputUV,
Vector2
error
=
curDisplayUV
-
inputUV
;
Vector2
step
=
Vector2
::
zero
();
if
(
!
displayUVGradX
.
x
==
0.
f
||
!
displayUVGradX
.
y
==
0.
f
)
{
if
(
(
!
displayUVGradX
.
x
)
==
0.
f
||
(
!
displayUVGradX
.
y
)
==
0.
f
)
{
step
=
step
+
(
displayUVGradX
*
error
.
x
);
}
if
(
!
displayUVGradY
.
x
==
0.
f
||
!
displayUVGradY
.
y
==
0.
f
)
{
if
(
(
!
displayUVGradY
.
x
)
==
0.
f
||
(
!
displayUVGradY
.
y
)
==
0.
f
)
{
step
=
step
+
(
displayUVGradY
*
error
.
y
);
}
...
...
src/xrt/drivers/north_star/distortion/deformation_northstar.h
View file @
68422f6e
...
...
@@ -4,15 +4,10 @@
#pragma once
#include <map>
#include "utility_northstar.h"
#include "../ns_hmd.h"
#include <chrono>
using
namespace
std
::
chrono
;
#include <map>
static
char
*
s_strLeftEye
=
"leftEye"
;
static
char
*
s_strRightEye
=
"rightEye"
;
class
OpticalSystem
{
...
...
@@ -71,9 +66,6 @@ public:
void
UpdateClipToWorld
(
Matrix4x4
eyeRotationMatrix
)
{
// TEST DELETEME
float
time
=
clock
()
/
(
float
)
CLOCKS_PER_SEC
;
float
osc
=
sinf
(
time
*
2
*
LP_PI
);
Matrix4x4
eyeToWorld
=
Matrix4x4
::
Translate
(
eyePosition
)
*
eyeRotationMatrix
;
eyeToWorld
.
m02
*=
-
1
;
...
...
@@ -99,7 +91,7 @@ public:
clipToWorld
.
MultiplyPoint
(
tmp
*
2.
f
)
-
cameraPosition
;
float
mag
=
dir
.
Magnitude
();
out
=
dir
/
dir
.
Magnitude
()
;
out
=
dir
/
mag
;
return
;
}
...
...
src/xrt/drivers/north_star/distortion/utility_northstar.h
View file @
68422f6e
...
...
@@ -44,6 +44,15 @@ public:
z
=
0.
f
;
};
constexpr
Vector3
&
operator
=
(
const
Vector3
&
lhr
)
{
this
->
x
=
lhr
.
x
;
this
->
y
=
lhr
.
y
;
this
->
z
=
lhr
.
z
;
return
*
this
;
}
inline
static
Vector3
Up
()
{
...
...
@@ -139,14 +148,6 @@ public:
return
ret
;
}
inline
void
copy
(
Vector3
&
lhs
,
Vector3
rhs
)
{
rhs
.
x
=
lhs
.
x
;
rhs
.
y
=
lhs
.
y
;
rhs
.
z
=
lhs
.
z
;
}
inline
float
static
Dot
(
Vector3
lhs
,
Vector3
rhs
)
{
float
result
=
...
...
@@ -300,6 +301,14 @@ public:
y
=
_y
;
};
constexpr
Vector2
&
operator
=
(
const
Vector2
&
lhr
)
{
this
->
x
=
lhr
.
x
;
this
->
y
=
lhr
.
y
;
return
*
this
;
}
inline
static
Vector2
zero
()
{
...
...
@@ -434,6 +443,28 @@ public:
m33
=
in33
;
};
constexpr
Matrix4x4
&
operator
=
(
const
Matrix4x4
&
lhr
)
{
this
->
m00
=
lhr
.
m00
;
this
->
m01
=
lhr
.
m01
;
this
->
m02
=
lhr
.
m02
;
this
->
m03
=
lhr
.
m03
;
this
->
m10
=
lhr
.
m10
;
this
->
m11
=
lhr
.
m11
;
this
->
m12
=
lhr
.
m12
;
this
->
m13
=
lhr
.
m13
;
this
->
m20
=
lhr
.
m20
;
this
->
m21
=
lhr
.
m21
;
this
->
m22
=
lhr
.
m22
;
this
->
m23
=
lhr
.
m23
;
this
->
m30
=
lhr
.
m30
;
this
->
m31
=
lhr
.
m31
;
this
->
m32
=
lhr
.
m32
;
this
->
m33
=
lhr
.
m33
;
return
*
this
;
};
inline
static
Matrix4x4
Identity
()
{
...
...
@@ -688,6 +719,16 @@ public:
w
=
in
.
w
;
}
constexpr
Vector4
&
operator
=
(
const
Vector4
&
lhr
)
{
this
->
x
=
lhr
.
x
;
this
->
y
=
lhr
.
y
;
this
->
z
=
lhr
.
z
;
this
->
w
=
lhr
.
w
;
return
*
this
;
}
inline
Matrix4x4
ComposeProjection
()
{
...
...
@@ -784,6 +825,16 @@ public:
w
=
_in
.
w
;
};
constexpr
Quaternion
&
operator
=
(
const
Quaternion
&
lhr
)
{
this
->
x
=
lhr
.
x
;
this
->
y
=
lhr
.
y
;
this
->
z
=
lhr
.
z
;
this
->
w
=
lhr
.
w
;
return
*
this
;
}
inline
static
Quaternion
Identity
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment