-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor texture definitions #6
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
Conversation
81aa7dc
to
5f6f33d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
src/client/terrain/util/blocks.rs
Outdated
} | ||
type TextureUV = [f32; 2]; | ||
|
||
const AIR_TEXTURE: TextureUV = [-1.0, -1.0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use enums instead of explicitly defining constants
} | ||
|
||
impl TextureManager { | ||
pub fn new() -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Introduce cfg files for texture coordinates / dynamic texture atlas generation from texture names
} | ||
|
||
pub fn create_chunk_mesh(chunk: &Chunk) -> Option<Mesh> { | ||
pub fn create_chunk_mesh(chunk: &Chunk, texture_manager: &TextureManager) -> Option<Mesh> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing TextureManager resource does increase complexity but at least that shit doesn't need to be hardcoded anymore (the constructor could dynamically set texture coordinates)
5d68c40
to
be5db01
Compare
This change was proposed in #1. It is less flexible but more performant.