Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces Using Modern RTX Enabled GPUs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
John Hunter
Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces Using Modern RTX Enabled GPUs
Commits
0d11271f
Unverified
Commit
0d11271f
authored
Apr 27, 2023
by
John Hunter
Browse files
Options
Downloads
Patches
Plain Diff
minor clippy
parent
ca9479d2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.rs
+26
-26
26 additions, 26 deletions
src/main.rs
src/objects.rs
+8
-3
8 additions, 3 deletions
src/objects.rs
with
34 additions
and
29 deletions
src/main.rs
+
26
−
26
View file @
0d11271f
...
...
@@ -1172,15 +1172,15 @@ struct Subbuffers {
impl
PartialEq
<
InputTypes
>
for
Inputs
{
fn
eq
(
&
self
,
other
:
&
InputTypes
)
->
bool
{
match
self
{
&
Inputs
::
Variable
=>
true
,
&
Inputs
::
Float
(
_
)
=>
*
other
==
InputTypes
::
Float
,
&
Inputs
::
Vec2
(
_
)
=>
*
other
==
InputTypes
::
Vec2
,
&
Inputs
::
Vec3
(
_
)
=>
*
other
==
InputTypes
::
Vec3
,
&
Inputs
::
Vec4
(
_
)
=>
*
other
==
InputTypes
::
Vec4
,
&
Inputs
::
Mat2
(
_
)
=>
*
other
==
InputTypes
::
Mat2
,
&
Inputs
::
Mat3
(
_
)
=>
*
other
==
InputTypes
::
Mat3
,
&
Inputs
::
Mat4
(
_
)
=>
*
other
==
InputTypes
::
Mat4
,
match
*
self
{
Inputs
::
Variable
=>
true
,
Inputs
::
Float
(
_
)
=>
*
other
==
InputTypes
::
Float
,
Inputs
::
Vec2
(
_
)
=>
*
other
==
InputTypes
::
Vec2
,
Inputs
::
Vec3
(
_
)
=>
*
other
==
InputTypes
::
Vec3
,
Inputs
::
Vec4
(
_
)
=>
*
other
==
InputTypes
::
Vec4
,
Inputs
::
Mat2
(
_
)
=>
*
other
==
InputTypes
::
Mat2
,
Inputs
::
Mat3
(
_
)
=>
*
other
==
InputTypes
::
Mat3
,
Inputs
::
Mat4
(
_
)
=>
*
other
==
InputTypes
::
Mat4
,
}
}
}
...
...
@@ -1322,8 +1322,8 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
if
actual
==
&
Inputs
::
Variable
{
match
expected
{
&
InputTypes
::
Float
=>
match
runtime_floats
.pop
()
{
match
*
expected
{
InputTypes
::
Float
=>
match
runtime_floats
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1336,7 +1336,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Vec2
=>
match
runtime_vec2s
.pop
()
{
InputTypes
::
Vec2
=>
match
runtime_vec2s
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1349,7 +1349,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Vec3
=>
match
runtime_vec3s
.pop
()
{
InputTypes
::
Vec3
=>
match
runtime_vec3s
.pop
()
{
Some
(
u
)
=>
{
if
u
!=
usize
::
MAX
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
...
...
@@ -1364,7 +1364,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Vec4
=>
match
runtime_vec4s
.pop
()
{
InputTypes
::
Vec4
=>
match
runtime_vec4s
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1377,7 +1377,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Mat2
=>
match
runtime_mat2s
.pop
()
{
InputTypes
::
Mat2
=>
match
runtime_mat2s
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1390,7 +1390,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Mat3
=>
match
runtime_mat3s
.pop
()
{
InputTypes
::
Mat3
=>
match
runtime_mat3s
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1403,7 +1403,7 @@ fn object_size_dependent_setup(
continue
'nextcsg
;
}
},
&
InputTypes
::
Mat4
=>
match
runtime_mat4s
.pop
()
{
InputTypes
::
Mat4
=>
match
runtime_mat4s
.pop
()
{
Some
(
u
)
=>
{
if
dependencies
[
u
][
0
]
!=
u8
::
MAX
{
dependencies
[
u
][
1
]
=
index
as
u8
...
...
@@ -1418,15 +1418,15 @@ fn object_size_dependent_setup(
},
}
}
else
{
match
actual
{
&
Inputs
::
Float
(
f
)
=>
floats
.push
(
f
as
f32
),
&
Inputs
::
Vec2
(
f
)
=>
vec2s
.push
(
f
.map
(|
x
|
x
as
f32
)
.into
()),
&
Inputs
::
Vec3
(
f
)
=>
vec4s
.push
(
f
.map
(|
x
|
x
as
f32
)
.extend
(
1.
)
.into
()),
&
Inputs
::
Vec4
(
f
)
=>
vec4s
.push
(
f
.map
(|
x
|
x
as
f32
)
.into
()),
&
Inputs
::
Mat2
(
f
)
=>
mat2s
.push
(
f64tof32
(
f
.into
())),
&
Inputs
::
Mat3
(
f
)
=>
mat3s
.push
(
f64tof32
(
f
.into
())),
&
Inputs
::
Mat4
(
f
)
=>
mat4s
.push
(
f64tof32
(
f
.into
())),
&
Inputs
::
Variable
=>
unreachable!
(),
match
*
actual
{
Inputs
::
Float
(
f
)
=>
floats
.push
(
f
as
f32
),
Inputs
::
Vec2
(
f
)
=>
vec2s
.push
(
f
.map
(|
x
|
x
as
f32
)
.into
()),
Inputs
::
Vec3
(
f
)
=>
vec4s
.push
(
f
.map
(|
x
|
x
as
f32
)
.extend
(
1.
)
.into
()),
Inputs
::
Vec4
(
f
)
=>
vec4s
.push
(
f
.map
(|
x
|
x
as
f32
)
.into
()),
Inputs
::
Mat2
(
f
)
=>
mat2s
.push
(
f64tof32
(
f
.into
())),
Inputs
::
Mat3
(
f
)
=>
mat3s
.push
(
f64tof32
(
f
.into
())),
Inputs
::
Mat4
(
f
)
=>
mat4s
.push
(
f64tof32
(
f
.into
())),
Inputs
::
Variable
=>
unreachable!
(),
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/objects.rs
+
8
−
3
View file @
0d11271f
...
...
@@ -200,7 +200,7 @@ type MCSGObject = HashMap<String, String>;
type
MCSGCSG
=
Vec
<
MCSGCSGPart
>
;
type
MCSGCSGPart
=
HashMap
<
String
,
String
>
;
fn
matrix3_from_string
(
input
:
&
S
tr
ing
)
->
Result
<
Matrix3
<
f32
>
,
String
>
{
fn
matrix3_from_string
(
input
:
&
s
tr
)
->
Result
<
Matrix3
<
f32
>
,
String
>
{
let
vec
=
input
.split
(
' '
)
.map
(|
s
|
s
.parse
::
<
f32
>
())
...
...
@@ -211,7 +211,7 @@ fn matrix3_from_string(input: &String) -> Result<Matrix3<f32>, String> {
Ok
(
*
matrix
)
}
fn
vector3_from_string
(
input
:
&
S
tr
ing
)
->
Result
<
Vector3
<
f32
>
,
String
>
{
fn
vector3_from_string
(
input
:
&
s
tr
)
->
Result
<
Vector3
<
f32
>
,
String
>
{
let
vec
=
input
.split
(
' '
)
.map
(|
s
|
s
.parse
::
<
f32
>
())
...
...
@@ -222,7 +222,7 @@ fn vector3_from_string(input: &String) -> Result<Vector3<f32>, String> {
Ok
(
*
vector
)
}
fn
point3_from_string
(
input
:
&
S
tr
ing
)
->
Result
<
Point3
<
f32
>
,
String
>
{
fn
point3_from_string
(
input
:
&
s
tr
)
->
Result
<
Point3
<
f32
>
,
String
>
{
let
vec
=
input
.split
(
' '
)
.map
(|
s
|
s
.parse
::
<
f32
>
())
...
...
@@ -242,16 +242,19 @@ fn get_trs(o: &HashMap<String, String>) -> Result<TRS, String> {
Ok
(
TRS
{
translation
:
o
.get
(
"t"
)
.map
(
String
::
as_str
)
.map
(
point3_from_string
)
.transpose
()
?
.unwrap_or
(
Point3
::
origin
()),
rotation
:
o
.get
(
"r"
)
.map
(
String
::
as_str
)
.map
(
matrix3_from_string
)
.transpose
()
?
.unwrap_or
(
Matrix3
::
identity
()),
scale
:
o
.get
(
"s"
)
.map
(
String
::
as_str
)
.map
(
vector3_from_string
)
.transpose
()
?
.unwrap_or
(
Vector3
{
...
...
@@ -263,6 +266,7 @@ fn get_trs(o: &HashMap<String, String>) -> Result<TRS, String> {
}
fn
get_color
(
o
:
&
HashMap
<
String
,
String
>
)
->
Result
<
Vector3
<
f32
>
,
String
>
{
Ok
(
o
.get
(
"color"
)
.map
(
String
::
as_str
)
.map
(
vector3_from_string
)
.transpose
()
?
.unwrap_or
(
Vector3
{
...
...
@@ -274,6 +278,7 @@ fn get_color(o: &HashMap<String, String>) -> Result<Vector3<f32>, String> {
fn
get_rgb
(
o
:
&
HashMap
<
String
,
String
>
)
->
Result
<
Vector3
<
f32
>
,
String
>
{
Ok
(
o
.get
(
"rgb"
)
.map
(
String
::
as_str
)
.map
(
vector3_from_string
)
.transpose
()
?
.unwrap_or
(
Vector3
{
...
...
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