From cbf06c5d3378a37e4139fb98b203d35f5ad7444f Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 25 Mar 2024 23:30:41 -0400 Subject: [PATCH] Added some 3D functions... --- raylib.ads | 122 ++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 85 insertions(+), 37 deletions(-) diff --git a/raylib.ads b/raylib.ads index 70af8ac..32a5bbd 100644 --- a/raylib.ads +++ b/raylib.ads @@ -689,14 +689,20 @@ package Raylib is Value : Float := 0.0; end record with Convention => C_Pass_By_Copy; - type Float_Array_4 is array (0 .. 3) of Float; + No_Material_Map : Material_Map; + + type Float_Array_4 is array (0 .. 3) of Float; + type Material_Map_Array_4 is array (0 .. 3) of Material_Map; + type Material_Map_Array is array (Natural range <>) of Material_Map; type Material is record - Data : Shader := No_Shader; - Map : access Material_Map := null; - Parameter : Float_Array_4 := (0.0, 0.0, 0.0, 0.0); + Data : Shader := No_Shader; + Maps : access Material_Map_Array := null; + Parameter : Float_Array_4 := (0.0, 0.0, 0.0, 1.0); end record with Convention => C_Pass_By_Copy; + No_Material : Material; + type Transform is record Translation : Vector_3D := (0.0, 0.0, 0.0); Rotation : Vector_4D := (0.0, 0.0, 0.0, 0.0); @@ -712,18 +718,23 @@ package Raylib is Parent : Integer := 0; end record with Convention => C_Pass_By_Copy; + type Material_Array_4 is array (0 .. 3) of Material; + type Material_Array is array (Natural range <>) of Material; + type Model is record Transform : Matrix_4D := Id_Matrix; Mesh_Count : Integer := 0; Material_Count : Integer := 0; Meshes : access Mesh := null; - Materials : access Material := null; + Materials : access Material_Array := null; Mesh_Materials : access Integer := null; Bone_Count : Integer := 0; Bones : access Bone_Info := null; --~Bind_Post : access Transform := null; ERROR end record with Convention => C_Pass_By_Copy; + No_Model : Model; + type Model_Animation is record Bone_Count : Integer := 0; Frame_Count : Integer := 0; @@ -3445,10 +3456,12 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~function Model LoadModel (const char *fileName) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Load_Model ( + File_Name : String := "" + ) return Model with + Import => True, + Convention => C, + External_Name => "LoadModel"; --~function Model LoadModelFromMesh (Mesh mesh) with --~Import => True, @@ -3460,20 +3473,27 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~procedure UnloadModel (Model model) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Unload_Model ( + Data : Model := No_Model + ) with + Import => True, + Convention => C, + External_Name => "UnloadModel"; --~function BoundingBox GetModelBoundingBox (Model model) with --~Import => True, --~Convention => C, --~External_Name => ""; - --~procedure DrawModel (Model model, Vector3 position, float scale, Color tint) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Draw_Model ( + Data : Model := No_Model; + Position : Vector_3D := (0.0, 0.0, 0.0); + Scale : Float := 1.0; + Tint : Color := White + ) with + Import => True, + Convention => C, + External_Name => "DrawModel"; --~procedure DrawModelEx (Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint) with --~Import => True, @@ -3495,25 +3515,44 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~procedure DrawBillboard (Camera camera, Texture2D texture, Vector3 position, float size, Color tint) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Draw_Billboard ( + Camera : Camera_3D := No_Camera_3D; + Billboard : Texture := No_Texture; + Position : Vector_3D := (0.0, 0.0, 0.0); + Size : Float := 0.0; + Tint : Color := White + ) with + Import => True, + Convention => C, + External_Name => "DrawBillboard"; --~procedure DrawBillboardRec (Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint) with --~Import => True, --~Convention => C, --~External_Name => ""; - --~procedure DrawBillboardPro (Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Draw_Billboard_Pro ( + Camera : Camera_3D := No_Camera_3D; + Billboard : Texture := No_Texture; + Source : Rectangle := No_Rectangle; + Position : Vector_3D := (0.0, 0.0, 0.0); + Up : Vector_3D := (0.0, 0.0, 0.0); + Size : Vector_2D := (0.0, 0.0); + Origin : Vector_2D := (0.0, 0.0); + Rotation : Float := 0.0; + Tint : Color := White + ) with + Import => True, + Convention => C, + External_Name => "DrawBillboardPro"; - --~procedure UploadMesh (Mesh *mesh, bool dynamic) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Upload_Mesh ( + Data : access Mesh := null; + Dynamic : Logical := False + ) with + Import => True, + Convention => C, + External_Name => "UploadMesh"; --~procedure UpdateMeshBuffer (Mesh mesh, int index, const void *data, int dataSize, int offset) with --~Import => True, @@ -3525,10 +3564,14 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~procedure DrawMesh (Mesh mesh, Material material, Matrix transform) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Draw_Mesh ( + Data : Mesh := No_Mesh; + Pixels : Material := No_Material; + Transform : Matrix_4D := (others => 0.0) + ) with + Import => True, + Convention => C, + External_Name => "DrawMesh"; --~procedure DrawMeshInstanced (Mesh mesh, Material material, const Matrix *transforms, int instances) with --~Import => True, @@ -3560,10 +3603,15 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~function Mesh GenMeshPlane (float width, float length, int resX, int resZ) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Gen_Mesh_Plane ( + Width : Float := 1.0; + Height : Float := 1.0; + X : Integer := 1; + Z : Integer := 1 + ) return Mesh with + Import => True, + Convention => C, + External_Name => "GenMeshPlane"; --~function Mesh GenMeshCube (float width, float height, float length) with --~Import => True,