Skip to content

Reworking material properties #434

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged

Reworking material properties #434

merged 2 commits into from
Apr 30, 2025

Conversation

adriengivry
Copy link
Member

@adriengivry adriengivry commented Apr 2, 2025

Description

  • Renamed Material properties from "uniforms" to "properties":
    • Shaders have "uniforms"
    • Materials have "properties"
  • Updated Material implementation to use std::variant for properties rather than std::any:
    • Stronger type safety
    • In the past, it was possible to call Material::Set<double>(...), resulting in a double being stored and never being used (since we expected a float)
    • Increased memory footprint...
    • ...but faster runtime
  • Laid the foundation for the shader variant system
  • For textures, a property can either be of type:
    • HAL::TextureHandle*: backend texture, never serialized since no file is associated with it
    • Resources::Texture*: texture asset, serialized
    • both are made nullable (pointer) so the default "emptyTexture" (1x1 white square) can be used

Related Issues

N/A

@adriengivry adriengivry added Refactoring Something that needs a refactoring Graphics Graphical feature Cleanup Code cleanup labels Apr 2, 2025
@adriengivry adriengivry force-pushed the rework/material_properties branch 4 times, most recently from 9ba41ce to bf23efc Compare April 3, 2025 19:29
@adriengivry adriengivry self-assigned this Apr 3, 2025
@adriengivry adriengivry force-pushed the rework/material_properties branch 2 times, most recently from d1b4de9 to 4ec5fee Compare April 3, 2025 20:23
@adriengivry adriengivry force-pushed the rework/material_properties branch from 4ec5fee to 7f8430b Compare April 3, 2025 20:29
@adriengivry adriengivry changed the title [WIP] Reworking material properties Reworking material properties Apr 3, 2025
@adriengivry adriengivry marked this pull request as ready for review April 3, 2025 20:29
@adriengivry adriengivry merged commit 35a7362 into main Apr 30, 2025
@adriengivry adriengivry deleted the rework/material_properties branch April 30, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup Code cleanup Graphics Graphical feature Refactoring Something that needs a refactoring
Development

Successfully merging this pull request may close these issues.

2 participants