File: transformfeedback.vert

package info (click to toggle)
globjects 1.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 8,932 kB
  • sloc: cpp: 60,418; python: 6,620; sh: 596; makefile: 497
file content (42 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#version 140
#extension GL_ARB_explicit_attrib_location : require

uniform float deltaT;

layout (location = 0) in vec4 in_position;
out vec4 next_position;

const float PI = 3.1415926535897932384626433832795;
const vec2 origin = vec2(0.5, 0.5);

float getTheta(in vec2 position)
{
	if (position.x == 0.0)
	{
		return position.y > 0.0 ? PI / 2.0 : (position.y < 0.0 ? -PI / 2.0 : 0.0);
	}
	
	return atan(position.y, position.x);
}

void main()
{
	float r = length(in_position.xy - origin);
	float theta = getTheta(in_position.xy - origin);
	
	theta += PI * deltaT / 2.0;
	
	if (true)
	{
		next_position = vec4(
			origin.x + r*cos(theta),
			origin.y + r*sin(theta),
			0.0,
			1.0
		);
	}
	else
	{
		next_position = in_position;
	}
}