Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
ad3c3e1b
Unverified
Commit
ad3c3e1b
authored
Mar 23, 2020
by
Aaron Franke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Mono] Rename LinearInterpolate to Lerp
parent
10273e9d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
24 deletions
+52
-24
Color.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+19
-9
Transform.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs
+2
-2
Transform2D.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+3
-3
Vector2.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+14
-6
Vector3.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+14
-4
No files found.
modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
View file @
ad3c3e1b
...
...
@@ -306,16 +306,26 @@ namespace Godot
return
res
;
}
public
Color
LinearInterpolate
(
Color
c
,
float
t
)
{
var
res
=
this
;
res
.
r
+=
t
*
(
c
.
r
-
r
);
res
.
g
+=
t
*
(
c
.
g
-
g
);
res
.
b
+=
t
*
(
c
.
b
-
b
);
res
.
a
+=
t
*
(
c
.
a
-
a
);
public
Color
Lerp
(
Color
to
,
float
weight
)
{
return
new
Color
(
Mathf
.
Lerp
(
r
,
to
.
r
,
weight
),
Mathf
.
Lerp
(
g
,
to
.
g
,
weight
),
Mathf
.
Lerp
(
b
,
to
.
b
,
weight
),
Mathf
.
Lerp
(
a
,
to
.
a
,
weight
)
);
}
return
res
;
public
Color
Lerp
(
Color
to
,
Color
weight
)
{
return
new
Color
(
Mathf
.
Lerp
(
r
,
to
.
r
,
weight
.
r
),
Mathf
.
Lerp
(
g
,
to
.
g
,
weight
.
g
),
Mathf
.
Lerp
(
b
,
to
.
b
,
weight
.
b
),
Mathf
.
Lerp
(
a
,
to
.
a
,
weight
.
a
)
);
}
public
uint
ToAbgr32
()
...
...
modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs
View file @
ad3c3e1b
...
...
@@ -104,8 +104,8 @@ namespace Godot
Vector3
destinationLocation
=
transform
.
origin
;
var
interpolated
=
new
Transform
();
interpolated
.
basis
.
SetQuatScale
(
sourceRotation
.
Slerp
(
destinationRotation
,
c
).
Normalized
(),
sourceScale
.
L
inearInterpolate
(
destinationScale
,
c
));
interpolated
.
origin
=
sourceLocation
.
L
inearInterpolate
(
destinationLocation
,
c
);
interpolated
.
basis
.
SetQuatScale
(
sourceRotation
.
Slerp
(
destinationRotation
,
c
).
Normalized
(),
sourceScale
.
L
erp
(
destinationScale
,
c
));
interpolated
.
origin
=
sourceLocation
.
L
erp
(
destinationLocation
,
c
);
return
interpolated
;
}
...
...
modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
View file @
ad3c3e1b
...
...
@@ -172,7 +172,7 @@ namespace Godot
if
(
dot
>
0.9995f
)
{
// Linearly interpolate to avoid numerical precision issues
v
=
v1
.
L
inearInterpolate
(
v2
,
c
).
Normalized
();
v
=
v1
.
L
erp
(
v2
,
c
).
Normalized
();
}
else
{
...
...
@@ -186,8 +186,8 @@ namespace Godot
Vector2
p2
=
m
.
origin
;
// Construct matrix
var
res
=
new
Transform2D
(
Mathf
.
Atan2
(
v
.
y
,
v
.
x
),
p1
.
L
inearInterpolate
(
p2
,
c
));
Vector2
scale
=
s1
.
L
inearInterpolate
(
s2
,
c
);
var
res
=
new
Transform2D
(
Mathf
.
Atan2
(
v
.
y
,
v
.
x
),
p1
.
L
erp
(
p2
,
c
));
Vector2
scale
=
s1
.
L
erp
(
s2
,
c
);
res
.
x
*=
scale
;
res
.
y
*=
scale
;
...
...
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
View file @
ad3c3e1b
...
...
@@ -186,14 +186,22 @@ namespace Godot
return
x
*
x
+
y
*
y
;
}
public
Vector2
L
inearInterpolate
(
Vector2
b
,
real_t
t
)
public
Vector2
L
erp
(
Vector2
to
,
real_t
weigh
t
)
{
var
res
=
this
;
res
.
x
+=
t
*
(
b
.
x
-
x
);
res
.
y
+=
t
*
(
b
.
y
-
y
);
return
new
Vector2
(
Mathf
.
Lerp
(
x
,
to
.
x
,
weight
),
Mathf
.
Lerp
(
y
,
to
.
y
,
weight
)
);
}
return
res
;
public
Vector2
Lerp
(
Vector2
to
,
Vector2
weight
)
{
return
new
Vector2
(
Mathf
.
Lerp
(
x
,
to
.
x
,
weight
.
x
),
Mathf
.
Lerp
(
y
,
to
.
y
,
weight
.
y
)
);
}
public
Vector2
MoveToward
(
Vector2
to
,
real_t
delta
)
...
...
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
View file @
ad3c3e1b
...
...
@@ -184,13 +184,23 @@ namespace Godot
return
x2
+
y2
+
z2
;
}
public
Vector3
L
inearInterpolate
(
Vector3
b
,
real_t
t
)
public
Vector3
L
erp
(
Vector3
to
,
real_t
weigh
t
)
{
return
new
Vector3
(
x
+
t
*
(
b
.
x
-
x
),
y
+
t
*
(
b
.
y
-
y
),
z
+
t
*
(
b
.
z
-
z
)
Mathf
.
Lerp
(
x
,
to
.
x
,
weight
),
Mathf
.
Lerp
(
y
,
to
.
y
,
weight
),
Mathf
.
Lerp
(
z
,
to
.
z
,
weight
)
);
}
public
Vector3
Lerp
(
Vector3
to
,
Vector3
weight
)
{
return
new
Vector3
(
Mathf
.
Lerp
(
x
,
to
.
x
,
weight
.
x
),
Mathf
.
Lerp
(
y
,
to
.
y
,
weight
.
y
),
Mathf
.
Lerp
(
z
,
to
.
z
,
weight
.
z
)
);
}
...
...
Write
Preview
Markdown
is supported
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