Skip to content

Commit

Permalink
Texture support in geo nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
markusmoenig committed Oct 24, 2024
1 parent b188c7d commit d8aec0a
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 51 deletions.
73 changes: 36 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v 0.8.14
--------

- Texture support for geometric materials.
- Many bugfixes in the node based geometric modeling engine.

v 0.8.13
--------
Expand Down
2 changes: 1 addition & 1 deletion StarterProject.eldiron

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion creator/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ lazy_static! {
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ActiveEditor {
GameEditor,
TerrainEditor,
ModelEditor,
TerrainEditor,
MaterialEditor,
ScreenEditor,
}
Expand Down
1 change: 1 addition & 0 deletions creator/src/toollist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ impl ToolList {
if let Some(layout) = ui.get_hlayout(layout_name) {
layout.clear();
layout.set_reverse_index(None);
ctx.ui.redraw_all = true;
}

self.get_current_tool().tool_event(
Expand Down
11 changes: 10 additions & 1 deletion creator/src/tools/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ impl Tool for PickerTool {
TileDown(c, _) => c,
TileDrag(c, _) => c,
Activate => {
if let Some(layout) = ui.get_sharedvlayout("Shared VLayout") {
layout.set_mode(TheSharedVLayoutMode::Top);
}
return true;
}
DeActivate => {
if let Some(layout) = ui.get_sharedvlayout("Shared VLayout") {
layout.set_mode(TheSharedVLayoutMode::Shared);
}
return true;
}
_ => {
Expand Down Expand Up @@ -190,7 +199,7 @@ impl Tool for PickerTool {
TheId::named("Set Region Modeler"),
TheValue::Empty,
));
found_geo = true;
println!("gound geo");
}
}
}
Expand Down
15 changes: 14 additions & 1 deletion shared/src/geofxnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,17 @@ impl GeoFXNode {
}
}

// println!("parameters {}", parameters);
// Texture
if let Some(value) = coll
.get_default("Texture", TheValue::Text(str!("")))
.to_string()
{
if !value.is_empty() {
parameters += &format!(", texture = \"{}\"", value);
}
}

//println!("parameters {}", parameters);

let mat = format!(
"let material_{id_counter} = Material<BSDF>: color = #{hex}{parameters};\n",
Expand Down Expand Up @@ -875,6 +885,9 @@ impl GeoFXNode {
name: str!("cutout"),
color: TheColor::new(0.5, 0.5, 0.5, 1.0),
}];
if highest_output_terminal == 1 {
highest_output_terminal += 1;
}
for i in 1..highest_output_terminal {
terminals.push(TheNodeTerminal {
name: format!("shape #{}", i),
Expand Down
11 changes: 5 additions & 6 deletions shared/src/regionfxnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,14 @@ impl RegionFXNode {
TopDownIsoCamera => {
canvas_pos.x -= region.width * region.tile_size;

let x = canvas_pos.x as f32;
let y = canvas_pos.y as f32;

let tile_width = region.tile_size as f32;
let tile_height_half = region.tile_size as f32 / 2.0;

let map_x = (canvas_pos.x as f32 / tile_width
+ canvas_pos.y as f32 / tile_height_half)
/ 2.0;
let map_y = (canvas_pos.y as f32 / tile_height_half
- (canvas_pos.x as f32 / tile_width))
/ 2.0;
let map_x = (x / tile_width + y / tile_height_half) / 2.0;
let map_y = (y / tile_height_half - (x / tile_width)) / 2.0;

vec3f(map_x, 0.0, map_y)
}
Expand Down
Loading

0 comments on commit d8aec0a

Please sign in to comment.