Skip to content
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

Color palettes #289

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8bfff38
lots of color palettes from fabio crameri
justinlaughlin Jul 11, 2024
ca63ace
Merge branch 'master' into more-color-palettes
justinlaughlin Oct 18, 2024
c8deaac
add in prototype classes for holding palettes
justinlaughlin Oct 18, 2024
b98e21d
remove palette arrays
justinlaughlin Oct 18, 2024
e1751a1
add palettes.txt
justinlaughlin Oct 18, 2024
b077d09
starting to integrate
justinlaughlin Oct 18, 2024
60fedec
more integration
justinlaughlin Oct 19, 2024
5ad4783
basic integration done
justinlaughlin Oct 19, 2024
5ad2b62
trying to compile core palettes ahead of time (wip)
justinlaughlin Oct 19, 2024
6ef23dd
refactor Palettes; should work with both pre-compiled and dynamic now…
justinlaughlin Nov 5, 2024
009aeb0
add all other base palettes
justinlaughlin Nov 5, 2024
05d1486
remove lib/palettes.txt
justinlaughlin Nov 5, 2024
7f46780
add helper print to cpp method to Palette
justinlaughlin Nov 5, 2024
cb45902
add base_palettes to makefile
justinlaughlin Nov 5, 2024
05ed4fc
some fixes
justinlaughlin Nov 5, 2024
3221277
update glvis.cpp to load palette_file
justinlaughlin Nov 5, 2024
de86c0e
update palettes.txt
justinlaughlin Nov 5, 2024
b09087a
update print functions
justinlaughlin Nov 5, 2024
b2a25c4
update CMakeLists.txt
justinlaughlin Nov 5, 2024
5e1317e
fix some compiler issues
justinlaughlin Nov 5, 2024
ba03cc7
run make style and remove some redundant palettes
justinlaughlin Nov 5, 2024
f1ac608
more compiler fixes
justinlaughlin Nov 5, 2024
3c91d0a
cleanup, add copyright, fix mac compiler error
justinlaughlin Nov 5, 2024
0d6a702
remove a magic number
justinlaughlin Nov 5, 2024
3d1ed07
fix c99 compiler error
justinlaughlin Nov 5, 2024
ed2708d
minor
tzanio Nov 10, 2024
190e5c4
add license and reference for crameri palettes
justinlaughlin Nov 12, 2024
b18d406
reserve colors
justinlaughlin Nov 12, 2024
1f4ff9c
size_t -> int
justinlaughlin Nov 12, 2024
c31e0e6
change vector<shared_ptr<Palette>> to just vector<Palette>
justinlaughlin Nov 13, 2024
dd284c1
update ToTextureDiscrete/Smooth to use Palette
justinlaughlin Nov 13, 2024
89d224c
change to unique_ptr
justinlaughlin Nov 13, 2024
b20c23a
fix some more size_t/int inconsistencies
justinlaughlin Nov 13, 2024
66af356
init paletteTexIds with NumPalettes()
justinlaughlin Nov 13, 2024
7e03752
add check for c++<14 for make_unique
justinlaughlin Nov 13, 2024
e571cd0
better rgb/alpha array ownership
justinlaughlin Nov 13, 2024
2a71210
rename make_unique incase c++ version is high enough that its availab…
justinlaughlin Nov 13, 2024
208bebb
slowly reducing responsibility of PaletteState; Textures are generate…
justinlaughlin Nov 15, 2024
15bf80f
small change to allow for custom alpha map and also an example palett…
justinlaughlin Nov 15, 2024
0f34966
typo; accidently flipped all palettes
justinlaughlin Nov 15, 2024
82fedfa
fix crash for reversed palettes
justinlaughlin Nov 16, 2024
3f536af
add message for current palette
justinlaughlin Nov 16, 2024
422dcf9
rename base_palettes to palettes_base
justinlaughlin Nov 16, 2024
9476dcc
separate source code from headers; add some documentation
justinlaughlin Nov 16, 2024
41fcdca
update CHANGELOG
justinlaughlin Nov 16, 2024
63b709f
typo in constructor
justinlaughlin Nov 16, 2024
006a042
add Palette::is_translucent() and use in checks
justinlaughlin Nov 16, 2024
34cc5fb
add translucency to colorbar + tweak alpha on example palettes
justinlaughlin Nov 16, 2024
98c3d5e
Small adjustments
tzanio Nov 17, 2024
fa1568a
rename palette_definitions.cpp -> palettes_default.cpp
justinlaughlin Nov 17, 2024
a7daafc
update casing of method names
justinlaughlin Nov 17, 2024
416e40e
add palettes-cet.txt
justinlaughlin Nov 18, 2024
5641e63
fix couple names
justinlaughlin Nov 18, 2024
27e618b
typo in palettes-cet.txt
justinlaughlin Nov 18, 2024
6710888
Update lib/palettes.hpp
justinlaughlin Nov 20, 2024
e748539
Update lib/palettes_base.cpp
justinlaughlin Nov 20, 2024
96a5a20
Update palettes_base.cpp
justinlaughlin Nov 20, 2024
cbf9596
const Palette * for Texture
justinlaughlin Nov 20, 2024
03f9330
Update lib/palettes_base.cpp
justinlaughlin Nov 21, 2024
33c5982
add some of Jans suggestions
justinlaughlin Nov 21, 2024
c05d6ad
Merge branch 'more-color-palettes' of github.com:/GLVis/glvis into mo…
justinlaughlin Nov 21, 2024
02562af
add some more of jans suggestions
justinlaughlin Nov 21, 2024
700c77d
catch a couple typos
justinlaughlin Nov 21, 2024
6a95fd2
Update lib/palettes_base.cpp
justinlaughlin Nov 21, 2024
4d4be89
Use new Texture class to simplify PaletteState
justinlaughlin Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
https://glvis.org


Version 4.3.3 (development)
===========================

- Added a more flexible color palette system, enabling specification at both
compile and run time. Run time palettes are specified with a file and the
command line argument -p <palette_filename>.

- Added 28 new optional color-vision deficiency friendly and perceptually
uniform color palettes. See file share/palettes-crameri.txt.

- Palettes can now also be specified with explicit alpha channels. See file
share/palettes-variable-opacity.txt.

- Fixed a bug where discrete textures would not repeat.


Version 4.3.2 released on Sep 27, 2024
======================================

Expand Down
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ their own respective licenses which can be found in their code and attached
license files. These software products and their licenses are as follows:

* GL2PS (linalg/gl2ps.{h,c}) -- Custom 1-clause license
* Additional color palettes (share/palettes-crameri.txt) -- MIT license
9 changes: 9 additions & 0 deletions glvis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ int main (int argc, char *argv[])
bool save_stream = false;
const char *stream_file = string_none;
const char *script_file = string_none;
const char *palette_file = string_none;
const char *font_name = string_default;
int portnum = 19916;
int multisample = GetMultisample();
Expand Down Expand Up @@ -1358,6 +1359,8 @@ int main (int argc, char *argv[])
"Number of digits used for processor ranks in file names.");
args.AddOption(&script_file, "-run", "--run-script",
"Run a GLVis script file.");
args.AddOption(&palette_file, "-p", "--palettes",
"Palette file.");
args.AddOption(&arg_keys, "-k", "--keys",
"Execute key shortcut commands in the GLVis window.");
args.AddOption(&stream_state.fix_elem_orient, "-fo", "--fix-orientations",
Expand Down Expand Up @@ -1487,6 +1490,12 @@ int main (int argc, char *argv[])
}
SetUseHiDPI(enable_hidpi);

// Load in palette file, if specified
if (palette_file != string_none)
{
BasePalettes.load(palette_file);
}

GLVisGeometryRefiner.SetType(geom_ref_type);

string data_type;
Expand Down
2 changes: 2 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ list(APPEND SOURCES
material.cpp
openglvis.cpp
palettes.cpp
palettes_base.cpp
sdl.cpp
sdl_helper.cpp
sdl_main.cpp
Expand All @@ -45,6 +46,7 @@ list(APPEND HEADERS
material.hpp
openglvis.hpp
palettes.hpp
palettes_base.hpp
sdl.hpp
sdl_helper.hpp
sdl_main.hpp
Expand Down
12 changes: 1 addition & 11 deletions lib/openglvis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ VisualizationScene::AddPaletteMaterial(glTF_Builder &bld)
/* wrapT: */ glTF_Builder::wrap_type::CLAMP_TO_EDGE);
// create palette image
const int palette_size = palette.GetNumColors();
vector<array<float,4>> palette_data(palette_size);
vector<array<float,4>> palette_data = palette.GetPalette()->data();
#if 0
glGetTextureImage(
palette.GetColorTexture(), 0,
Expand All @@ -491,16 +491,6 @@ VisualizationScene::AddPaletteMaterial(glTF_Builder &bld)
glGetTexImage(GL_TEXTURE_2D, 0,
gl3::GLDevice::useLegacyTextureFmts() ? GL_RGBA : GL_RGBA32F,
GL_FLOAT, palette_data.data());
#else
const double *palette_data_raw = palette.GetData();
for (int i = 0; i < palette_size; ++i)
{
for (int j = 0; j < 3; ++j)
{
palette_data[i][j] = (float) palette_data_raw[j + 3*i];
}
palette_data[i][3] = 1.0f;
}
#endif
auto palette_img =
bld.addImage(
Expand Down
Loading
Loading