param
This commit is contained in:
parent
daa91a4ba1
commit
4be07729f0
6 changed files with 28 additions and 28 deletions
|
@ -113,7 +113,7 @@ void main() {
|
||||||
offset[8] = pixel * vec2( 1.0,1.0);
|
offset[8] = pixel * vec2( 1.0,1.0);
|
||||||
|
|
||||||
vec2 st = v_texcoord;
|
vec2 st = v_texcoord;
|
||||||
// st.y = 1.0 - st.y;
|
st.x = 1200.0 - st.x; // horizontal flip
|
||||||
|
|
||||||
|
|
||||||
#ifdef BUFFER_0
|
#ifdef BUFFER_0
|
||||||
|
|
|
@ -120,7 +120,7 @@ void main()
|
||||||
alpha *= 0.05;
|
alpha *= 0.05;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alpha *= 0.1;
|
alpha *= 0.15;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gPos.z > -200) {
|
if(gPos.z > -200) {
|
||||||
|
|
|
@ -15,7 +15,6 @@ uniform int uEnergy;
|
||||||
|
|
||||||
in vec4 vPosition[];
|
in vec4 vPosition[];
|
||||||
in vec4 vPrevPosition[];
|
in vec4 vPrevPosition[];
|
||||||
in vec4 vOrgPosition[];
|
|
||||||
in vec2 vTexCoord[];
|
in vec2 vTexCoord[];
|
||||||
flat in int vValid[];
|
flat in int vValid[];
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ out float vTemperature;
|
||||||
out float vAge;
|
out float vAge;
|
||||||
out vec4 vPosition;
|
out vec4 vPosition;
|
||||||
out vec4 vPrevPosition;
|
out vec4 vPrevPosition;
|
||||||
out vec4 vOrgPosition;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -31,5 +30,4 @@ void main()
|
||||||
vPos = texture(particles0, vTexCoord).xyz;
|
vPos = texture(particles0, vTexCoord).xyz;
|
||||||
vPosition = modelViewMatrix * vec4(vPos, 1.0);
|
vPosition = modelViewMatrix * vec4(vPos, 1.0);
|
||||||
vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0);
|
vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0);
|
||||||
vOrgPosition = modelViewMatrix * vec4(texture(particles5, vTexCoord).xyz, 1.0);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,14 @@ void main()
|
||||||
age = 0;
|
age = 0;
|
||||||
}
|
}
|
||||||
else if (target.w > 0) { // targeted
|
else if (target.w > 0) { // targeted
|
||||||
|
// if(target.w >= 1)
|
||||||
age += 0.005;
|
age += 0.005;
|
||||||
|
|
||||||
|
if(target.w < 1) {
|
||||||
|
if(mod(random3(pos).x,1) > 0.05) {
|
||||||
|
target.w += 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
thermo = misc.x;
|
thermo = misc.x;
|
||||||
}
|
}
|
||||||
else { // wandering
|
else { // wandering
|
||||||
|
@ -195,52 +202,48 @@ void main()
|
||||||
|
|
||||||
int trapped = 0;
|
int trapped = 0;
|
||||||
if(age < 0.001) { // targetting
|
if(age < 0.001) { // targetting
|
||||||
target.w = 0;
|
// target.w = 0;
|
||||||
if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length((texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time,0,0)),simplex3d(pos*0.005+vec3(0,u_time,0))*16)) - uHottest0.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time/8)),1) > length((texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time/8,0,0)),simplex3d(pos*0.005+vec3(0,u_time/8,0))*16)) - uHottest0.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
||||||
vec2 h = uHottest1.st;
|
vec2 h = uHottest1.st;
|
||||||
vec4 hray = texture(u_world, h);
|
vec4 hray = texture(u_world, h);
|
||||||
float hdepth = -depth * 65535.0;
|
float hdepth = -depth * 65535.0;
|
||||||
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
||||||
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
||||||
target.xyz = H + random3(pos) * 3;
|
target.xyz = H + random3(pos) * 3;
|
||||||
target.w = 1;
|
target.w += 0.1;
|
||||||
thermo += random3(pos).y * 0.2 - 0.1;
|
thermo += random3(pos).y * 0.2 - 0.1;
|
||||||
|
|
||||||
if(mod(random3(pos).x,1) > 0.05) {
|
// if(mod(random3(pos).x,1) > 0.05) {
|
||||||
trapped = 1;
|
// target.w = 2;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time)),1) > length(texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time,0,0)),simplex3d(pos*0.005+vec3(0,u_time,0))*16) - uHottest1.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
else if(mod(u_time*0.1+simplex3d_fractal(vec3(texCoordVarying,u_time/8)),1) > length(texCoordVarying.st/fraction+vec2(simplex3d(pos*0.01*3+vec3(u_time/8,0,0)),simplex3d(pos*0.005+vec3(0,u_time/8,0))*16) - uHottest1.st + mod(random3(pos).xy, 8)-vec2(4))/10) {
|
||||||
vec2 h = uHottest0.st;
|
vec2 h = uHottest0.st;
|
||||||
vec4 hray = texture(u_world, h);
|
vec4 hray = texture(u_world, h);
|
||||||
float hdepth = -depth * 65535.0;
|
float hdepth = -depth * 65535.0;
|
||||||
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
||||||
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
||||||
target.xyz = H + random3(pos) * 3;
|
target.xyz = H + random3(pos) * 3;
|
||||||
target.w = 1;
|
target.w += 0.1;
|
||||||
thermo += random3(pos).y * 0.2 - 0.1;
|
thermo += random3(pos).y * 0.2 - 0.1;
|
||||||
|
|
||||||
if(mod(random3(pos).x,1) > 0.05) {
|
// if(mod(random3(pos).x,1) > 0.05) {
|
||||||
trapped = 1;
|
// target.w = 2;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
age = 0.001;
|
age = 0.001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(target.w > 0) { // go to target
|
if(target.w >= 1) { // go to target
|
||||||
float th = atan(-pos.y + target.y, -pos.x + target.x);
|
float th = atan(-pos.y + target.y, -pos.x + target.x);
|
||||||
float phi = atan(-pos.z + target.z, length(target.xy-pos.xy));
|
float phi = atan(-pos.z + target.z, length(target.xy-pos.xy));
|
||||||
th += 3.1415 * 1 * simplex3d_fractal(vec3(pos.xyz * 0.01) + vec3(u_time, 0, 0));
|
th += 3.1415 * 1 * simplex3d_fractal(vec3(pos.xyz * 0.001) + vec3(0, 0, u_time));
|
||||||
phi += 3.1415 * 1 * simplex3d_fractal(pos.xyz * 0.01);
|
phi += 3.1415 * 1 * simplex3d_fractal(pos.xyz * 0.002);
|
||||||
force.x = cos(th) * cos(phi);
|
force.x = cos(th) * cos(phi);
|
||||||
force.y = sin(th) * cos(phi);
|
force.y = sin(th) * cos(phi);
|
||||||
force.z = sin(phi);
|
force.z = sin(phi);
|
||||||
force *= 100 + 300 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
|
force *= 50 + 500 * abs(simplex3d_fractal(vec3(texCoordVarying, 0.0)));
|
||||||
|
|
||||||
// if(trapped == 1) {
|
|
||||||
// target.w = 0;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// damping
|
// damping
|
||||||
|
@ -251,9 +254,9 @@ void main()
|
||||||
|
|
||||||
// move
|
// move
|
||||||
prevPos = pos;
|
prevPos = pos;
|
||||||
// if(length(pos - posWorld.xyz) < 300) {
|
if(length(pos - posWorld.xyz) < 30) {
|
||||||
// prevPos = posWorld.xyz;
|
prevPos = posWorld.xyz;
|
||||||
// }
|
}
|
||||||
pos += elapsed * vel;
|
pos += elapsed * vel;
|
||||||
|
|
||||||
posOut = vec4(pos, 1.0);
|
posOut = vec4(pos, 1.0);
|
||||||
|
|
|
@ -15,7 +15,7 @@ int main( ){
|
||||||
#else
|
#else
|
||||||
ofGLWindowSettings settings;
|
ofGLWindowSettings settings;
|
||||||
settings.setGLVersion(3, 2); // Programmable pipeline
|
settings.setGLVersion(3, 2); // Programmable pipeline
|
||||||
settings.setSize(1920, 1200);
|
settings.setSize(1200, 1920);
|
||||||
#endif
|
#endif
|
||||||
ofCreateWindow(settings);
|
ofCreateWindow(settings);
|
||||||
ofRunApp(new ofApp());
|
ofRunApp(new ofApp());
|
||||||
|
|
Loading…
Reference in a new issue