palette
This commit is contained in:
parent
af3d2f354a
commit
00ba0ca9aa
2 changed files with 30 additions and 3 deletions
|
@ -8,6 +8,11 @@ uniform sampler2DRect uV4l2cam;
|
||||||
uniform sampler2DRect u_buffer0;
|
uniform sampler2DRect u_buffer0;
|
||||||
uniform sampler2DRect u_buffer1;
|
uniform sampler2DRect u_buffer1;
|
||||||
|
|
||||||
|
uniform sampler2DRect u_warm1;
|
||||||
|
uniform sampler2DRect u_warm2;
|
||||||
|
uniform sampler2DRect u_cold1;
|
||||||
|
uniform sampler2DRect u_cold2;
|
||||||
|
|
||||||
uniform bool uCalib;
|
uniform bool uCalib;
|
||||||
uniform vec2 uCalibXY;
|
uniform vec2 uCalibXY;
|
||||||
uniform float uCalibScale;
|
uniform float uCalibScale;
|
||||||
|
@ -150,10 +155,17 @@ void main() {
|
||||||
gl_FragColor = depth + v4l2;
|
gl_FragColor = depth + v4l2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// vec4 bufColor = texture(u_buffer1, st);
|
vec4 color;
|
||||||
vec4 color = vec4(st/1000,1,1);
|
|
||||||
color = texture(uFluid, st);
|
color = texture(uFluid, st);
|
||||||
|
|
||||||
|
vec2 palette = vec2(color.r*3425, 1);
|
||||||
|
vec3 remapedColorW = texture(u_warm1, palette).xyz;
|
||||||
|
vec3 remapedColorC = texture(u_cold2, palette).xyz;
|
||||||
|
|
||||||
|
// vec4 bufColor = texture(u_buffer1, st);
|
||||||
|
color.rgb = remapedColorW;
|
||||||
|
// color.rg = palette.st;
|
||||||
|
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -135,6 +135,12 @@ void ofApp::setup()
|
||||||
fbos.insert({s, ofFbo()});
|
fbos.insert({s, ofFbo()});
|
||||||
fbos.at(s).allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F_ARB);
|
fbos.at(s).allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto s : gradientNames)
|
||||||
|
{
|
||||||
|
gradients.insert({s, ofFloatImage()});
|
||||||
|
gradients.at(s).load("images/" + s + ".png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ofVec3f ofApp::getDepthAt(int x, int y)
|
ofVec3f ofApp::getDepthAt(int x, int y)
|
||||||
|
@ -239,7 +245,7 @@ void ofApp::updateFluid()
|
||||||
oldM = m;
|
oldM = m;
|
||||||
ofPoint c = ofPoint(640 * 0.5, 480 * 0.5) - m;
|
ofPoint c = ofPoint(640 * 0.5, 480 * 0.5) - m;
|
||||||
c.normalize();
|
c.normalize();
|
||||||
fluid.addTemporalForce(toGlm(m), toGlm(d), ofFloatColor(0,0,0), 15.0f, 20);
|
fluid.addTemporalForce(toGlm(m), toGlm(d), ofFloatColor(0, 0, 0), 15.0f, 20);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
//
|
//
|
||||||
|
@ -295,6 +301,15 @@ void ofApp::drawMain()
|
||||||
mainShader.setUniform2f("uCalibXY", registrationXY);
|
mainShader.setUniform2f("uCalibXY", registrationXY);
|
||||||
mainShader.setUniform1f("uCalibScale", registrationScale);
|
mainShader.setUniform1f("uCalibScale", registrationScale);
|
||||||
|
|
||||||
|
// for (int i = 0; i < gradientNames.size(); i++)
|
||||||
|
// {
|
||||||
|
// mainShader.setUniformTexture("u_" + gradientNames.at(i), gradients.at(gradientNames.at(i)));
|
||||||
|
// }
|
||||||
|
mainShader.setUniformTexture("u_warm1", gradients.at("warm1"));
|
||||||
|
mainShader.setUniformTexture("u_warm2", gradients.at("warm2"));
|
||||||
|
mainShader.setUniformTexture("u_cold1", gradients.at("cold1"));
|
||||||
|
mainShader.setUniformTexture("u_cold2", gradients.at("cold2"));
|
||||||
|
|
||||||
mainShader.setUniformTexture("uFluid", fbos.at("fluid"));
|
mainShader.setUniformTexture("uFluid", fbos.at("fluid"));
|
||||||
mainShader.render();
|
mainShader.render();
|
||||||
mainShader.draw(0, 0);
|
mainShader.draw(0, 0);
|
||||||
|
|
Loading…
Reference in a new issue