Renamed CalculateBoundingBox() to MeshBoundingBox()
Renamed function for consistency with a possible Mesh manipulation functions (maybe added in a future). Naming follows Image*() manipulation functions.
This commit is contained in:
parent
a7207dc6d4
commit
fd2adbe62d
@ -38,7 +38,7 @@ int main()
|
|||||||
tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||||
|
|
||||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
BoundingBox towerBBox = CalculateBoundingBox(tower.mesh);
|
BoundingBox towerBBox = MeshBoundingBox(tower.mesh); // Get mesh bounding box
|
||||||
bool hitMeshBBox = false;
|
bool hitMeshBBox = false;
|
||||||
bool hitTriangle = false;
|
bool hitTriangle = false;
|
||||||
|
|
||||||
|
12
src/models.c
12
src/models.c
@ -2055,9 +2055,9 @@ RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate mesh bounding box limits
|
// Compute mesh bounding box limits
|
||||||
// NOTE: minVertex and maxVertex should be transformed by model transform matrix
|
// NOTE: minVertex and maxVertex should be transformed by model transform matrix
|
||||||
BoundingBox CalculateBoundingBox(Mesh mesh)
|
BoundingBox MeshBoundingBox(Mesh mesh)
|
||||||
{
|
{
|
||||||
// Get min and max vertex to construct bounds (AABB)
|
// Get min and max vertex to construct bounds (AABB)
|
||||||
Vector3 minVertex = { 0 };
|
Vector3 minVertex = { 0 };
|
||||||
@ -2083,16 +2083,16 @@ BoundingBox CalculateBoundingBox(Mesh mesh)
|
|||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute provided mesh tangents
|
// Compute mesh tangents
|
||||||
void MeshTangents(Mesh *mesh)
|
void MeshTangents(Mesh *mesh)
|
||||||
{
|
{
|
||||||
// TODO: Calculate mesh tangents
|
// TODO: Compute mesh tangents
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute provided mesh binormals
|
// Compute mesh binormals
|
||||||
void MeshBinormals(Mesh *mesh)
|
void MeshBinormals(Mesh *mesh)
|
||||||
{
|
{
|
||||||
// TODO: Calculate mesh binormals
|
// TODO: Compute mesh binormals
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -1006,6 +1006,11 @@ RLAPI void UnloadModel(Model model);
|
|||||||
RLAPI Mesh LoadMesh(const char *fileName); // Load mesh from file
|
RLAPI Mesh LoadMesh(const char *fileName); // Load mesh from file
|
||||||
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
|
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
|
||||||
|
|
||||||
|
// Mesh manipulation functions
|
||||||
|
RLAPI BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
|
||||||
|
RLAPI void MeshTangents(Mesh *mesh); // Compute mesh tangents
|
||||||
|
RLAPI void MeshBinormals(Mesh *mesh); // Compute mesh binormals
|
||||||
|
|
||||||
// Mesh generation functions
|
// Mesh generation functions
|
||||||
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
|
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
|
||||||
RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
|
RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
|
||||||
@ -1035,7 +1040,6 @@ RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRe
|
|||||||
Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
|
Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
|
||||||
|
|
||||||
// Collision detection functions
|
// Collision detection functions
|
||||||
RLAPI BoundingBox CalculateBoundingBox(Mesh mesh); // Calculate mesh bounding box limits
|
|
||||||
RLAPI bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres
|
RLAPI bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres
|
||||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Detect collision between two bounding boxes
|
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Detect collision between two bounding boxes
|
||||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
|
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
|
||||||
|
Loading…
Reference in New Issue
Block a user