1. pragma Style_Checks (Off); 
  2. pragma Warnings (Off); 
  3.  
  4. ------------------------------------------------------------------------- 
  5.  --  GL.Geometry - GL geometry primitives 
  6.  -- 
  7.  --  Copyright (c) Rod Kay 2007 
  8.  --  AUSTRALIA 
  9.  --  Permission granted to use this software, without any warranty, 
  10.  --  for any purpose, provided this copyright note remains attached 
  11.  --  and unmodified if sources are distributed further. 
  12.  ------------------------------------------------------------------------- 
  13.  
  14. with Ada.Numerics.Generic_Elementary_functions; 
  15. with Ada.Text_IO; use Ada.Text_IO; 
  16.  
  17. package body GL.Geometry.primal is 
  18.  
  19.    function  primitive_Id (Self  : in     primal_Geometry) return GL.ObjectTypeEnm 
  20.    is 
  21.    begin 
  22.       return self.primitive.primitive_Id; 
  23.    end; 
  24.  
  25.    function  vertex_Count  (Self  : in     primal_Geometry) return GL.geometry.vertex_Id 
  26.    is 
  27.    begin 
  28.       return self.primitive.Vertices'Length; 
  29.    end; 
  30.  
  31.    function  indices_Count (Self  : in     primal_Geometry) return GL.positive_uInt 
  32.    is 
  33.    begin 
  34.       return self.primitive.Indices'Length; 
  35.    end; 
  36.  
  37.    function Bounds (Self  : in     primal_Geometry) return GL.geometry.Bounds_record 
  38.    is 
  39.    begin 
  40.       return Bounds (self.Primitive.Vertices.all); 
  41.    end; 
  42.  
  43.    function Vertices (Self  : in     primal_Geometry) return GL.geometry.GL_Vertex_array 
  44.    is 
  45.    begin 
  46.       return self.primitive.Vertices.all; 
  47.    end; 
  48.  
  49.    procedure set_Vertices  (Self  : in out primal_Geometry;   To  : access GL.geometry.GL_Vertex_array) 
  50.    is 
  51.    begin 
  52.       self.primitive.set_Vertices (to => To); 
  53.       self.Bounds := Bounds (self.primitive.Vertices.all); 
  54.    end; 
  55.  
  56.    function Indices (Self  : in     primal_Geometry) return GL.geometry.vertex_Id_array 
  57.    is 
  58.       the_Indices  : GL.geometry.vertex_Id_array := self.primitive.Indices.all; 
  59.    begin 
  60.       increment (the_Indices); 
  61.       return the_Indices; 
  62.    end; 
  63.  
  64.    procedure set_Indices   (Self  : in out primal_Geometry;   To  : access GL.geometry.vertex_Id_array) 
  65.    is 
  66.    begin 
  67.       self.primitive.set_Indices (to => To); 
  68.    end; 
  69.  
  70.    procedure Draw (Self  : in     primal_Geometry) 
  71.    is 
  72.    begin 
  73.       self.Primitive.draw; 
  74.    end; 
  75.  
  76.    procedure destroy (Self  : in out primal_Geometry) 
  77.    is 
  78.       use Primitives; 
  79.    begin 
  80.       free (self.Primitive); 
  81.    end; 
  82.  
  83. end GL.Geometry.primal;