Basic_viewer: colour faces by value (distance to the plane and cell size) - #9598
Open
RajdeepKushwaha5 wants to merge 7 commits into
Open
Basic_viewer: colour faces by value (distance to the plane and cell size)#9598RajdeepKushwaha5 wants to merge 7 commits into
RajdeepKushwaha5 wants to merge 7 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds an automatic colouring of the faces by a value, mapped to a colour from a palette, suggested by the mentors as a follow-up to the clipping work. It reuses the per-volume face groups already stored for the cap (#9566).
Palette (D key). D turns the colouring on and cycles the palette: off, then a heat, a jet and a grey ramp. The palette is evaluated in the face shader, so there is no texture and no extra data.
Value (Shift+D key). Shift+D picks the value and how it is shown:
The distance is computed in the shader from the clipping plane the user already positions with Ctrl+C, so moving the plane recolours live and nothing is stored. The size is one number per cell: for this first version it is the cell's bounding-box volume (exact for axis-aligned cells, a close proxy otherwise), normalised over the smallest and largest cell so the palette spans the whole range. The exact cell volume is a planned follow-up.
The per-cell modes draw each volume with one flat value, reusing the per-volume groups, so the colouring is consistent with the clipping. It works in every face mode, including whole-volume clipping, where the kept cells follow the same colour map.
The change is contained in Basic_shaders.h and Basic_viewer.h.
Testing: verified on grids of hexahedra (Linear_cell_complex) with varying cell sizes that the three values and the three palettes behave as described, that the per-cell modes read as flat blocks with no melting, that the size palette runs from the smallest to the largest cell and does not depend on the plane, and that the colouring holds in every clipping mode, including the kept cells in whole-volume clipping.
Commits (the colour work on top of #9585)
836c619 Basic_viewer: colour faces by value (distance to the clipping plane)
36dd84d Basic_viewer: colour by value per cell (one flat colour per cell)
f34531a Basic_viewer: add cell size as a colour-by-value source
4caf4e3 Basic_viewer: colour the kept volumes in whole-volume clipping