Color palettes are now raw objects.

This commit is contained in:
Rezmason
2019-02-18 20:56:43 -08:00
parent 92a75d387c
commit 79ff5f5cff
2 changed files with 46 additions and 51 deletions

View File

@@ -35,11 +35,11 @@
threshold: 0
},
palette: [
{color: new THREE.Vector3(0.00, 0.00, 0.00), at: 0.0},
{color: new THREE.Vector3(0.52, 0.17, 0.05), at: 0.4},
{color: new THREE.Vector3(0.82, 0.37, 0.12), at: 0.7},
{color: new THREE.Vector3(1.00, 0.74, 0.29), at: 0.9},
{color: new THREE.Vector3(1.00, 1.00, 1.00), at: 1.0},
{r: 0.00, g: 0.00, b: 0.00, at: 0.0},
{r: 0.52, g: 0.17, b: 0.05, at: 0.4},
{r: 0.82, g: 0.37, b: 0.12, at: 0.7},
{r: 1.00, g: 0.74, b: 0.29, at: 0.9},
{r: 1.00, g: 1.00, b: 1.00, at: 1.0},
],
fallSpeed: 0.05,
cycleSpeed: 0.05,
@@ -63,11 +63,11 @@
threshold: 0.5
},
palette: [
{color: new THREE.Vector3(0.00, 0.00, 0.00), at: 0.0},
{color: new THREE.Vector3(0.52, 0.00, 0.00), at: 0.2},
{color: new THREE.Vector3(0.82, 0.05, 0.05), at: 0.4},
{color: new THREE.Vector3(1.00, 0.60, 0.30), at: 0.8},
{color: new THREE.Vector3(1.00, 1.00, 0.90), at: 1.0},
{r: 0.00, g: 0.00, b: 0.00, at: 0.0},
{r: 0.52, g: 0.00, b: 0.00, at: 0.2},
{r: 0.82, g: 0.05, b: 0.05, at: 0.4},
{r: 1.00, g: 0.60, b: 0.30, at: 0.8},
{r: 1.00, g: 1.00, b: 0.90, at: 1.0},
],
fallSpeed: 2.0,
cycleSpeed: 0.02,
@@ -91,28 +91,23 @@
threshold: 0.3
},
palette: [
// {color: new THREE.Vector3(0.00, 0.00, 0.00), at: 0.0},
// {color: new THREE.Vector3(0.05, 0.52, 0.17), at: 0.4},
// {color: new THREE.Vector3(0.12, 0.82, 0.37), at: 0.8},
// {color: new THREE.Vector3(0.29, 1.00, 0.64), at: 1.0},
{color: new THREE.Vector3( 0/255, 0/255, 0/255), at: 0/16},
{color: new THREE.Vector3( 6/255, 16/255, 8/255), at: 1/16},
{color: new THREE.Vector3( 11/255, 28/255, 15/255), at: 2/16},
{color: new THREE.Vector3( 17/255, 41/255, 23/255), at: 3/16},
{color: new THREE.Vector3( 20/255, 58/255, 31/255), at: 4/16},
{color: new THREE.Vector3( 23/255, 84/255, 39/255), at: 5/16},
{color: new THREE.Vector3( 30/255, 113/255, 48/255), at: 6/16},
{color: new THREE.Vector3( 43/255, 142/255, 60/255), at: 7/16},
{color: new THREE.Vector3( 57/255, 160/255, 72/255), at: 8/16},
{color: new THREE.Vector3( 70/255, 175/255, 81/255), at: 9/16},
{color: new THREE.Vector3( 75/255, 187/255, 85/255), at: 10/16},
{color: new THREE.Vector3( 78/255, 196/255, 91/255), at: 11/16},
{color: new THREE.Vector3( 83/255, 203/255, 102/255), at: 12/16},
{color: new THREE.Vector3( 92/255, 212/255, 114/255), at: 13/16},
{color: new THREE.Vector3(109/255, 223/255, 130/255), at: 14/16},
{color: new THREE.Vector3(129/255, 232/255, 148/255), at: 15/16},
{color: new THREE.Vector3(140/255, 235/255, 157/255), at: 16/16},
{r: 0/255, g: 0/255, b: 0/255, at: 0/16},
{r: 6/255, g: 16/255, b: 8/255, at: 1/16},
{r: 11/255, g: 28/255, b: 15/255, at: 2/16},
{r: 17/255, g: 41/255, b: 23/255, at: 3/16},
{r: 20/255, g: 58/255, b: 31/255, at: 4/16},
{r: 23/255, g: 84/255, b: 39/255, at: 5/16},
{r: 30/255, g: 113/255, b: 48/255, at: 6/16},
{r: 43/255, g: 142/255, b: 60/255, at: 7/16},
{r: 57/255, g: 160/255, b: 72/255, at: 8/16},
{r: 70/255, g: 175/255, b: 81/255, at: 9/16},
{r: 75/255, g: 187/255, b: 85/255, at: 10/16},
{r: 78/255, g: 196/255, b: 91/255, at: 11/16},
{r: 83/255, g: 203/255, b: 102/255, at: 12/16},
{r: 92/255, g: 212/255, b: 114/255, at: 13/16},
{r: 109/255, g: 223/255, b: 130/255, at: 14/16},
{r: 129/255, g: 232/255, b: 148/255, at: 15/16},
{r: 140/255, g: 235/255, b: 157/255, at: 16/16},
],
fallSpeed: 1,
cycleSpeed: 1,
@@ -136,24 +131,24 @@
threshold: 0.0
},
palette: [
{color: new THREE.Vector3(( 0 * 1.3)/255, ( 0 * 1.2)/255, ( 0 * 1.3)/255), at: 0/48},
{color: new THREE.Vector3(( 6 * 1.3)/255, ( 16 * 1.2)/255, ( 8 * 1.3)/255), at: 1/48},
{color: new THREE.Vector3(( 11 * 1.3)/255, ( 28 * 1.2)/255, ( 15 * 1.3)/255), at: 2/48},
{color: new THREE.Vector3(( 17 * 1.3)/255, ( 41 * 1.2)/255, ( 23 * 1.3)/255), at: 3/48},
{color: new THREE.Vector3(( 20 * 1.3)/255, ( 58 * 1.2)/255, ( 31 * 1.3)/255), at: 4/48},
{color: new THREE.Vector3(( 23 * 1.3)/255, ( 84 * 1.2)/255, ( 39 * 1.3)/255), at: 5/48},
{color: new THREE.Vector3(( 30 * 1.3)/255, (113 * 1.2)/255, ( 48 * 1.3)/255), at: 6/48},
{color: new THREE.Vector3(( 43 * 1.3)/255, (142 * 1.2)/255, ( 60 * 1.3)/255), at: 7/48},
{color: new THREE.Vector3(( 57 * 1.3)/255, (160 * 1.2)/255, ( 72 * 1.3)/255), at: 8/48},
{color: new THREE.Vector3(( 70 * 1.3)/255, (175 * 1.2)/255, ( 81 * 1.3)/255), at: 9/48},
{color: new THREE.Vector3(( 75 * 1.3)/255, (187 * 1.2)/255, ( 85 * 1.3)/255), at: 10/48},
{color: new THREE.Vector3(( 78 * 1.3)/255, (196 * 1.2)/255, ( 91 * 1.3)/255), at: 11/48},
{color: new THREE.Vector3(( 83 * 1.3)/255, (203 * 1.2)/255, (102 * 1.3)/255), at: 12/48},
{color: new THREE.Vector3(( 92 * 1.3)/255, (212 * 1.2)/255, (114 * 1.3)/255), at: 13/48},
{color: new THREE.Vector3((109 * 1.0)/255, (255 * 1.0)/255, (130 * 1.0)/255), at: 14/48},
{color: new THREE.Vector3((129 * 1.0)/255, (255 * 1.0)/255, (148 * 1.0)/255), at: 15/48},
{color: new THREE.Vector3((140 * 1.0)/255, (255 * 1.0)/255, (157 * 1.0)/255), at: 16/48},
{color: new THREE.Vector3((255 * 1.0)/255, (255 * 1.0)/255, (255 * 1.0)/255), at: 36/48},
{r: ( 0 * 1.3)/255, g: ( 0 * 1.2)/255, b: ( 0 * 1.3)/255, at: 0/48},
{r: ( 6 * 1.3)/255, g: ( 16 * 1.2)/255, b: ( 8 * 1.3)/255, at: 1/48},
{r: ( 11 * 1.3)/255, g: ( 28 * 1.2)/255, b: ( 15 * 1.3)/255, at: 2/48},
{r: ( 17 * 1.3)/255, g: ( 41 * 1.2)/255, b: ( 23 * 1.3)/255, at: 3/48},
{r: ( 20 * 1.3)/255, g: ( 58 * 1.2)/255, b: ( 31 * 1.3)/255, at: 4/48},
{r: ( 23 * 1.3)/255, g: ( 84 * 1.2)/255, b: ( 39 * 1.3)/255, at: 5/48},
{r: ( 30 * 1.3)/255, g: (113 * 1.2)/255, b: ( 48 * 1.3)/255, at: 6/48},
{r: ( 43 * 1.3)/255, g: (142 * 1.2)/255, b: ( 60 * 1.3)/255, at: 7/48},
{r: ( 57 * 1.3)/255, g: (160 * 1.2)/255, b: ( 72 * 1.3)/255, at: 8/48},
{r: ( 70 * 1.3)/255, g: (175 * 1.2)/255, b: ( 81 * 1.3)/255, at: 9/48},
{r: ( 75 * 1.3)/255, g: (187 * 1.2)/255, b: ( 85 * 1.3)/255, at: 10/48},
{r: ( 78 * 1.3)/255, g: (196 * 1.2)/255, b: ( 91 * 1.3)/255, at: 11/48},
{r: ( 83 * 1.3)/255, g: (203 * 1.2)/255, b: (102 * 1.3)/255, at: 12/48},
{r: ( 92 * 1.3)/255, g: (212 * 1.2)/255, b: (114 * 1.3)/255, at: 13/48},
{r: (109 * 1.0)/255, g: (255 * 1.0)/255, b: (130 * 1.0)/255, at: 14/48},
{r: (129 * 1.0)/255, g: (255 * 1.0)/255, b: (148 * 1.0)/255, at: 15/48},
{r: (140 * 1.0)/255, g: (255 * 1.0)/255, b: (157 * 1.0)/255, at: 16/48},
{r: (255 * 1.0)/255, g: (255 * 1.0)/255, b: (255 * 1.0)/255, at: 36/48},
],
fallSpeed: 0.6,
cycleSpeed: 0.4,

View File

@@ -16,7 +16,7 @@ const ARRAY_SIZE = 2048;
THREE.ColorMapPass = function (entries, ditherMagnitude = 1, graininess = 100) {
const colors = Array(ARRAY_SIZE).fill().map(_ => new THREE.Vector3(0, 0, 0));
const sortedEntries = entries.slice().sort((e1, e2) => e1.at - e2.at).map(entry => ({
color: entry.color,
color: new THREE.Vector3(entry.r, entry.g, entry.b),
arrayIndex: Math.floor(Math.max(Math.min(1, entry.at), 0) * (ARRAY_SIZE - 1))
}));
sortedEntries.unshift({color:sortedEntries[0].color, arrayIndex:0});