1 /**
2  *  Basic geometric 3D shapes drawing functions
3  */
4 module bindbc.raylib.bind.models;
5 
6 import bindbc.raylib.types;
7 
8 version (BindRaylib_Static) {
9    extern (C) @nogc nothrow {
10    }
11 } else {
12    extern (C) @nogc nothrow {
13       /**
14        * Draw a line in 3D world space
15        */
16       alias pDrawLine3D = void function(Vector3 startPos, Vector3 endPos, Color color);
17       /**
18        * Draw a point in 3D space, actually a small line
19        */
20       alias pDrawPoint3D = void function(Vector3 position, Color color);
21       /**
22        * Draw a circle in 3D world space
23        */
24       alias pDrawCircle3D = void function(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color);
25       /**
26        * Draw cube
27        */
28       alias pDrawCube = void function(Vector3 position, float width, float height, float length, Color color);
29       /**
30        * Draw cube (Vector version)
31        */
32       alias pDrawCubeV = void function(Vector3 position, Vector3 size, Color color);
33       /**
34        * Draw cube wires
35        */
36       alias pDrawCubeWires = void function(Vector3 position, float width, float height, float length, Color color);
37       /**
38        * Draw cube wires (Vector version)
39        */
40       alias pDrawCubeWiresV = void function(Vector3 position, Vector3 size, Color color);
41       /**
42        * Draw cube textured
43        */
44       alias pDrawCubeTexture = void function(Texture2D texture, Vector3 position, float width, float height, float length, Color color);
45       /**
46        * Draw sphere
47        */
48       alias pDrawSphere = void function(Vector3 centerPos, float radius, Color color);
49       /**
50        * Draw sphere with extended parameters
51        */
52       alias pDrawSphereEx = void function(Vector3 centerPos, float radius, int rings, int slices, Color color);
53       /**
54        * Draw sphere wires
55        */
56       alias pDrawSphereWires = void function(Vector3 centerPos, float radius, int rings, int slices, Color color);
57       /**
58        * Draw a cylinder/cone
59        */
60       alias pDrawCylinder = void function(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
61       /**
62        * Draw a cylinder/cone wires
63        */
64       alias pDrawCylinderWires = void function(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
65       /**
66        * Draw a plane XZ
67        */
68       alias pDrawPlane = void function(Vector3 centerPos, Vector2 size, Color color);
69       /**
70        * Draw a ray line
71        */
72       alias pDrawRay = void function(Ray ray, Color color);
73       /**
74        * Draw a grid (centered at (0, 0, 0))
75        */
76       alias pDrawGrid = void function(int slices, float spacing);
77       /**
78        * Draw simple gizmo
79        */
80       alias pDrawGizmo = void function(Vector3 position);
81 
82       // Model loading/unloading functions
83       /**
84        * Load model from files (meshes and materials)
85        */
86       alias pLoadModel = Model function(const(char)*  fileName);
87       /**
88        * Load model from generated mesh (default material)
89        */
90       alias pLoadModelFromMesh = Model function(Mesh mesh);
91       /**
92        * Unload model from memory (RAM and/or VRAM)
93        */
94       alias pUnloadModel = void function(Model model);
95 
96       // Mesh loading/unloading functions
97       /**
98        * Load meshes from model file
99        */
100       alias pLoadMeshes = Mesh* function(const(char)*  fileName, int* meshCount);
101       /**
102        * Export mesh data to file
103        */
104       alias pExportMesh = void function(Mesh mesh, const(char)*  fileName);
105       /**
106        * Unload mesh from memory (RAM and/or VRAM)
107        */
108       alias pUnloadMesh = void function(Mesh mesh);
109 
110       // Material loading/unloading functions
111       /**
112        * Load materials from model file
113        */
114       alias pLoadMaterials = Material* function(const(char)*  fileName, int* materialCount);
115       /**
116        * Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
117        */
118       alias pLoadMaterialDefault = Material function();
119       /**
120        * Unload material from GPU memory (VRAM)
121        */
122       alias pUnloadMaterial = void function(Material material);
123       /**
124        * Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
125        */
126       alias pSetMaterialTexture = void function(Material* material, int mapType, Texture2D texture);
127       /**
128        * Set material for a mesh
129        */
130       alias pSetModelMeshMaterial = void function(Model* model, int meshId, int materialId);
131 
132       // Model animations loading/unloading functions
133       /**
134        * Load model animations from file
135        */
136       alias pLoadModelAnimations = ModelAnimation* function(const(char)* fileName, int* animsCount);
137       /**
138        * Update model animation pose
139        */
140       alias pUpdateModelAnimation = void function(Model model, ModelAnimation anim, int frame);
141       /**
142        * Unload animation data
143        */
144       alias pUnloadModelAnimation = void function(ModelAnimation anim);
145       /**
146        * Check model animation skeleton match
147        */
148       alias pIsModelAnimationValid = bool function(Model model, ModelAnimation anim);
149 
150       // Mesh generation functions
151       /**
152        * Generate polygonal mesh
153        */
154       alias pGenMeshPoly = Mesh function(int sides, float radius);
155       /**
156        * Generate plane mesh (with subdivisions)
157        */
158       alias pGenMeshPlane = Mesh function(float width, float length, int resX, int resZ);
159       /**
160        * Generate cuboid mesh
161        */
162       alias pGenMeshCube = Mesh function(float width, float height, float length);
163       /**
164        * Generate sphere mesh (standard sphere)
165        */
166       alias pGenMeshSphere = Mesh function(float radius, int rings, int slices);
167       /**
168        * Generate half-sphere mesh (no bottom cap)
169        */
170       alias pGenMeshHemiSphere = Mesh function(float radius, int rings, int slices);
171       /**
172        * Generate cylinder mesh
173        */
174       alias pGenMeshCylinder = Mesh function(float radius, float height, int slices);
175       /**
176        * Generate torus mesh
177        */
178       alias pGenMeshTorus = Mesh function(float radius, float size, int radSeg, int sides);
179       /**
180        * Generate trefoil knot mesh
181        */
182       alias pGenMeshKnot = Mesh function(float radius, float size, int radSeg, int sides);
183       /**
184        * Generate heightmap mesh from image data
185        */
186       alias pGenMeshHeightmap = Mesh function(Image heightmap, Vector3 size);
187       /**
188        * Generate cubes-based map mesh from image data
189        */
190       alias pGenMeshCubicmap = Mesh function(Image cubicmap, Vector3 cubeSize);
191 
192       // Mesh manipulation functions
193       /**
194        * Compute mesh bounding box limits
195        */
196       alias pMeshBoundingBox = BoundingBox function(Mesh mesh);
197       /**
198        * Compute mesh tangents
199        */
200       alias pMeshTangents = void function(Mesh* mesh);
201       /**
202        * Compute mesh binormals
203        */
204       alias pMeshBinormals = void function(Mesh* mesh);
205 
206       // Model drawing functions
207       /**
208        * Draw a model (with texture if set)
209        */
210       alias pDrawModel = void function(Model model, Vector3 position, float scale, Color tint);
211       /**
212        * Draw a model with extended parameters
213        */
214       alias pDrawModelEx = void function(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint);
215       /**
216        * Draw a model wires (with texture if set)
217        */
218       alias pDrawModelWires = void function(Model model, Vector3 position, float scale, Color tint);
219       /**
220        * Draw a model wires (with texture if set) with extended parameters
221        */
222       alias pDrawModelWiresEx = void function(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle,
223             Vector3 scale, Color tint);
224       /**
225        * Draw bounding box (wires)
226        */
227       alias pDrawBoundingBox = void function(BoundingBox box, Color color);
228       /**
229        * Draw a billboard texture
230        */
231       alias pDrawBillboard = void function(Camera camera, Texture2D texture, Vector3 center, float size, Color tint);
232       /**
233        * Draw a billboard texture defined by sourceRec
234        */
235       alias pDrawBillboardRec = void function(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint);
236 
237       // Collision detection functions
238       /**
239        * Detect collision between two spheres
240        */
241       alias pCheckCollisionSpheres = bool function(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB);
242       /**
243        * Detect collision between two bounding boxes
244        */
245       alias pCheckCollisionBoxes = bool function(BoundingBox box1, BoundingBox box2);
246       /**
247        * Detect collision between box and sphere
248        */
249       alias pCheckCollisionBoxSphere = bool function(BoundingBox box, Vector3 center, float radius);
250       /**
251        * Detect collision between ray and sphere
252        */
253       alias pCheckCollisionRaySphere = bool function(Ray ray, Vector3 center, float radius);
254       /**
255        * Detect collision between ray and sphere, returns collision point
256        */
257       alias pCheckCollisionRaySphereEx = bool function(Ray ray, Vector3 center, float radius, Vector3 * collisionPoint);
258       /**
259        * Detect collision between ray and box
260        */
261       alias pCheckCollisionRayBox = bool function(Ray ray, BoundingBox box);
262       /**
263        * Get collision info between ray and model
264        */
265       alias pGetCollisionRayModel = RayHitInfo function(Ray ray, Model model);
266       /**
267        * Get collision info between ray and triangle
268        */
269       alias pGetCollisionRayTriangle = RayHitInfo function(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3);
270       /**
271        * Get collision info between ray and ground plane (Y-normal plane)
272        */
273       alias pGetCollisionRayGround = RayHitInfo function(Ray ray, float groundHeight);
274    }
275    __gshared {
276       pDrawLine3D DrawLine3D;
277       pDrawPoint3D DrawPoint3D;
278       pDrawCircle3D DrawCircle3D;
279       pDrawCube DrawCube;
280       pDrawCubeV DrawCubeV;
281       pDrawCubeWires DrawCubeWires;
282       pDrawCubeWiresV DrawCubeWiresV;
283       pDrawCubeTexture DrawCubeTexture;
284       pDrawSphere DrawSphere;
285       pDrawSphereEx DrawSphereEx;
286       pDrawSphereWires DrawSphereWires;
287       pDrawCylinder DrawCylinder;
288       pDrawCylinderWires DrawCylinderWires;
289       pDrawPlane DrawPlane;
290       pDrawRay DrawRay;
291       pDrawGrid DrawGrid;
292       pDrawGizmo DrawGizmo;
293       pLoadModel LoadModel;
294       pLoadModelFromMesh LoadModelFromMesh;
295       pUnloadModel UnloadModel;
296       pLoadMeshes LoadMeshes;
297       pExportMesh ExportMesh;
298       pUnloadMesh UnloadMesh;
299       pLoadMaterials LoadMaterials;
300       pLoadMaterialDefault LoadMaterialDefault;
301       pUnloadMaterial UnloadMaterial;
302       pSetMaterialTexture SetMaterialTexture;
303       pSetModelMeshMaterial SetModelMeshMaterial;
304       pLoadModelAnimations LoadModelAnimations;
305       pUpdateModelAnimation UpdateModelAnimation;
306       pUnloadModelAnimation UnloadModelAnimation;
307       pIsModelAnimationValid IsModelAnimationValid;
308       pGenMeshPoly GenMeshPoly;
309       pGenMeshPlane GenMeshPlane;
310       pGenMeshCube GenMeshCube;
311       pGenMeshSphere GenMeshSphere;
312       pGenMeshHemiSphere GenMeshHemiSphere;
313       pGenMeshCylinder GenMeshCylinder;
314       pGenMeshTorus GenMeshTorus;
315       pGenMeshKnot GenMeshKnot;
316       pGenMeshHeightmap GenMeshHeightmap;
317       pGenMeshCubicmap GenMeshCubicmap;
318       pMeshBoundingBox MeshBoundingBox;
319       pMeshTangents MeshTangents;
320       pMeshBinormals MeshBinormals;
321       pDrawModel DrawModel;
322       pDrawModelEx DrawModelEx;
323       pDrawModelWires DrawModelWires;
324       pDrawModelWiresEx DrawModelWiresEx;
325       pDrawBoundingBox DrawBoundingBox;
326       pDrawBillboard DrawBillboard;
327       pDrawBillboardRec DrawBillboardRec;
328       pCheckCollisionSpheres CheckCollisionSpheres;
329       pCheckCollisionBoxes CheckCollisionBoxes;
330       pCheckCollisionBoxSphere CheckCollisionBoxSphere;
331       pCheckCollisionRaySphere CheckCollisionRaySphere;
332       pCheckCollisionRaySphereEx CheckCollisionRaySphereEx;
333       pCheckCollisionRayBox CheckCollisionRayBox;
334       pGetCollisionRayModel GetCollisionRayModel;
335       pGetCollisionRayTriangle GetCollisionRayTriangle;
336       pGetCollisionRayGround GetCollisionRayGround;
337    }
338 }