text stringlengths 0 234 |
|---|
half_fov_max_rads := 0.5 * Self.Camera.FOVy * deg2rad; |
Tan_of_half_fov_max_rads := Tan (half_fov_max_rads); |
Self.Camera.near_plane_Height := Self.Camera.near_plane_Distance * Tan_of_half_fov_max_rads; |
Self.Camera.near_plane_Width := Self.Camera.near_plane_Height * Self.Camera.Aspect; |
Self.Camera.far_plane_Height := Self.Camera.far_plane_Distance * Tan_of_half_fov_max_rads; |
Self.Camera.far_plane_Width := Self.Camera.far_plane_Height * Self.Camera.Aspect; |
if Self.Camera.Aspect > 1.0 then -- x side angle broader than y side angle |
half_fov_max_rads := Arctan (Self.Camera.Aspect * Tan_of_half_fov_max_rads); |
end if; |
Self.Camera.Clipper.max_dot_product := Sin (half_fov_max_rads); |
end set_Size; |
-- Procedures passed to GLUT: |
-- Window_Resize, Keyboard, Motion, Menu, Mouse, Display |
procedure Window_Resize (width, height : Integer) is |
the_Window : constant GLUT.Windows.Window_view := current_Window; |
begin |
the_Window.all.forget_mouse := 5; |
set_Size (the_Window.all, width, height); |
Reset_for_3D (the_Window.all); |
end Window_Resize; |
procedure Menu (value : Integer) is |
begin |
case value is |
when 1 => -- GLUT.GameModeString (Full_Screen_Mode); |
GLUT.FullScreen; |
-- res := GLUT.EnterGameMode; |
GLUT.SetCursor (GLUT.CURSOR_NONE); |
current_Window.all.forget_mouse := 10; |
current_Window.all.full_screen := True; |
when 2 => null; -- GLUT_exit; |
when others => null; |
end case; |
end Menu; |
pragma Unreferenced (Menu); |
procedure Display_status (Self : in out Window; |
sec : GLOBE_3D.Real) is |
use G3D, G3D.REF; |
light_info : String (1 .. 8); |
begin |
PushMatrix; |
Disable (LIGHTING); |
Disable (TEXTURE_2D); |
Color (red => 0.7, |
green => 0.7, |
blue => 0.6); |
GLUT_2D.Text_output ((1.0, 0.0, 0.0), " (x)", GLUT_2D.Times_Roman_24); |
GLUT_2D.Text_output ((0.0, 1.0, 0.0), " (y)", GLUT_2D.Times_Roman_24); |
GLUT_2D.Text_output ((0.0, 0.0, 1.0), " (z)", GLUT_2D.Times_Roman_24); |
GLUT_2D.Text_output (0, 50, Self.main_size_x, Self.main_size_y, |
"Eye : " & Coords (Self.Camera.Clipper.Eye_Position), |
GLUT_2D.Helvetica_10); |
GLUT_2D.Text_output (0, 60, Self.main_size_x, Self.main_size_y, |
"View direction : " & Coords (Self.Camera.Clipper.view_direction), |
GLUT_2D.Helvetica_10); |
for i in light_info'Range loop |
if Is_light_switched (i) then |
light_info (i) := Character'Val (Character'Pos ('0') + i); |
else |
light_info (i) := 'x'; |
end if; |
end loop; |
GLUT_2D.Text_output (0, 70, Self.main_size_x, Self.main_size_y, "Lights : (" & light_info & ')', GLUT_2D.Helvetica_10); |
if sec > 0.0 then |
GLUT_2D.Text_output (0, 130, Self.main_size_x, Self.main_size_y, "FPS : " & Integer'Image (Integer (1.0 / sec)), GLUT_2D.Helvetica_10); |
end if; |
if Self.is_capturing_Video then |
GLUT_2D.Text_output (0, 150, Self.main_size_x, Self.main_size_y, "*recording*", GLUT_2D.Helvetica_10); |
end if; |
PopMatrix; |
end Display_status; |
function Frames_per_second (Self : Window) return Float is (Float (1.0 / (Self.Average * 0.001))); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.