Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HeightMap mesh builder #170

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

## [Unreleased]

* (**BREAKING**) `HexOffsetMode` now has only 2 variants `Even` and `Odd`
* (**BREAKING**) `Hex::to_offset_coordinates` and `Hex::from_offset_coordinates`
take a new `HexOrientation` parameter (#189)
### HexLayout

* (**BREAKING**) `HexLayout` Y axis is no longer inverted by default (#187)
* `HexLayout` builder patter (#187)
* (**BREAKING**) `HexLayout` removed the `invert_x` and `invert_y` fields (#190)
Expand All @@ -16,8 +15,25 @@
- `inverse_transform_vector`
- `invert_x`
- `invert_y`
* Added `world_unit_vector` methods to `EdgeDirection` and `VertexDirection` (#190)
* Orientation matrices are now `glam::Mat2` (#191)
* Added `hex_edge_corners` utility method (#170)

### Mesh generation (#170)

* (**BREAKING**)`ColumnMeshBuilder` can now disable some side quads
* (**BREAKING**) `ColumnMeshBuilder` and `PlaneMeshBuilder` now use a centralized
`FaceOptions` for UV and inset options
* Added `PlaneMeshBuilder::with_face_options` builder method
* Added `Face::apply_options` taking a `FaceOptions` parameter
* Renamed `Quad::from_bottom` to `Quad::new`
* Added a new `HeightMapMeshBuilder` with its associated `heightmap_builder` example

## Misc

* (**BREAKING**) `HexOffsetMode` now has only 2 variants `Even` and `Odd`
* (**BREAKING**) `Hex::to_offset_coordinates` and `Hex::from_offset_coordinates`
take a new `HexOrientation` parameter (#189)
* Orientation matrices are now `glam::Mat2` (#191)
* Added `world_unit_vector` methods to `EdgeDirection` and `VertexDirection` (#190)

## 0.19.1

Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ name = "mesh_builder"
path = "examples/mesh_builder.rs"
required-features = ["bevy_reflect"]

[[example]]
name = "heightmap_builder"
path = "examples/heightmap_builder.rs"
required-features = ["bevy_reflect"]

[[example]]
name = "chunks"
path = "examples/chunks.rs"
Expand Down
74 changes: 41 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@
}
```

The [`MeshInfo`] can be produced from [`PlaneMeshBuilder`] or
[`ColumnMeshBuilder`]
The [`MeshInfo`] can be produced from [`PlaneMeshBuilder`],
[`ColumnMeshBuilder`] or [`HeightMapMeshBuilder`]

<!-- cargo-sync-readme end -->

Expand Down Expand Up @@ -289,15 +289,15 @@ impl PartialOrd for OrdByYX {

![hex_grid](docs/hex_grid.png "hex grid example")

> `cargo run --example hex_grid`
> `cargo run --example hex_grid`

This example showcases hex ranges, rings, wedges, rotation, and lines

### Hex Area

![hex_grid](docs/hex_area.png "hex area example")

> `cargo run --example hex_area`
> `cargo run --example hex_area`

This example showcases how to generate hexagonal areas using grid utilities and gizmos
and how to use two layouts on the same grid.
Expand All @@ -306,100 +306,108 @@ and how to use two layouts on the same grid.

![scroll_map](docs/scroll_map.gif "scroll map example")

> `cargo run --example scroll_map`
> `cargo run --example scroll_map`

This example showcases the `HexMap` struct for scrolling maps
This example showcases the `HexMap` struct for scrolling maps

### Wrap Map

![wrap_map](docs/wrap_map.gif "wrap map example")

> `cargo run --example wrap_map`
> `cargo run --example wrap_map`

This example showcases the `HexMap` struct for looping/wrapping map
This example showcases the `HexMap` struct for looping/wrapping map

### A Star pathfinding

![a_star](docs/a_star.png "A star example")

> `cargo run --example a_star`
> `cargo run --example a_star`

This example showcases the A star algorithm, with an interactive pathfinding
between the origin and your cursor. Clicking on tile toggles their availability
This example showcases the A star algorithm, with an interactive pathfinding
between the origin and your cursor. Clicking on tile toggles their availability

### Field of view

![fov](docs/fov.png "Field of View example")

> `cargo run --example field_of_view`
> `cargo run --example field_of_view`

This example showcases the FOV algorithm, with an interactive range fov around
your cursor.
Clicking on tile toggles their visibility.
This example showcases the FOV algorithm, with an interactive range fov around
your cursor.
Clicking on tile toggles their visibility.

### Field of movement

![fov](docs/field_of_movement.gif "Field of movement example")

> `cargo run --example field_of_movement`
> `cargo run --example field_of_movement`

This example showcases the field of movement algorithm, interactively displaying
the accessible range of movement around the cursor.
This example showcases the field of movement algorithm, interactively displaying
the accessible range of movement around the cursor.

### 3d columns

![columns](docs/3d_columns.png "3d columns example")

> `cargo run --example 3d_columns`
> `cargo run --example 3d_columns`

This example showcases the 3d hexagon columns procedural generation
This example showcases the 3d hexagon columns procedural generation

### 3d picking

![picking](docs/3d_picking.png "3d picking example")

> `cargo run --example 3d_picking`
> `cargo run --example 3d_picking`

This example showcases how to use the camera ray to detect hovered 3d columns

### Mesh builder

![mesh](docs/mesh_builder.png "Mesh builder example")

> `cargo run --example mesh_builder --features bevy_reflect`
> `cargo run --example mesh_builder --features bevy_reflect`

This example showcases the hexagon columns procedural generation customization options
This example showcases the hexagon columns procedural generation customization options

### Height Map Mesh builder

![mesh](docs/heightmap_builder.png "Height Map Mesh builder example")

> `cargo run --example heightmap_builder --features bevy_reflect`

This example showcases the hexagon 3D height map procedural generation customization options

### Chunks

![chunks](docs/chunks.png "Chunks example")

> `cargo run --example chunks`
> `cargo run --example chunks`

This example showcases the hexagon resolution system, allowing to tile coordinates
in evenly sized chunks
This example showcases the hexagon resolution system, allowing to tile coordinates
in evenly sized chunks

### Merged Chunks

![merged_chunks](docs/merged_columns.png "Merged Chunks example")

> `cargo run --example merged_columns --features bevy_reflect`
> `cargo run --example merged_columns --features bevy_reflect`

This example showcases how to build a simple hex chunk system with each chunk
being a single mesh
This example showcases how to build a simple hex chunk system with each chunk
being a single mesh

### Sprite Sheet

![sprite_sheet](docs/sprite_sheet.png "Sprite Sheet example")

> `cargo run --example sprite_sheet`
> `cargo run --example sprite_sheet`

This example showcases how to use hexx with 2D sprite sheet.
This example showcases how to use hexx with 2D sprite sheet.

### Shapes

![shapes](docs/shapes.png "Shapes example")

> `cargo run --example shapes --features bevy_reflect`
> `cargo run --example shapes --features bevy_reflect`

This example showcases how to use hexx shapes module
This example showcases how to use hexx shapes module
Binary file added docs/heightmap_builder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading