-
Notifications
You must be signed in to change notification settings - Fork 1
feat: generic ecs material with texture type slots + shader uniforms #33
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
662e35c
feat: generic ecs material with texture type slots + shader uniforms
gimploo 8354f12
fix: remove typeof, fix animation_filter_t, fix ASSET_TYPE_TEXTURE
gimploo 8d1ddc6
fix: str_lit -> str in assignments, fix collision-scene material fields
gimploo f1e49d6
fix: cap ecs material pool capacity to avoid OOM with larger struct
gimploo 819cff7
fix: increase component buffer to fit larger material struct
gimploo ed6baf6
fix: keep light uniforms auto-injected for backward compat
gimploo 23facc0
feat: replace flat texture ids with gltexturelist_t in render pipeline
gimploo 44f0351
fix: workbench .textures -> .texture, assimp animation filter call
gimploo 0308984
fix: address review - gltexturelist_t textures in material, simplify …
gimploo 4b5e8cf
feat: uniform registry — name-keyed lookup table for model/mesh systems
gimploo 5088107
fix: vec3f macro usage in uniform_registry.h
gimploo eb512b3
fix: address review — inline material overrides, identity fallback fo…
gimploo 70c71cb
fix: address review — strip compute ctx, inline source switch, INTERN…
gimploo ac15698
fix: address review — separate material override pass with crash on u…
gimploo daf9a06
fix: material is sole authority for light.* uniforms, no defaults
gimploo 61d53a8
fix: drop uniform registry, hardcode assignments directly
gimploo d94338b
feat: separate uniform resolution from render systems
gimploo 9288cc3
fix: update ecs serialization tests for new material format
gimploo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,10 +104,9 @@ static const ecs_cmp_field_map_t ecs_deserializer__internal_cmp_field_maps[ECS_C | |
| } | ||
| }, | ||
| [ECS_CMP_MATERIAL_IDX] = { | ||
| .field_count = 2, | ||
| .field_count = 1, | ||
| .fields = { | ||
| CMP_FLD_DESC("\ttexture_asset_id:", "\ttexture_asset_id:%u", ecs_component_material_t, texture_asset_id, ECS_CMP_FLD_U32), | ||
| CMP_FLD_DESC("\tshader_asset_id:", "\tshader_asset_id:%u", ecs_component_material_t, shader_asset_id, ECS_CMP_FLD_U32), | ||
| CMP_FLD_DESC("\tshader_asset_id:", "\tshader_asset_id:%u", ecs_component_material_t, shader.asset_id, ECS_CMP_FLD_U32), | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks wrong ? |
||
| } | ||
| }, | ||
| [ECS_CMP_CAMERA_IDX] = { | ||
|
|
@@ -210,7 +209,7 @@ INTERNAL void ecs_serializer__internal_entity_cmp_data(file_t *const file, const | |
| case ECS_CMP_TRANSFORM: total_members = 5; bytesize = sizeof(ecs_component_transform_t); break; | ||
| case ECS_CMP_MODEL: total_members = 2; bytesize = sizeof(ecs_component_model_t); break; | ||
| case ECS_CMP_INPUT: total_members = 3; bytesize = sizeof(ecs_component_input_t); break; | ||
| case ECS_CMP_MATERIAL: total_members = 2; bytesize = sizeof(ecs_component_material_t); break; | ||
| case ECS_CMP_MATERIAL: total_members = 1; bytesize = sizeof(ecs_component_material_t); break; | ||
| case ECS_CMP_CAMERA: total_members = 3; bytesize = sizeof(ecs_component_camera_t); break; | ||
| case ECS_CMP_COLLIDER: total_members = 5; bytesize = sizeof(ecs_component_collider_t); break; | ||
| case ECS_CMP_MESH: total_members = 2; bytesize = sizeof(ecs_component_mesh_t); break; | ||
|
|
@@ -379,8 +378,7 @@ INTERNAL void ecs_deserializer__internal_remap_entity_assets(ecs_componentbundle | |
| } break; | ||
| case ECS_CMP_MATERIAL: { | ||
| ecs_component_material_t *mat = &bundle->component[cmp_idx].material; | ||
| if (mat->texture_asset_id) mat->texture_asset_id = ecs_deserializer__internal_ensure_asset_loaded(assets, mat->texture_asset_id, assets_parsed); | ||
| if (mat->shader_asset_id) mat->shader_asset_id = ecs_deserializer__internal_ensure_asset_loaded(assets, mat->shader_asset_id, assets_parsed); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ensure tests are updated for ecs serialization |
||
| if (mat->shader.asset_id) mat->shader.asset_id = ecs_deserializer__internal_ensure_asset_loaded(assets, mat->shader.asset_id, assets_parsed); | ||
| } break; | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #pragma once | ||
| #include "poglib/ecs/common.h" | ||
| #include "poglib/ecs/component.h" | ||
| #include "poglib/ecs/component/types.h" | ||
| #include "poglib/ecs/uniform_registry.h" | ||
|
|
||
| void ecs_system_uniform_resolve(ecs_componentmanager_t *const cmp_manager, const ecs_system_ctx_t ctx) | ||
| { | ||
| slot_t *primary_pool = slot_get_value(&cmp_manager->componentpool_slots, ECS_CMP_MATERIAL_IDX); | ||
|
|
||
| slot_iterator(primary_pool, ITER) | ||
| { | ||
| const ecs_component_poolentry_t *const entry = ITER; | ||
| ecs_component_material_t *material = (ecs_component_material_t *)entry->entity_cmpdata; | ||
|
|
||
| if (!material->shader.asset_id) continue; | ||
|
|
||
| uniform_registry_resolve_material_uniforms( | ||
| material, cmp_manager, entry->entity_id, ctx.active_camera); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why does it need 3KB ?