Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <jittershader name="tf_2textureIn.jxs">
- <description>Basic Vectorfield</description>
- <param name="input_position" type="vec3" state="POSITION" />
- <param name="input_velocity" type="vec3" state="NORMAL" />
- <texture name="tex0" />
- <language name="glsl" version="1.5">
- <bind param="input_position" program="vp" />
- <bind param="input_velocity" program="vp" />
- <bind param="bfg_tex0" program="vp" />
- <program name="vp" type="vertex">
- <![CDATA[
- #version 330 core
- in vec3 input_velocity;
- out vec3 output_velocity;
- uniform sampler2D bfg_tex0;
- in vec3 input_position;
- out vec3 output_position;
- void main() {
- vec3 direction_texture = texture(bfg_tex0, normPos).xyz;
- vec3 direction = direction_texture - input_position;
- vec3 normalized_direction = normalize(direction);
- float dist = lenght(direction);
- vec3 acc = normalized_direction * 0.001;
- acc /= (dist*50)*(dist*50) + 1.0;
- output_velocity = input_velocity + acc;
- output_velocity *= 0.99;
- output_velocity = clamp(output_velocity, vec3(-0.01 -0.01 -0.01), vec3(0.01, 0.01, 0.01));
- output_position = input_position + output_velocity;
- output_position = mod(output_position + vec3(2.0), vec3(4.0)) - vec3(2.0);
- // vec2 normPos = input_position.xy * 0.5 + 0.5;
- //float velX = (texture(bfg_tex0, normPos).x * 2 - 1);
- //float velY = (texture(bfg_tex0, normPos).y * 2 - 1);
- // float posX = input_position.x + velX * input_velocity.z;
- // float posY = input_position.y + velY * input_velocity.z;
- // if (posX > 1. || posX < -1. || posY > 1. || posY < -1.){
- // output_position = vec3(input_velocity.x, input_velocity.y, input_position.z);
- // }
- //else {
- // output_position = vec3(posX, posY, input_position.z);
- //}
- output_position = input_position;
- output_velocity = input_velocity;
- }
- ]]>
- </program>
- <program name="fp" type="fragment" >
- <![CDATA[
- #version 330 core
- void main()
- {
- }
- ]]>
- </program>
- </language>
- </jittershader>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement