Added missing header comments.
This commit is contained in:
@ -52,49 +52,5 @@ bool aabbPoint2D(
|
||||
hit->hitY = x + (halfHeight * sy);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aabbVector2D(
|
||||
float x, float y,
|
||||
float vx, float vy,
|
||||
float bx, float by, float width, float height,
|
||||
aabbvectorhit2d_t *hit
|
||||
) {
|
||||
// float halfWidth = width / 2.0;
|
||||
// float halfHeight = height / 2.0;
|
||||
// float paddingX = 0;
|
||||
// float paddingY = 0;
|
||||
|
||||
// float scaleX = 1.0 / vx;
|
||||
// float scaleY = 1.0 / vy;
|
||||
// float signX = mathSign(scaleX);
|
||||
// float signY = mathSign(scaleY);
|
||||
|
||||
// float nearTimeX = (bx - signX * (halfWidth + paddingX) - bx) * scaleX;
|
||||
// float nearTimeY = (by - signY * (halfHeight + paddingY) - by) * scaleY;
|
||||
// float farTimeX = (bx + signX * (halfWidth + paddingX) - bx) * scaleX;
|
||||
// float farTimeY = (by + signY * (halfHeight + paddingY) - by) * scaleY;
|
||||
|
||||
// if(nearTimeX > farTimeY || nearTimeY > farTimeX) return false;
|
||||
|
||||
// float nearTime = nearTimeX > nearTimeY ? nearTimeX : nearTimeY;
|
||||
// float farTime = farTimeX < farTimeY ? farTimeX : farTimeY;
|
||||
// if (nearTime >= 1 || farTime <= 0) return false;
|
||||
|
||||
// hit->time = mathClamp(nearTime, 0, 1);
|
||||
// if(nearTimeX > nearTimeY) {
|
||||
// hit->normalX = -signX;
|
||||
// hit->normalY = 0;
|
||||
// } else {
|
||||
// hit->normalX = 0;
|
||||
// hit->normalY = -signY;
|
||||
// }
|
||||
|
||||
// float deltaX = (1.0 - hit->time) * -vx;
|
||||
// float deltaY = (1.0 - hit->time) * -vy;
|
||||
// hit->hitX = bx + deltaX * hit->time;
|
||||
// hit->hitY = by + deltaY * hit->time;
|
||||
|
||||
return true;
|
||||
}
|
@ -10,14 +10,20 @@
|
||||
#include "sphere.h"
|
||||
#include "../input/input.h"
|
||||
|
||||
/**
|
||||
* Perform a test against a point and an AABB.
|
||||
*
|
||||
* @param pointX Point X coordinate.
|
||||
* @param pointY Point Y coordinate.
|
||||
* @param x Box X coordinate.
|
||||
* @param y Box Y coordinate.
|
||||
* @param width Box width.
|
||||
* @param height Box height.
|
||||
* @param hit Pointer to hit information to store result in, or NULL for none.
|
||||
* @return True if a hit occured, otherwise false.
|
||||
*/
|
||||
bool aabbPoint2D(
|
||||
float pointX, float pointY,
|
||||
float x, float y, float width, float height,
|
||||
aabbpointhit2d_t *hit
|
||||
);
|
||||
|
||||
bool aabbVector2D(
|
||||
float x, float y, float vx, float vy,
|
||||
float bx, float by, float width, float height,
|
||||
aabbvectorhit2d_t *vector
|
||||
);
|
Reference in New Issue
Block a user