text stringlengths 0 234 |
|---|
GL.Enable (GL.LIGHTING); |
G3D.Define (1, proto_light); |
Self.frontal_light := proto_light; |
proto_light.diffuse := (0.5, 0.9, 0.5, fact); |
G3D.Define (2, proto_light); |
proto_light.diffuse := (0.2, 0.0, 0.9, fact); |
proto_light.specular := (1.0, 1.0, 1.0, fact); |
G3D.Define (3, proto_light); |
proto_light.position := (-3.0, 4.0, 10.0, 1.0); |
G3D.Define (4, proto_light); |
proto_light.position := (3.0, -4.0, 10.0, 1.0); |
proto_light.ambient := (0.6, 0.6, 0.6, 0.1); |
G3D.Define (5, proto_light); |
proto_light.ambient := (0.6, 0.0, 0.0, 0.1); |
G3D.Define (6, proto_light); |
proto_light.ambient := (0.0, 0.6, 0.0, 0.1); |
G3D.Define (7, proto_light); |
proto_light.ambient := (0.0, 0.0, 0.6, 0.1); |
G3D.Define (8, proto_light); |
G3D.Switch_lights (True); |
G3D.Switch_light (2, False); |
G3D.Switch_light (3, False); |
G3D.Switch_light (4, False); |
G3D.Switch_light (5, False); |
G3D.Switch_light (6, False); |
G3D.Switch_light (7, False); |
G3D.Switch_light (8, False); |
end Prepare_default_lighting; |
procedure Clear_modes is |
begin |
Disable (BLEND); |
Disable (LIGHTING); |
Disable (AUTO_NORMAL); |
Disable (NORMALIZE); |
Disable (DEPTH_TEST); |
end Clear_modes; |
procedure Reset_for_3D (Self : in out Window'Class) is |
begin |
pragma Unreferenced (Self); |
MatrixMode (MODELVIEW); -- (tbd : still needed ?) . .. The matrix generated by GLU.Perspective is multipled by the current matrix |
ShadeModel (SMOOTH); -- GL's default is SMOOTH, vs FLAT |
-- ShadeModel (FLAT); -- GL's default is SMOOTH, vs FLAT |
ClearColor (0.0, 0.0, 0.0, 0.0); -- Specifies clear values for color buffer (s) |
ClearAccum (0.0, 0.0, 0.0, 0.0); -- Specifies clear values for the accumulation buffer |
end Reset_for_3D; |
procedure enable_Viewport_and_Perspective (Self : in out Window'Class) is -- tbd : move projection matrix to 'window resize'. |
begin |
Viewport (0, 0, Self.main_size_x, Self.main_size_y); |
MatrixMode (PROJECTION); |
LoadIdentity; |
GLU.Perspective (fovy => Self.Camera.FOVy, -- field of view angle (deg) in the y direction |
aspect => Self.Camera.Aspect, -- x/y aspect ratio |
zNear => Self.Camera.near_plane_Distance, -- distance from the viewer to the near clipping plane |
zFar => Self.Camera.far_plane_Distance); -- distance from the viewer to the far clipping plane |
Get (GL.PROJECTION_MATRIX, Self.Camera.Projection_Matrix (1, 1)'Unchecked_Access); -- Get the current PROJECTION matrix from OpenGL |
Self.Camera.Projection_Matrix := Transpose (Self.Camera.Projection_Matrix); |
MatrixMode (MODELVIEW); -- The matrix generated by GLU.Perspective is multipled by the current matrix |
end enable_Viewport_and_Perspective; |
procedure set_Size (Self : in out Window'Class; width, height : Integer) is |
use G3D; |
use REF; |
half_fov_max_rads : Real; |
Tan_of_half_fov_max_rads : Real; |
begin |
Self.main_size_x := GL.Sizei (width); |
Self.main_size_y := GL.Sizei (height); |
Self.Camera.Clipper.main_clipping.X1 := 0; |
Self.Camera.Clipper.main_clipping.Y1 := 0; |
Self.Camera.Clipper.main_clipping.X2 := width - 1; |
Self.Camera.Clipper.main_clipping.Y2 := height - 1; |
Self.Camera.Aspect := GL.Double (Self.main_size_x) / GL.Double (Self.main_size_y); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.