orka_b455160b/orka_plugin_gltf/src/orka-gltf-scenes.ads

 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
--  SPDX-License-Identifier: Apache-2.0
--
--  Copyright (c) 2017 onox <denkpadje@gmail.com>
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.

with Ada.Containers.Vectors;

with Orka.Containers.Bounded_Vectors;
with Orka.Transforms.Singles.Matrices;

package Orka.glTF.Scenes is
   pragma Preelaborate;

   package Natural_Vectors is new Ada.Containers.Vectors (Natural, Natural);

   package Transforms renames Orka.Transforms.Singles.Matrices;

   type Transform_Kind is (Matrix, TRS);

   type Node (Transform : Transform_Kind := TRS) is record
      Name     : Name_Strings.Bounded_String;
      Mesh     : Natural_Optional;
      Children : Natural_Vectors.Vector;
      case Transform is
         when Matrix =>
            Matrix : Transforms.Matrix4;
         when TRS =>
            Translation : Transforms.Vector4 := (0.0, 0.0, 0.0, 0.0);
            Rotation    : Transforms.Vector4 := (0.0, 0.0, 0.0, 1.0);
            Scale       : Transforms.Vector4 := (1.0, 1.0, 1.0, 0.0);
      end case;
   end record;

   package Node_Vectors is new Orka.Containers.Bounded_Vectors (Natural, Node);

   function Get_Nodes
     (Nodes : Types.JSON_Value) return Node_Vectors.Vector;

   type Scene is record
      Name  : Name_Strings.Bounded_String;
      Nodes : Natural_Vectors.Vector;
   end record;

   package Scene_Vectors is new Orka.Containers.Bounded_Vectors (Natural, Scene);

   function Get_Scenes
     (Scenes : Types.JSON_Value) return Scene_Vectors.Vector;

end Orka.glTF.Scenes;