• Stars
    star
    413
  • Rank 101,392 (Top 3 %)
  • Language
    C++
  • License
    MIT License
  • Created about 9 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of shaders to draw color maps.

colormap-shaders

A collection of shaders to draw color map like this:

rainbow.

usage

Each *.frag shader sources provides a colormap function, which takes an float argument x (x should be: 0.0 <= x <= 1.0). The colormap function returns a vec4 value which represents an RGBA color.

vec4 colormap(float x);

void main() {
    gl_FragColor = colormap(gl_TexCoord[0].x);
}

/* include "shaders/rainbow.frag" here, for example. */

special case

gnuplot.frag

This shader emulates gnuplot's rgbformulae, and the signature of colormap is:

vec4 colormap(float x, int red_type, int green_type, int blue_type);

It takes additional 3 arguments, with same meanings to rgbformulae's 3 arguments respectively.

usage from c++

#include <colormap/colormap.h>
#include <iostream>

int main()
{
    using namespace colormap;

    // Print RGB table of MATLAB::Jet colormap.
    MATLAB::Jet jet;
    std::cout << "category: " << jet.getCategory() << std::endl;
    std::cout << "title:    " << jet.getTitle() << std::endl;
    int const size = 256;
    for (int i = 0; i < size; ++i) {
        float const x = i / (float)size;
        Color c = jet.getColor(x);
        std::cout << x << "\t" << c.r << "\t" << c.g << "\t" << c.b << std::endl;
    }

    // Dump category and title of all colormaps.
    for (std::shared_ptr<Colormap const> const& c : ColormapList::getAll()) {
        std::cout << c->getCategory() << " : " << c->getTitle() << std::endl;
    }
    return 0;
}

samples

MATLAB

name sample
MATLAB_autumn
MATLAB_bone
MATLAB_cool
MATLAB_copper
MATLAB_hot
MATLAB_hsv
MATLAB_jet
MATLAB_parula
MATLAB_pink
MATLAB_spring
MATLAB_summer
MATLAB_winter

gnuplot

name sample
rgbformulae(7, 5, 15)
rgbformulae(3, 11, 6)
rgbformulae(23, 28, 3)
rgbformulae(21, 22, 23)
rgbformulae(30, 31, 32)
rgbformulae(33, 13, 10)
rgbformulae(34, 35, 36)

IDL

name sample
IDL_Black-White_Linear
IDL_Blue-White_Linear
IDL_Green-Red-Blue-White
IDL_Red_Temperature
IDL_Blue-Green-Red-Yellow
IDL_Standard_Gamma-II
IDL_Prism
IDL_Red-Purple
IDL_Green-White_Linear
IDL_Green-White_Exponential
IDL_Green-Pink
IDL_Blue-Red
IDL_16_Level
IDL_Rainbow
IDL_Steps
IDL_Stern_Special
IDL_Haze
IDL_Blue-Pastel-Red
IDL_Pastels
IDL_Hue_Sat_Lightness_1
IDL_Hue_Sat_Lightness_2
IDL_Hue_Sat_Value_1
IDL_Hue_Sat_Value_2
IDL_Purple-Red+Stripes
IDL_Beach
IDL_Mac_Style
IDL_Eos_A
IDL_Eos_B
IDL_Hardcandy
IDL_Nature
IDL_Ocean
IDL_Peppermint
IDL_Plasma
IDL_Blue-Red_2
IDL_Rainbow_2
IDL_Blue_Waves
IDL_Volcano
IDL_Waves
IDL_Rainbow_18
IDL_Rainbow+White
IDL_Rainbow+Black
IDL_CB-Accent
IDL_CB-Dark2
IDL_CB-Paired
IDL_CB-Pastel1
IDL_CB-Pastel2
IDL_CB-Set1
IDL_CB-Set2
IDL_CB-Set3
IDL_CB-Blues
IDL_CB-BuGn
IDL_CB-BuPu
IDL_CB-GnBu
IDL_CB-Greens
IDL_CB-Greys
IDL_CB-Oranges
IDL_CB-OrRd
IDL_CB-PuBu
IDL_CB-PuBuGn
IDL_CB-PuRdn
IDL_CB-Purples
IDL_CB-RdPu
IDL_CB-Reds
IDL_CB-YIGn
IDL_CB-YIGnBu
IDL_CB-YIOrBr
IDL_CB-BrBG
IDL_CB-PiYG
IDL_CB-PRGn
IDL_CB-PuOr
IDL_CB-RdBu
IDL_CB-RdGy
IDL_CB-RdYiBu
IDL_CB-RdYiGn
IDL_CB-Spectral

transform

name sample
transform_rainbow
transform_apricot
transform_carnation
transform_ether
transform_grayscale_banded
transform_hot_metal
transform_lava_waves
transform_malachite
transform_seismic
transform_space
transform_morning_glory
transform_peanut_butter_and_jerry
transform_purple_haze
transform_rose
transform_saturn
transform_supernova

kbinani

name sample
kbinani_altitude

license

The MIT License. See 'LICENSE' file for detail.

More Repositories

1

screenshot

Go library to capture desktop to image
Go
1,126
star
2

win

WinAPI wrapper (and wrapper generator) for Go
Go
61
star
3

je2be

This repository has been moved to https://github.com/kbinani/je2be-core for migration to git lfs
C++
29
star
4

adblock-youtube-ads

https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt
Shell
28
star
5

je2be-desktop

Map converter for Minecraft: Available on Microsoft Store https://www.microsoft.com/store/apps/9PC9MFX9QCXS
C++
23
star
6

je2be-web

Web app to convert world data of Minecraft Java / Bedrock / Xbox360 Edition
TypeScript
21
star
7

je2be-core

Map converter for Minecraft Java and Bedrock Edition: Available as a Web App https://je2be.app, and as a Desktop App on Microsoft Store: https://www.microsoft.com/store/apps/9PC9MFX9QCXS
C++
15
star
8

mcview

Minecraft: top-down 2D map viewer
C++
13
star
9

qt-solutions

fork of git://gitorious.org/qt-solutions/qt-solutions.git
C++
13
star
10

libvsq

C++
13
star
11

nbte

NBT file editor for Minecraft
C++
8
star
12

noteshrink-c

C++ version of https://github.com/mzucker/noteshrink
C++
7
star
13

noteshrink

go version of https://github.com/mzucker/noteshrink
Go
6
star
14

libminecraft-file

Header-only Minecraft region file parser
C++
6
star
15

nkcv

艦これ専用ブラウザ
JavaScript
4
star
16

robot

[WIP] Desktop automation framework for Golang (Windows and macOS)
Go
4
star
17

nicolive-dl

Ruby
4
star
18

adblock-wikipedia

https://raw.githubusercontent.com/kbinani/adblock-wikipedia/master/signed.txt
Shell
3
star
19

dxrip

A command line tool to rip off mesh and texture data from DirectX application.
C++
3
star
20

holo-sports-festival-2022-plugin

Java
3
star
21

midi

SMF (Standard MIDI File) parser for Go
Go
3
star
22

fez-trade-bot

オンラインゲーム"Fantasy Earth Zero"の画面を監視し、トレード要請アイコンの出現を検知してゲーム内アイテムのトレードを行うbotアプリケーション
C#
2
star
23

sln2gyp

Python
2
star
24

lusolve

C++
2
star
25

win_api_type_info

Collection of WinAPI struct, typedef, enum, and const information
Go
2
star
26

PathOps

Logical operation library for CGPath with skia https://skia.org/ backend
Swift
2
star
27

ExportVSQ

Lua
2
star
28

vmulti-dll

a client dll for vmulti (Virtual Multiple HID Driver, http://code.google.com/p/vmulti/)
C
2
star
29

gdsync

rsync like Google Drive file sync tool. Local to GD, GD to Local, GD to GD sync supported.
Ruby
2
star
30

je2be-ios

Minecraft map converter for iOS: A front-end app of je2be: https://github.com/kbinani/je2be-core
Swift
2
star
31

homebrew-objc2swift

Unofficial homebrew tap for objc2swift https://github.com/yahoojapan/objc2swift
Ruby
1
star
32

sinsy

Unofficial svn clone of svn://svn.code.sf.net/p/sinsy/code-0
C++
1
star
33

RandomCoords2

Rewirte of https://github.com/BlackSpectrum/RandomCoords
Java
1
star
34

sandbox

1
star
35

luavsq

Lua
1
star
36

WaveFile

C++
1
star
37

constexpr_exp

C++
1
star
38

fezutil

C++
1
star
39

LayerBackedGLCanvas

A simple canvas widget to draw OpenGL surface in Layer-Backed mode for wxWidgets
Objective-C
1
star
40

rasig

AsakusaSatellite IRC Gateway
Visual Basic
1
star
41

holodorokei-plugin

Java
1
star
42

aviutl_plugin_sdk

Unofficial Git repository of aviutl plugin SDK http://spring-fragrance.mints.ne.jp/aviutl/
C++
1
star
43

kbinani.github.com

1
star
44

fakeQD

Thin wrapper of QuickDraw framework to build QuickDraw dependent app under modern OSX SDK (>10.6)
C++
1
star
45

remove-promotion-tweets

Chrome extension to remove promotion tweets, and collect promotion account IDs
JavaScript
1
star
46

gyp-cheat-sheet

gyp cheat sheet for VisualStudio
JavaScript
1
star