Skip to content

Conversation

CuddlyBunion341
Copy link
Owner

@CuddlyBunion341 CuddlyBunion341 commented Jun 19, 2024

This change was proposed in #1. It is less flexible but more performant.

@CuddlyBunion341 CuddlyBunion341 force-pushed the feature/refactor-textures branch from 81aa7dc to 5f6f33d Compare October 17, 2024 20:22
Copy link
Owner Author

@CuddlyBunion341 CuddlyBunion341 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

}
type TextureUV = [f32; 2];

const AIR_TEXTURE: TextureUV = [-1.0, -1.0];
Copy link
Owner Author

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 {
Copy link
Owner Author

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> {
Copy link
Owner Author

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)

@CuddlyBunion341 CuddlyBunion341 force-pushed the feature/refactor-textures branch from 5d68c40 to be5db01 Compare October 17, 2024 20:58
@CuddlyBunion341 CuddlyBunion341 merged commit 3dcc755 into main Oct 17, 2024
3 checks passed
@CuddlyBunion341 CuddlyBunion341 deleted the feature/refactor-textures branch October 17, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant