载入中...
搜索中...
未找到
ColorRamp.h
浏览该文件的文档.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
6namespace eve::procgen {
7
8struct Rgba8 {
9 uint8_t r = 0, g = 0, b = 0, a = 255;
10};
11
13struct ColorRamp {
14 struct Stop {
15 float t = 0.f;
17 };
18
19 std::vector<Stop> stops;
20
21 void add(float t, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
22 Rgba8 sample(float t) const;
24 Rgba8 sampleBanded(float t, int bands) const;
25};
26
27} // namespace eve::procgen
uint32_t a
uint32_t b
Piecewise-linear color ramp in t∈[0,1], with optional hard banding.
Definition ColorRamp.h:13
Rgba8 sampleBanded(float t, int bands) const
Quantize continuous t into bands steps then sample (pixel look).
Definition ColorRamp.cpp:34
std::vector< Stop > stops
Definition ColorRamp.h:19
Rgba8 sample(float t) const
Definition ColorRamp.cpp:14
void add(float t, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Definition ColorRamp.cpp:8