raylib_models.c 6.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Basic geometric 3D shapes drawing functions
  2. void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
  3. void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis,
  4. float rotationAngle, Color color); // Draw a circle in 3D world space
  5. void DrawCube(Vector3 position, float width, float height, float lenght, Color color); // Draw cube
  6. void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
  7. void DrawCubeWires(Vector3 position, float width, float height, float lenght, Color color); // Draw cube wires
  8. void DrawCubeTexture(Texture2D texture, Vector3 position, float width,
  9. float height, float lenght, Color color); // Draw cube textured
  10. void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
  11. void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
  12. void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
  13. void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom,
  14. float height, int slices, Color color); // Draw a cylinder/cone
  15. void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom,
  16. float height, int slices, Color color); // Draw a cylinder/cone wires
  17. void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
  18. void DrawRay(Ray ray, Color color); // Draw a ray line
  19. void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
  20. void DrawGizmo(Vector3 position); // Draw simple gizmo
  21. // Model loading/unloading functions
  22. Mesh LoadMesh(const char *fileName); // Load mesh from file
  23. Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData); // Load mesh from vertex data
  24. Model LoadModel(const char *fileName); // Load model from file
  25. Model LoadModelFromMesh(Mesh data, bool dynamic); // Load model from mesh data
  26. Model LoadHeightmap(Image heightmap, Vector3 size); // Load heightmap model from image data
  27. Model LoadCubicmap(Image cubicmap); // Load cubes-based map model from image data
  28. void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
  29. void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM)
  30. // Material loading/unloading functions
  31. Material LoadMaterial(const char *fileName); // Load material data (from file)
  32. Material LoadDefaultMaterial(void); // Load default material (uses default models shader)
  33. void UnloadMaterial(Material material); // Unload material textures from VRAM
  34. // Model drawing functions
  35. void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
  36. void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis,
  37. float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
  38. void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
  39. void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis,
  40. float rotationAngle, Vector3 scale, Color tint); // Draw a model wires
  41. void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
  42. void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture
  43. void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec,
  44. Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
  45. // Collision detection functions
  46. bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres
  47. bool CheckCollisionBoxes(Vector3 minBBox1, Vector3 maxBBox1, Vector3 minBBox2, Vector3 maxBBox2); // Detect collision between two boxes
  48. bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
  49. bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); // Detect collision between ray and sphere
  50. bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere ex.
  51. bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box
  52. BoundingBox CalculateBoundingBox(Mesh mesh); // Calculate mesh bounding box limits
  53. RayHitInfo GetCollisionRayMesh(Ray ray, Mesh *mesh); // Get collision info between ray and mesh
  54. RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
  55. RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane)