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);
|
||||
|
||||
vec2 st = v_texcoord;
|
||||
// st.y = 1.0 - st.y;
|
||||
st.x = 1200.0 - st.x; // horizontal flip
|
||||
|
||||
|
||||
#ifdef BUFFER_0
|
||||
|
|
|
@ -120,7 +120,7 @@ void main()
|
|||
alpha *= 0.05;
|
||||
}
|
||||
else {
|
||||
alpha *= 0.1;
|
||||
alpha *= 0.15;
|
||||
}
|
||||
|
||||
if(gPos.z > -200) {
|
||||
|
|
|
@ -15,7 +15,6 @@ uniform int uEnergy;
|
|||
|
||||
in vec4 vPosition[];
|
||||
in vec4 vPrevPosition[];
|
||||
in vec4 vOrgPosition[];
|
||||
in vec2 vTexCoord[];
|
||||
flat in int vValid[];
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ out float vTemperature;
|
|||
out float vAge;
|
||||
out vec4 vPosition;
|
||||
out vec4 vPrevPosition;
|
||||
out vec4 vOrgPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -31,5 +30,4 @@ void main()
|
|||
vPos = texture(particles0, vTexCoord).xyz;
|
||||
vPosition = modelViewMatrix * vec4(vPos, 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;
|
||||
}
|
||||
else if (target.w > 0) { // targeted
|
||||
// if(target.w >= 1)
|
||||
age += 0.005;
|
||||
|
||||
if(target.w < 1) {
|
||||
if(mod(random3(pos).x,1) > 0.05) {
|
||||
target.w += 0.1;
|
||||
}
|
||||
}
|
||||
thermo = misc.x;
|
||||
}
|
||||
else { // wandering
|
||||
|
@ -195,52 +202,48 @@ void main()
|
|||
|
||||
int trapped = 0;
|
||||
if(age < 0.001) { // targetting
|
||||
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) {
|
||||
// target.w = 0;
|
||||
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;
|
||||
vec4 hray = texture(u_world, h);
|
||||
float hdepth = -depth * 65535.0;
|
||||
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
||||
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
||||
target.xyz = H + random3(pos) * 3;
|
||||
target.w = 1;
|
||||
target.w += 0.1;
|
||||
thermo += random3(pos).y * 0.2 - 0.1;
|
||||
|
||||
if(mod(random3(pos).x,1) > 0.05) {
|
||||
trapped = 1;
|
||||
}
|
||||
// if(mod(random3(pos).x,1) > 0.05) {
|
||||
// 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;
|
||||
vec4 hray = texture(u_world, h);
|
||||
float hdepth = -depth * 65535.0;
|
||||
if(hdepth == 0) hdepth = -0.01 * 65535.0;
|
||||
vec3 H = vec3(hray.xy * hdepth, hdepth);
|
||||
target.xyz = H + random3(pos) * 3;
|
||||
target.w = 1;
|
||||
target.w += 0.1;
|
||||
thermo += random3(pos).y * 0.2 - 0.1;
|
||||
|
||||
if(mod(random3(pos).x,1) > 0.05) {
|
||||
trapped = 1;
|
||||
}
|
||||
// if(mod(random3(pos).x,1) > 0.05) {
|
||||
// target.w = 2;
|
||||
// }
|
||||
}
|
||||
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 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));
|
||||
phi += 3.1415 * 1 * simplex3d_fractal(pos.xyz * 0.01);
|
||||
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.002);
|
||||
force.x = cos(th) * cos(phi);
|
||||
force.y = sin(th) * cos(phi);
|
||||
force.z = sin(phi);
|
||||
force *= 100 + 300 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
|
||||
|
||||
// if(trapped == 1) {
|
||||
// target.w = 0;
|
||||
// }
|
||||
force *= 50 + 500 * abs(simplex3d_fractal(vec3(texCoordVarying, 0.0)));
|
||||
}
|
||||
|
||||
// damping
|
||||
|
@ -251,9 +254,9 @@ void main()
|
|||
|
||||
// move
|
||||
prevPos = pos;
|
||||
// if(length(pos - posWorld.xyz) < 300) {
|
||||
// prevPos = posWorld.xyz;
|
||||
// }
|
||||
if(length(pos - posWorld.xyz) < 30) {
|
||||
prevPos = posWorld.xyz;
|
||||
}
|
||||
pos += elapsed * vel;
|
||||
|
||||
posOut = vec4(pos, 1.0);
|
||||
|
|
|
@ -15,7 +15,7 @@ int main( ){
|
|||
#else
|
||||
ofGLWindowSettings settings;
|
||||
settings.setGLVersion(3, 2); // Programmable pipeline
|
||||
settings.setSize(1920, 1200);
|
||||
settings.setSize(1200, 1920);
|
||||
#endif
|
||||
ofCreateWindow(settings);
|
||||
ofRunApp(new ofApp());
|
||||
|
|
Loading…
Reference in a new issue