ManevilleF / hexx

Hexagonal tools lib in rust
Apache License 2.0
288 stars 23 forks source link

Column mesh normals aren't normalized #108

Closed Netzwerk2 closed 1 year ago

Netzwerk2 commented 1 year ago

Describe the bug The normals generated by ColumnMeshBuilder are not unit vectors.

To Reproduce

use hexx::{ColumnMeshBuilder, HexLayout};

fn main() {
    let mesh_info = ColumnMeshBuilder::new(&HexLayout::default(), 1.0).build();

    for normal in mesh_info.normals {
        println!("{}", normal.length());
    }
}

Expected behavior All normals should be of length 1.

Screenshots Or Code snippet

Actual output ``` 1.7320508 1.7320508 1.7320508 1.7320508 1.7320509 1.7320509 1.7320509 1.7320509 1.7320508 1.7320508 1.7320508 1.7320508 1.7320508 1.7320508 1.7320508 1.7320508 1.7320509 1.7320509 1.7320509 1.7320509 1.7320508 1.7320508 1.7320508 1.7320508 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ```
ManevilleF commented 1 year ago

Nice catch, that should be easy enough to fix soon.

What are the consequences of this? Is the lighting affected ?

Netzwerk2 commented 1 year ago

I didn't test it, but yes it should affect lighting in bevy.

In my case I want to reflect a vector with respect to the normal, which gives wrong results if the normal isn't a unit vector.

ManevilleF commented 1 year ago

@alice-i-cecile Have you noticed lighting issues in Emergence ? Does #109 bring any visual change to the game ?

ManevilleF commented 1 year ago

@Netzwerk2 Could you check if #109 fixes the issue for you ?

Netzwerk2 commented 1 year ago

Yes, it works as expected now.