-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9c15d9
commit 3982783
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "color" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
||
[dependencies.cuboid] | ||
path = "../cuboid" | ||
|
||
[dependencies.fj] | ||
path = "../../crates/fj" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use fj::{ | ||
core::{ | ||
objects::{Region, Solid}, | ||
operations::{ | ||
insert::Insert, | ||
update::{UpdateFace, UpdateShell, UpdateSolid}, | ||
}, | ||
services::Services, | ||
storage::Handle, | ||
}, | ||
interop::Color, | ||
}; | ||
|
||
pub fn model(services: &mut Services) -> Handle<Solid> { | ||
let size = 1.; | ||
let cuboid = cuboid::model([size, size, size], services); | ||
|
||
cuboid | ||
.update_shell(cuboid.shells().only(), |shell| { | ||
shell | ||
.update_face(shell.faces().first(), |face| { | ||
face.update_region(|region| { | ||
Region::new( | ||
region.exterior().clone(), | ||
region.interiors().into_iter().cloned(), | ||
Some(Color::from([0., 1., 0.])), | ||
) | ||
.insert(services) | ||
}) | ||
.insert(services) | ||
}) | ||
.insert(services) | ||
}) | ||
.insert(services) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use fj::{core::services::Services, handle_model}; | ||
|
||
fn main() -> fj::Result { | ||
let mut services = Services::new(); | ||
let model = color::model(&mut services); | ||
handle_model(model, services)?; | ||
Ok(()) | ||
} |