raylib_models.c 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. void DrawLight(Light light); // Draw light in 3D world
  22. // Model loading/unloading functions
  23. Model LoadModel(const char *fileName); // Load a 3d model (.OBJ)
  24. Model LoadModelEx(Mesh data, bool dynamic); // Load a 3d model (from mesh data)
  25. Model LoadModelFromRES(const char *rresName, int resId); // Load a 3d model from rRES file (raylib Resource)
  26. Model LoadHeightmap(Image heightmap, Vector3 size); // Load a heightmap image as a 3d model
  27. Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based)
  28. void UnloadModel(Model model); // Unload 3d model from memory
  29. // Material loading/unloading functions
  30. Material LoadMaterial(const char *fileName); // Load material data (from file)
  31. Material LoadDefaultMaterial(void); // Load default material (uses default models shader)
  32. Material LoadStandardMaterial(void); // Load standard material (uses material attributes and lighting 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