Replace TABS by 4 spaces
This commit is contained in:
parent
b93c4b0c20
commit
ea0f6c7a26
@ -135,7 +135,7 @@ EASEDEF float EaseQuadOut(float t, float b, float c, float d) { t /= d; return (
|
|||||||
EASEDEF float EaseQuadInOut(float t, float b, float c, float d)
|
EASEDEF float EaseQuadInOut(float t, float b, float c, float d)
|
||||||
{
|
{
|
||||||
if ((t/=d/2) < 1) return (((c/2)*(t*t)) + b);
|
if ((t/=d/2) < 1) return (((c/2)*(t*t)) + b);
|
||||||
return (-c/2.0f*(((t - 1.0f)*(t - 3.0f)) - 1.0f) + b);
|
return (-c/2.0f*(((t - 1.0f)*(t - 3.0f)) - 1.0f) + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exponential Easing functions
|
// Exponential Easing functions
|
||||||
@ -147,7 +147,7 @@ EASEDEF float EaseExpoInOut(float t, float b, float c, float d)
|
|||||||
if (t == d) return (b + c);
|
if (t == d) return (b + c);
|
||||||
if ((t/=d/2.0f) < 1.0f) return (c/2.0f*pow(2.0f, 10.0f*(t - 1.0f)) + b);
|
if ((t/=d/2.0f) < 1.0f) return (c/2.0f*pow(2.0f, 10.0f*(t - 1.0f)) + b);
|
||||||
|
|
||||||
return (c/2.0f*(-pow(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b);
|
return (c/2.0f*(-pow(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back Easing functions
|
// Back Easing functions
|
||||||
|
@ -119,29 +119,29 @@ int main(int argc, char *argv[])
|
|||||||
// Check if a key has been pressed
|
// Check if a key has been pressed
|
||||||
static int kbhit(void)
|
static int kbhit(void)
|
||||||
{
|
{
|
||||||
struct termios oldt, newt;
|
struct termios oldt, newt;
|
||||||
int ch;
|
int ch;
|
||||||
int oldf;
|
int oldf;
|
||||||
|
|
||||||
tcgetattr(STDIN_FILENO, &oldt);
|
tcgetattr(STDIN_FILENO, &oldt);
|
||||||
newt = oldt;
|
newt = oldt;
|
||||||
newt.c_lflag &= ~(ICANON | ECHO);
|
newt.c_lflag &= ~(ICANON | ECHO);
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||||
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
|
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
|
||||||
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
|
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
|
||||||
|
|
||||||
ch = getchar();
|
ch = getchar();
|
||||||
|
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
||||||
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
||||||
|
|
||||||
if (ch != EOF)
|
if (ch != EOF)
|
||||||
{
|
{
|
||||||
ungetc(ch, stdin);
|
ungetc(ch, stdin);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get pressed character
|
// Get pressed character
|
||||||
|
@ -59,13 +59,13 @@ int main(void)
|
|||||||
if (drawRoundedRect) DrawRectangleRounded(rec, roundness, segments, Fade(MAROON, 0.2));
|
if (drawRoundedRect) DrawRectangleRounded(rec, roundness, segments, Fade(MAROON, 0.2));
|
||||||
if (drawRoundedLines) DrawRectangleRoundedLines(rec,roundness, segments, lineThick, Fade(MAROON, 0.4));
|
if (drawRoundedLines) DrawRectangleRoundedLines(rec,roundness, segments, lineThick, Fade(MAROON, 0.4));
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
width = GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", NULL, width, 0, GetScreenWidth() - 300);
|
width = GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", NULL, width, 0, GetScreenWidth() - 300);
|
||||||
height = GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", NULL, height, 0, GetScreenHeight() - 50);
|
height = GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", NULL, height, 0, GetScreenHeight() - 50);
|
||||||
roundness = GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", NULL, roundness, 0.0f, 1.0f);
|
roundness = GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", NULL, roundness, 0.0f, 1.0f);
|
||||||
lineThick = GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", NULL, lineThick, 0, 20);
|
lineThick = GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", NULL, lineThick, 0, 20);
|
||||||
segments = GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", NULL, segments, 0, 60);
|
segments = GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", NULL, segments, 0, 60);
|
||||||
|
|
||||||
drawRoundedRect = GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", drawRoundedRect);
|
drawRoundedRect = GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", drawRoundedRect);
|
||||||
drawRoundedLines = GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", drawRoundedLines);
|
drawRoundedLines = GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", drawRoundedLines);
|
||||||
|
@ -160,6 +160,6 @@ int main(int argc, char **argv)
|
|||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
66
src/models.c
66
src/models.c
@ -2871,44 +2871,44 @@ RayHitInfo GetCollisionRayMesh(Ray ray, Mesh mesh, Matrix transform)
|
|||||||
{
|
{
|
||||||
RayHitInfo result = { 0 };
|
RayHitInfo result = { 0 };
|
||||||
|
|
||||||
// Check if mesh vertex data on CPU for testing
|
// Check if mesh vertex data on CPU for testing
|
||||||
if (mesh.vertices != NULL)
|
if (mesh.vertices != NULL)
|
||||||
{
|
{
|
||||||
// model->mesh.triangleCount may not be set, vertexCount is more reliable
|
// model->mesh.triangleCount may not be set, vertexCount is more reliable
|
||||||
int triangleCount = mesh.vertexCount / 3;
|
int triangleCount = mesh.vertexCount / 3;
|
||||||
|
|
||||||
// Test against all triangles in mesh
|
// Test against all triangles in mesh
|
||||||
for (int i = 0; i < triangleCount; i++)
|
for (int i = 0; i < triangleCount; i++)
|
||||||
{
|
{
|
||||||
Vector3 a, b, c;
|
Vector3 a, b, c;
|
||||||
Vector3* vertdata = (Vector3*)mesh.vertices;
|
Vector3* vertdata = (Vector3*)mesh.vertices;
|
||||||
|
|
||||||
if (mesh.indices)
|
if (mesh.indices)
|
||||||
{
|
{
|
||||||
a = vertdata[mesh.indices[i * 3 + 0]];
|
a = vertdata[mesh.indices[i * 3 + 0]];
|
||||||
b = vertdata[mesh.indices[i * 3 + 1]];
|
b = vertdata[mesh.indices[i * 3 + 1]];
|
||||||
c = vertdata[mesh.indices[i * 3 + 2]];
|
c = vertdata[mesh.indices[i * 3 + 2]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a = vertdata[i * 3 + 0];
|
a = vertdata[i * 3 + 0];
|
||||||
b = vertdata[i * 3 + 1];
|
b = vertdata[i * 3 + 1];
|
||||||
c = vertdata[i * 3 + 2];
|
c = vertdata[i * 3 + 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
a = Vector3Transform(a, transform);
|
a = Vector3Transform(a, transform);
|
||||||
b = Vector3Transform(b, transform);
|
b = Vector3Transform(b, transform);
|
||||||
c = Vector3Transform(c, transform);
|
c = Vector3Transform(c, transform);
|
||||||
|
|
||||||
RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, a, b, c);
|
RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, a, b, c);
|
||||||
|
|
||||||
if (triHitInfo.hit)
|
if (triHitInfo.hit)
|
||||||
{
|
{
|
||||||
// Save the closest hit triangle
|
// Save the closest hit triangle
|
||||||
if ((!result.hit) || (result.distance > triHitInfo.distance)) result = triHitInfo;
|
if ((!result.hit) || (result.distance > triHitInfo.distance)) result = triHitInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user