-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathWvN.DelphiShader.FX.NewShader..pas..pas
83 lines (64 loc) · 1.49 KB
/
WvN.DelphiShader.FX.NewShader..pas..pas
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
unit WvN.DelphiShader.FX.NewShader;
interface
uses GR32,Types,WvN.DelphiShader.Shader;
type
TNewShader = class(TShader)
const
vec3_1:vec3 = (x:0;y:0;z:0);
constructor Create;override;
procedure PrepareFrame;
procedure main;
end;
var
NewShader:TShader
;
implementation
uses SysUtils, Math;
constructor TNewShader.Create;
begin
inherited;
FrameProc := PrepareFrame;
PixelProc := Main;
end;
procedure TNewShader.PrepareFrame;
begin
end;
function TNewShader.Main(var gl_FragCoord: Vec2): TColor32;var
offset:float;
uv :vec2;
s, v, speed2, speed :float;
col, init :vec3;
r :int;
p :vec3;
i:int;
begin
// from Mr Hoskins ST;
offset := 0;
uv := gl_FragCoord.xy / resolution.xy *2-1;
s := 0;
v := 0;
offset := time*time/200;
speed2 := (cos(offset)+1)*2;
speed := speed2+0.1;
offset := offset + (sin(offset)*0.96);
offset := offset * (2);
col := vec3_1;
init := Vec3.Create(sin(offset * 0.002)*0.3,0.35 + cos(offset * 0.005)*0.3,offset * 0.2);
for r := 0 to 89 do
begin
p := init + s * vec3(uv, 0.05);
p.z := fract(p.z);
// Thanks to Kali's little chaotic loop...
for i := 0 to 8 do - 0.9;
v := v + (pow(dot(p, p), 0.7) * 0.06);
col := col + (Vec3.Create(v * 0.2+0.4,12-s*2,0.1 + v * 1) * v * 0.00003);
s := s + (0.025);
end;
Result := vec4.Create(clamp(col,0,1),1);
end;
initialization
NewShader := TNewShader.Create;
Shaders.Add('NewShader', NewShader);
finalization
FreeandNil(NewShader);
end.