Skip to content

Plat 10869 cmf viewer axis for normals tangent and binormals#4

Merged
filipppavlov merged 26 commits into
mainfrom
PLAT-10869-CMF-Viewer-Axis-for-normals-tangent-and-binormals
Jun 24, 2026
Merged

Plat 10869 cmf viewer axis for normals tangent and binormals#4
filipppavlov merged 26 commits into
mainfrom
PLAT-10869-CMF-Viewer-Axis-for-normals-tangent-and-binormals

Conversation

@ccp-intern

Copy link
Copy Markdown
Contributor

PR Classification

Refactor and feature addition to unify mesh state management and add per-mesh axis visualization.

PR Summary

This PR refactors mesh state handling to use a unified MeshState struct, adds per-mesh normal/tangent/binormal visualization with new shaders and UI controls, and updates related rendering and state logic.

  • appState.h/cpp, mesh.cpp/h: Replace parallel mesh state collections with a single StateCollection<MeshState>, updating all mesh property logic and callbacks.
  • Add new axis visualization shaders and integrate them into the build system and shader cache (CMakeLists.txt, shaderCacheCreator.py, new shader files).
  • mesh.cpp/h: Add creation and rendering of axis debug primitives based on mesh vertex declaration and mesh state toggles.
  • uiRenderer.cpp/h: Update UI to support new mesh state structure, including batch toggles for display, wireframe, audio occlusion, and axis visualizations.
  • shadercache.cpp/h: Update shader cache and pipeline logic to support vertex input rate and usage index for correct shader matching.

CCPNobody and others added 19 commits June 3, 2026 13:39
Making a meshState object that contains the state of each mesh.
Moving away from the equally sized collections of states on the model
Fixing the defect where the model that was loaded wasn't loaded as the animation owner
Added a shader for vertex colors.
Since we can have multiple vertex attributes that can be visualized, I added support in the python script to create one shader for each usage index (but only if there are 2 vertex attributes required by the shader: position and the thing to visualize)

I also added default shader selection
Add debug visualization for vertex normals, tangents and binormals.
New GLSL shaders and a shared packed_tangent.inc helper were added (unpacked/packed/legacy variants and axis vertex/fragment shaders).
Primitive and axis code were extended: axis primitives, creation helpers, and mesh-level PrimitiveRenderable instances are created/initialized and rendered conditionally.
GraphicsEffect now defines a VertexUboData and supports vertexInputRate so axis rendering can use instance-rate vertex streams;
ShaderCache uses this rate when creating pipelines.
UI and AppState were extended with per-mesh and global toggles to show/hide normals/tangents/bitangents.
Also refine CMake shader generation to only compile .comp/.vert/.frag files and simplify model_packed_normal shaders to include the shared packed tangent code.
A small change was made to the shaderCacheCreator script to skip unknown shader types.
Rename and refactor orientation/gizmo primitives and effects, clean up shaders and misc fixes based on pr code review:

- Rename Axis::Create -> Axis::CreateOrientationPrimitive and update callers (orientationGizmoRenderer, animationState).
- Introduce CreateOrientationEffect and refactor PrimitiveEffects: move CreateAxisEffect implementation, add CreateOrientationEffect, use constexpr axis constants, and rework CreateFlatColorEffect placement.
- Remove unused modelMatrix from tangent/normal/binormal vertex shaders.
- Add callback invocations for showVertexNormals, showVertexTangents, showVertexBinormals in app state.
- Improve SFINAE utility formatting in appState_template_impl.h.
- Add padding to AxisConfig and update primitive header (remove SetBuffer API) and implementation (assert vertexBuffer non-null).
- Move DEFAULT_SHADER_ORDER into anonymous namespace and minor formatting/spacing cleanups.
- Fix typo in shaderCacheCreator.py (continueu -> continue) and tighten CMake shader-extension string comparisons.

Also include small fixes for rendering call sites and mesh debug rendering argument formatting.
Disable per-mesh and global UI controls for normals, tangents and bitangents when meshes lack those vertex attributes. Adds hasNormals/hasTangents/hasBinormals flags to MeshUiState and populates them in UpdateUiState by inspecting the vertex declaration; wraps the corresponding ImGui controls with BeginDisabled/EndDisabled. Also minor cleanup in primitive effects: value-initialize AxisConfig and remove a padding field from the struct.
Changed the near and far clip calculations based on how far the boundingsphere center is in the view space, instead of euclidian eye to center space
Add support for multiple vertex-usage indices and shader input declarations. Introduces GraphicsEffectTypes and ShaderInputDeclaration handling, updates GraphicsEffect APIs and many call sites to accept a usageIndex or shader input declaration. StateCollection gained templated AddState overloads and empty(), model/mesh code now tracks per-usage axis renderables (vectors) and uses State<std::pair<usageIndex,bool>> for per-index toggles. Shaders were annotated for multi_usage, shader cache and UI were updated to expose available shaders with their declarations and to present per-attribute checkboxes. Overall this enables proper handling of multiple normal/tangent/bitangent streams.
Implemented tri-state checkboxes in the UI for mesh display, wireframe, and audio occlusion controls, as well as per-attribute-index toggles for normals, tangents, and bitangents. Refactored related logic, improved tooltips, and added helper methods for managing tri-state states across multiple meshes.
github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot dismissed their stale review June 24, 2026 09:46

outdated suggestion

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot dismissed their stale review June 24, 2026 09:49

outdated suggestion

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot dismissed their stale review June 24, 2026 09:56

outdated suggestion

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot dismissed their stale review June 24, 2026 09:58

outdated suggestion

Comment thread src/viewer/rendering/uiRenderer.cpp Outdated
Comment thread src/viewer/rendering/vulkan/shadercache.cpp Outdated
Comment thread src/viewer/assets/shaders/binormalaxis.vert Outdated
Comment thread src/viewer/assets/shaders/binormalaxis.frag Outdated
Comment thread src/viewer/assets/shaders/model_color.frag Outdated
Comment thread src/viewer/assets/shaders/tangentaxis.vert Outdated
Comment thread src/viewer/assets/shaders/packedtangentaxis.vert Outdated
Comment thread src/viewer/assets/shaders/normalaxis.frag Outdated
Comment thread src/viewer/assets/shaders/packedtangentaxis.frag Outdated
Comment thread src/viewer/assets/shaders/tangentaxis.frag Outdated
@filipppavlov filipppavlov merged commit 0805466 into main Jun 24, 2026
11 of 13 checks passed
@filipppavlov filipppavlov deleted the PLAT-10869-CMF-Viewer-Axis-for-normals-tangent-and-binormals branch June 24, 2026 13:29
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.

3 participants