Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MIDIMan
SRB2
Commits
5f738914
Commit
5f738914
authored
1 year ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Interpolate renderer-specific slope vectors
parent
9ff0bea9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/m_vector.c
+26
-0
26 additions, 0 deletions
src/m_vector.c
src/m_vector.h
+4
-0
4 additions, 0 deletions
src/m_vector.h
src/r_fps.c
+47
-1
47 additions, 1 deletion
src/r_fps.c
src/r_fps.h
+3
-0
3 additions, 0 deletions
src/r_fps.h
with
80 additions
and
1 deletion
src/m_vector.c
+
26
−
0
View file @
5f738914
...
...
@@ -21,6 +21,32 @@ void DVector3_Load(dvector3_t *vec, double x, double y, double z)
vec
->
z
=
z
;
}
void
DVector3_Copy
(
dvector3_t
*
a_o
,
const
dvector3_t
*
a_i
)
{
memcpy
(
a_o
,
a_i
,
sizeof
(
dvector3_t
));
}
void
DVector3_Add
(
const
dvector3_t
*
a_i
,
const
dvector3_t
*
a_c
,
dvector3_t
*
a_o
)
{
a_o
->
x
=
a_i
->
x
+
a_c
->
x
;
a_o
->
y
=
a_i
->
y
+
a_c
->
y
;
a_o
->
z
=
a_i
->
z
+
a_c
->
z
;
}
void
DVector3_Subtract
(
const
dvector3_t
*
a_i
,
const
dvector3_t
*
a_c
,
dvector3_t
*
a_o
)
{
a_o
->
x
=
a_i
->
x
-
a_c
->
x
;
a_o
->
y
=
a_i
->
y
-
a_c
->
y
;
a_o
->
z
=
a_i
->
z
-
a_c
->
z
;
}
void
DVector3_Multiply
(
const
dvector3_t
*
a_i
,
double
a_c
,
dvector3_t
*
a_o
)
{
a_o
->
x
=
a_i
->
x
*
a_c
;
a_o
->
y
=
a_i
->
y
*
a_c
;
a_o
->
z
=
a_i
->
z
*
a_c
;
}
double
DVector3_Magnitude
(
const
dvector3_t
*
a_normal
)
{
double
xs
=
a_normal
->
x
*
a_normal
->
x
;
...
...
This diff is collapsed.
Click to expand it.
src/m_vector.h
+
4
−
0
View file @
5f738914
...
...
@@ -19,6 +19,10 @@ typedef struct
}
dvector3_t
;
void
DVector3_Load
(
dvector3_t
*
vec
,
double
x
,
double
y
,
double
z
);
void
DVector3_Copy
(
dvector3_t
*
a_o
,
const
dvector3_t
*
a_i
);
void
DVector3_Add
(
const
dvector3_t
*
a_i
,
const
dvector3_t
*
a_c
,
dvector3_t
*
a_o
);
void
DVector3_Subtract
(
const
dvector3_t
*
a_i
,
const
dvector3_t
*
a_c
,
dvector3_t
*
a_o
);
void
DVector3_Multiply
(
const
dvector3_t
*
a_i
,
double
a_c
,
dvector3_t
*
a_o
);
double
DVector3_Magnitude
(
const
dvector3_t
*
a_normal
);
double
DVector3_Normalize
(
dvector3_t
*
a_normal
);
void
DVector3_Negate
(
dvector3_t
*
a_o
);
...
...
This diff is collapsed.
Click to expand it.
src/r_fps.c
+
47
−
1
View file @
5f738914
...
...
@@ -120,6 +120,19 @@ static vector3_t *R_LerpVector3(const vector3_t *from, const vector3_t *to, fixe
return
out
;
}
static
double
R_LerpDouble
(
double
from
,
double
to
,
double
frac
)
{
return
from
+
(
frac
*
(
to
-
from
));
}
static
dvector3_t
*
R_LerpDVector3
(
const
dvector3_t
*
from
,
const
dvector3_t
*
to
,
double
frac
,
dvector3_t
*
out
)
{
DVector3_Subtract
(
to
,
from
,
out
);
DVector3_Multiply
(
out
,
frac
,
out
);
DVector3_Add
(
from
,
out
,
out
);
return
out
;
}
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
...
...
@@ -497,6 +510,14 @@ void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope)
FV2_Copy
(
&
interp
->
dynslope
.
bakd
,
&
slope
->
d
);
interp
->
dynslope
.
oldzdelta
=
interp
->
dynslope
.
bakzdelta
=
slope
->
zdelta
;
DVector3_Copy
(
&
interp
->
dynslope
.
oldorigin
,
&
slope
->
dorigin
);
DVector3_Copy
(
&
interp
->
dynslope
.
bakorigin
,
&
slope
->
dorigin
);
DVector3_Copy
(
&
interp
->
dynslope
.
oldnormdir
,
&
slope
->
dnormdir
);
DVector3_Copy
(
&
interp
->
dynslope
.
baknormdir
,
&
slope
->
dnormdir
);
interp
->
dynslope
.
olddzdelta
=
interp
->
dynslope
.
bakdzdelta
=
slope
->
dzdelta
;
}
void
R_InitializeLevelInterpolators
(
void
)
...
...
@@ -561,6 +582,21 @@ static void UpdateLevelInterpolatorState(levelinterpolator_t *interp)
FV3_Copy
(
&
interp
->
dynslope
.
bako
,
&
interp
->
dynslope
.
slope
->
o
);
FV2_Copy
(
&
interp
->
dynslope
.
bakd
,
&
interp
->
dynslope
.
slope
->
d
);
interp
->
dynslope
.
bakzdelta
=
interp
->
dynslope
.
slope
->
zdelta
;
DVector3_Copy
(
&
interp
->
dynslope
.
oldorigin
,
&
interp
->
dynslope
.
bakorigin
);
DVector3_Copy
(
&
interp
->
dynslope
.
oldnormdir
,
&
interp
->
dynslope
.
baknormdir
);
interp
->
dynslope
.
olddzdelta
=
interp
->
dynslope
.
bakdzdelta
;
if
(
interp
->
dynslope
.
slope
->
moved
)
{
P_CalculateSlopeVectors
(
interp
->
dynslope
.
slope
);
interp
->
dynslope
.
slope
->
moved
=
false
;
}
DVector3_Copy
(
&
interp
->
dynslope
.
bakorigin
,
&
interp
->
dynslope
.
slope
->
dorigin
);
DVector3_Copy
(
&
interp
->
dynslope
.
baknormdir
,
&
interp
->
dynslope
.
slope
->
dnormdir
);
interp
->
dynslope
.
bakdzdelta
=
interp
->
dynslope
.
slope
->
dzdelta
;
break
;
}
}
...
...
@@ -646,7 +682,13 @@ void R_ApplyLevelInterpolators(fixed_t frac)
R_LerpVector3
(
&
interp
->
dynslope
.
oldo
,
&
interp
->
dynslope
.
bako
,
frac
,
&
interp
->
dynslope
.
slope
->
o
);
R_LerpVector2
(
&
interp
->
dynslope
.
oldd
,
&
interp
->
dynslope
.
bakd
,
frac
,
&
interp
->
dynslope
.
slope
->
d
);
interp
->
dynslope
.
slope
->
zdelta
=
R_LerpFixed
(
interp
->
dynslope
.
oldzdelta
,
interp
->
dynslope
.
bakzdelta
,
frac
);
interp
->
dynslope
.
slope
->
moved
=
true
;
if
(
rendermode
==
render_soft
)
{
double
dfrac
=
FixedToDouble
(
frac
);
R_LerpDVector3
(
&
interp
->
dynslope
.
oldorigin
,
&
interp
->
dynslope
.
bakorigin
,
dfrac
,
&
interp
->
dynslope
.
slope
->
dorigin
);
R_LerpDVector3
(
&
interp
->
dynslope
.
oldnormdir
,
&
interp
->
dynslope
.
baknormdir
,
dfrac
,
&
interp
->
dynslope
.
slope
->
dnormdir
);
interp
->
dynslope
.
slope
->
dzdelta
=
R_LerpDouble
(
interp
->
dynslope
.
olddzdelta
,
interp
->
dynslope
.
bakdzdelta
,
dfrac
);
}
break
;
}
}
...
...
@@ -704,6 +746,10 @@ void R_RestoreLevelInterpolators(void)
FV3_Copy
(
&
interp
->
dynslope
.
slope
->
o
,
&
interp
->
dynslope
.
bako
);
FV2_Copy
(
&
interp
->
dynslope
.
slope
->
d
,
&
interp
->
dynslope
.
bakd
);
interp
->
dynslope
.
slope
->
zdelta
=
interp
->
dynslope
.
bakzdelta
;
DVector3_Copy
(
&
interp
->
dynslope
.
slope
->
dorigin
,
&
interp
->
dynslope
.
bakorigin
);
DVector3_Copy
(
&
interp
->
dynslope
.
slope
->
dnormdir
,
&
interp
->
dynslope
.
baknormdir
);
interp
->
dynslope
.
slope
->
dzdelta
=
interp
->
dynslope
.
bakdzdelta
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/r_fps.h
+
3
−
0
View file @
5f738914
...
...
@@ -115,6 +115,9 @@ typedef struct levelinterpolator_s {
vector3_t
oldo
,
bako
;
vector2_t
oldd
,
bakd
;
fixed_t
oldzdelta
,
bakzdelta
;
dvector3_t
oldorigin
,
bakorigin
;
dvector3_t
oldnormdir
,
baknormdir
;
double
olddzdelta
,
bakdzdelta
;
}
dynslope
;
};
}
levelinterpolator_t
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment