@@ -23,91 +23,6 @@ with Colors; use Colors;
2323
2424package body Marching_Cubes is
2525
26- -- TODO: the following functions are copies of Colors, because ptxas
27- -- needs all symbols to compile. Need to review the behavior of the wrapper.
28-
29- function Hue_To_RGB (P, Q, T : Float) return Float is
30- T_Clamped : Float := T;
31- begin
32- if T_Clamped < 0.0 then
33- T_Clamped := @ + 1.0 ;
34- end if ;
35-
36- if T_Clamped > 1.0 then
37- T_Clamped := @ - 1.0 ;
38- end if ;
39-
40- if T_Clamped < 1.0 / 6.0 then
41- return P + (Q - P) * 6.0 * T_Clamped;
42- end if ;
43-
44- if T_Clamped < 1.0 / 2.0 then
45- return Q;
46- end if ;
47-
48- if T_Clamped < 2.0 / 3.0 then
49- return P + (Q - P) * (2.0 / 3.0 - T_Clamped) * 6.0 ;
50- end if ;
51-
52- return P;
53- end Hue_To_RGB ;
54-
55- function HSL_To_RGB (Src : HSL_T) return RGB_T is
56- Res : RGB_T;
57- begin
58- if Src.S = 0.0 then
59- Res.R := Src.L;
60- Res.G := Src.L;
61- Res.B := Src.L;
62- else
63- declare
64- Q : Float :=
65- (if Src.L < 0.5 then Src.L * (1.0 + Src.S)
66- else Src.L + Src.S - Src.L * Src.S);
67- P : Float := 2.0 * Src.L - Q;
68- begin
69- Res.R := Hue_To_RGB (P, Q, Src.H + 1.0 / 3.0 );
70- Res.G := Hue_To_RGB (P, Q, Src.H);
71- Res.B := Hue_To_RGB (P, Q, Src.H - 1.0 / 3.0 );
72- end ;
73- end if ;
74-
75- return Res;
76- end HSL_To_RGB ;
77-
78- function RGB_To_HSL (src : RGB_T) return HSL_T is
79- Max : Float := Float'Max (src.R, Float'Max (src.G, src.B));
80- Min : Float := Float'Min (src.R, Float'Min (src.G, src.B));
81- Res : HSL_T;
82- begin
83- Res.L := (Max + Min) / 2.0 ;
84-
85- if Max = Min then
86- Res.H := 0.0 ;
87- Res.S := 0.0 ;
88- else
89- declare
90- D : Float := Max - Min;
91- begin
92- Res.S :=
93- (if Res.L > 0.5 then D / (2.0 - Max - Min) else D / (Max + Min));
94-
95- if src.R >= src.G and src.R >= src.B then
96- Res.H :=
97- (src.G - src.B) / D + (if src.G < src.B then 6.0 else 0.0 );
98- elsif src.G >= src.B then
99- Res.H := (src.B - src.R) / D + 2.0 ;
100- else
101- Res.H := (src.R - src.G) / D + 4.0 ;
102- end if ;
103-
104- Res.H := @ / 6.0 ;
105- end ;
106- end if ;
107-
108- return Res;
109- end RGB_To_HSL ;
110-
11126 -- TODO: replace with proper runtime function when available
11227 function Atomic_Compare_Exchange_4
11328 (Ptr : Address; Expected : Address; Desired : Integer;
0 commit comments