Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
7e0324859a
52 changed files with 1178 additions and 777 deletions
|
|
@ -20,7 +20,7 @@ Here it is a list with the ones I'm aware of:
|
||||||
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
|
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
|
||||||
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
|
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
|
||||||
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
||||||
| raylib-rs | 3.0 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
|
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
|
||||||
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
||||||
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
||||||
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
||||||
|
|
@ -53,7 +53,8 @@ Here it is a list with the ones I'm aware of:
|
||||||
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
||||||
| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
|
| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
|
||||||
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
|
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
|
||||||
| raylib-js | 2.6 | [JavaScript](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-js |
|
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
|
||||||
|
| raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 |
|
||||||
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
|
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
|
||||||
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
|
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
|
||||||
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
|
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
|
||||||
|
|
@ -77,7 +78,7 @@ Here it is a list with the ones I'm aware of:
|
||||||
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
||||||
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
|
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
|
||||||
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
||||||
| vraylib | 2.5 | [V](https://vlang.io/) | https://github.com/MajorHard/vraylib |
|
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
|
||||||
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
||||||
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
||||||
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
||||||
|
|
@ -90,6 +91,8 @@ Here it is a list with the ones I'm aware of:
|
||||||
| raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef |
|
| raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef |
|
||||||
| raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never |
|
| raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never |
|
||||||
| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
||||||
|
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
|
||||||
|
| Harbour | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
|
||||||
|
|
||||||
|
|
||||||
Missing some language? Feel free to create a new binding! :)
|
Missing some language? Feel free to create a new binding! :)
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@ int main(void)
|
||||||
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
circles[i].alpha = 0.0f;
|
circles[i].alpha = 0.0f;
|
||||||
circles[i].radius = GetRandomValue(10, 40);
|
circles[i].radius = (float)GetRandomValue(10, 40);
|
||||||
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
circles[i].position.x = (float)GetRandomValue((int)circles[i].radius, (int)(screenWidth - circles[i].radius));
|
||||||
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
circles[i].position.y = (float)GetRandomValue((int)circles[i].radius, (int)(screenHeight - circles[i].radius));
|
||||||
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
||||||
circles[i].color = colors[GetRandomValue(0, 13)];
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
}
|
}
|
||||||
|
|
@ -104,9 +104,9 @@ int main(void)
|
||||||
if (circles[i].alpha <= 0.0f)
|
if (circles[i].alpha <= 0.0f)
|
||||||
{
|
{
|
||||||
circles[i].alpha = 0.0f;
|
circles[i].alpha = 0.0f;
|
||||||
circles[i].radius = GetRandomValue(10, 40);
|
circles[i].radius = (float)GetRandomValue(10, 40);
|
||||||
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
circles[i].position.x = (float)GetRandomValue((int)circles[i].radius, (int)(screenWidth - circles[i].radius));
|
||||||
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
circles[i].position.y = (float)GetRandomValue((int)circles[i].radius, (int)(screenHeight - circles[i].radius));
|
||||||
circles[i].color = colors[GetRandomValue(0, 13)];
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ int main(void)
|
||||||
Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
|
Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
|
||||||
Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
|
Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
|
||||||
|
|
||||||
SetSoundVolume(fxWav, 0.2);
|
SetSoundVolume(fxWav, 0.2f);
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,8 @@ int main(void)
|
||||||
// Draw the current buffer state proportionate to the screen
|
// Draw the current buffer state proportionate to the screen
|
||||||
for (int i = 0; i < screenWidth; i++)
|
for (int i = 0; i < screenWidth; i++)
|
||||||
{
|
{
|
||||||
position.x = i;
|
position.x = (float)i;
|
||||||
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000;
|
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000.0f;
|
||||||
|
|
||||||
DrawPixelV(position, RED);
|
DrawPixelV(position, RED);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,19 @@ int main(void)
|
||||||
|
|
||||||
for (int i = 0; i < MAX_BUILDINGS; i++)
|
for (int i = 0; i < MAX_BUILDINGS; i++)
|
||||||
{
|
{
|
||||||
buildings[i].width = GetRandomValue(50, 200);
|
buildings[i].width = (float)GetRandomValue(50, 200);
|
||||||
buildings[i].height = GetRandomValue(100, 800);
|
buildings[i].height = (float)GetRandomValue(100, 800);
|
||||||
buildings[i].y = screenHeight - 130 - buildings[i].height;
|
buildings[i].y = screenHeight - 130.0f - buildings[i].height;
|
||||||
buildings[i].x = -6000 + spacing;
|
buildings[i].x = -6000.0f + spacing;
|
||||||
|
|
||||||
spacing += buildings[i].width;
|
spacing += (int)buildings[i].width;
|
||||||
|
|
||||||
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
|
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera2D camera = { 0 };
|
Camera2D camera = { 0 };
|
||||||
camera.target = (Vector2){ player.x + 20, player.y + 20 };
|
camera.target = (Vector2){ player.x + 20.0f, player.y + 20.0f };
|
||||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||||
camera.rotation = 0.0f;
|
camera.rotation = 0.0f;
|
||||||
camera.zoom = 1.0f;
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
|
|
@ -98,8 +98,8 @@ int main(void)
|
||||||
|
|
||||||
DrawRectangleRec(player, RED);
|
DrawRectangleRec(player, RED);
|
||||||
|
|
||||||
DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, GREEN);
|
DrawLine((int)camera.target.x, -screenHeight*10, (int)camera.target.x, screenHeight*10, GREEN);
|
||||||
DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, GREEN);
|
DrawLine(-screenWidth*10, (int)camera.target.y, screenWidth*10, (int)camera.target.y, GREEN);
|
||||||
|
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ int main(void)
|
||||||
|
|
||||||
Camera2D camera = { 0 };
|
Camera2D camera = { 0 };
|
||||||
camera.target = player.position;
|
camera.target = player.position;
|
||||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||||
camera.rotation = 0.0f;
|
camera.rotation = 0.0f;
|
||||||
camera.zoom = 1.0f;
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
|
|
@ -191,14 +191,14 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
|
||||||
|
|
||||||
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||||
{
|
{
|
||||||
camera->offset = (Vector2){ width/2, height/2 };
|
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||||
camera->target = player->position;
|
camera->target = player->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||||
{
|
{
|
||||||
camera->target = player->position;
|
camera->target = player->position;
|
||||||
camera->offset = (Vector2){ width/2, height/2 };
|
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||||
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;
|
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;
|
||||||
|
|
||||||
for (int i = 0; i < envItemsLength; i++)
|
for (int i = 0; i < envItemsLength; i++)
|
||||||
|
|
@ -225,7 +225,7 @@ void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *e
|
||||||
static float minEffectLength = 10;
|
static float minEffectLength = 10;
|
||||||
static float fractionSpeed = 0.8f;
|
static float fractionSpeed = 0.8f;
|
||||||
|
|
||||||
camera->offset = (Vector2){ width/2, height/2 };
|
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||||
Vector2 diff = Vector2Subtract(player->position, camera->target);
|
Vector2 diff = Vector2Subtract(player->position, camera->target);
|
||||||
float length = Vector2Length(diff);
|
float length = Vector2Length(diff);
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ void UpdateCameraEvenOutOnLanding(Camera2D *camera, Player *player, EnvItem *env
|
||||||
static int eveningOut = false;
|
static int eveningOut = false;
|
||||||
static float evenOutTarget;
|
static float evenOutTarget;
|
||||||
|
|
||||||
camera->offset = (Vector2){ width/2, height/2 };
|
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||||
camera->target.x = player->position.x;
|
camera->target.x = player->position.x;
|
||||||
|
|
||||||
if (eveningOut)
|
if (eveningOut)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ int main(void)
|
||||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
{
|
{
|
||||||
heights[i] = (float)GetRandomValue(1, 12);
|
heights[i] = (float)GetRandomValue(1, 12);
|
||||||
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
|
positions[i] = (Vector3){ (float)GetRandomValue(-15, 15), heights[i]/2.0f, (float)GetRandomValue(-15, 15) };
|
||||||
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ int main(void)
|
||||||
|
|
||||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
|
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,12 @@
|
||||||
|
|
||||||
// NOTE: Gamepad name ID depends on drivers and OS
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
||||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
#else
|
#else
|
||||||
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
||||||
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
|
@ -61,7 +62,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
DrawText(TextFormat("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
||||||
|
|
||||||
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID) || IsGamepadName(GAMEPAD_PLAYER1, XBOX360_LEGACY_NAME_ID))
|
||||||
{
|
{
|
||||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
|
@ -191,4 +192,4 @@ int main(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ int main(void)
|
||||||
UnloadImage(imMap); // Unload image from RAM
|
UnloadImage(imMap); // Unload image from RAM
|
||||||
|
|
||||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||||
Vector3 playerPosition = camera.position; // Set player position
|
|
||||||
|
|
||||||
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set camera mode
|
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set camera mode
|
||||||
|
|
||||||
|
|
@ -93,10 +92,7 @@ int main(void)
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, mapPosition, 1.0f, WHITE); // Draw maze map
|
DrawModel(model, mapPosition, 1.0f, WHITE); // Draw maze map
|
||||||
//DrawCubeV(playerPosition, (Vector3){ 0.2f, 0.4f, 0.2f }, RED); // Draw player
|
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
||||||
|
|
||||||
// Generate cubemap from panorama texture
|
// Generate cubemap from panorama texture
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
Texture2D panorama = LoadTexture("resources/dresden_square.hdr");
|
Texture2D panorama = LoadTexture("resources/dresden_square_2k.hdr");
|
||||||
// Load equirectangular to cubemap shader
|
// Load equirectangular to cubemap shader
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
Shader shdrCubemap = LoadShader("resources/shaders/glsl330/cubemap.vs", "resources/shaders/glsl330/cubemap.fs");
|
Shader shdrCubemap = LoadShader("resources/shaders/glsl330/cubemap.vs", "resources/shaders/glsl330/cubemap.fs");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include "rlgl.h"
|
||||||
|
|
||||||
|
bool useHDR = false;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +38,8 @@ int main(void)
|
||||||
skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs");
|
skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs");
|
||||||
#endif
|
#endif
|
||||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MAP_CUBEMAP }, UNIFORM_INT);
|
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MAP_CUBEMAP }, UNIFORM_INT);
|
||||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ 1 }, UNIFORM_INT);
|
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "doGamma"), (int[1]) { useHDR ? 1 : 0 }, UNIFORM_INT);
|
||||||
|
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ useHDR ? 1 : 0 }, UNIFORM_INT);
|
||||||
|
|
||||||
// Load cubemap shader and setup required shader locations
|
// Load cubemap shader and setup required shader locations
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
|
@ -45,18 +49,29 @@ int main(void)
|
||||||
#endif
|
#endif
|
||||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT);
|
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT);
|
||||||
|
|
||||||
// Load HDR panorama (sphere) texture
|
char skyboxFileName[256] = { 0 };
|
||||||
char panoFileName[256] = { 0 };
|
|
||||||
TextCopy(panoFileName, "resources/dresden_square_2k.hdr");
|
|
||||||
Texture2D panorama = LoadTexture(panoFileName);
|
|
||||||
|
|
||||||
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
if (useHDR)
|
||||||
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
{
|
||||||
// NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment,
|
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
|
||||||
// despite texture can be successfully created.. so using UNCOMPRESSED_R8G8B8A8 instead of UNCOMPRESSED_R32G32B32A32
|
|
||||||
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
|
||||||
|
|
||||||
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
// Load HDR panorama (sphere) texture
|
||||||
|
Texture2D panorama = panorama = LoadTexture(skyboxFileName);
|
||||||
|
|
||||||
|
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||||
|
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
||||||
|
// NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment,
|
||||||
|
// despite texture can be successfully created.. so using UNCOMPRESSED_R8G8B8A8 instead of UNCOMPRESSED_R32G32B32A32
|
||||||
|
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
||||||
|
|
||||||
|
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Image img = LoadImage("resources/skybox.png");
|
||||||
|
skybox.materials[0].maps[MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT); // CUBEMAP_LAYOUT_PANORAMA
|
||||||
|
UnloadImage(img);
|
||||||
|
}
|
||||||
|
|
||||||
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
|
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
|
||||||
|
|
||||||
|
|
@ -82,12 +97,22 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Unload current cubemap texture and load new one
|
// Unload current cubemap texture and load new one
|
||||||
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture);
|
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture);
|
||||||
panorama = LoadTexture(droppedFiles[0]);
|
if (useHDR)
|
||||||
TextCopy(panoFileName, droppedFiles[0]);
|
{
|
||||||
|
Texture2D panorama = LoadTexture(droppedFiles[0]);
|
||||||
// Generate cubemap from panorama texture
|
|
||||||
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
// Generate cubemap from panorama texture
|
||||||
UnloadTexture(panorama);
|
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
||||||
|
UnloadTexture(panorama);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Image img = LoadImage(droppedFiles[0]);
|
||||||
|
skybox.materials[0].maps[MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT);
|
||||||
|
UnloadImage(img);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextCopy(skyboxFileName, droppedFiles[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,11 +127,19 @@ int main(void)
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
rlDisableBackfaceCulling();
|
||||||
|
rlDisableDepthMask();
|
||||||
|
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
||||||
|
rlEnableBackfaceCulling();
|
||||||
|
rlEnableDepthMask();
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(panoFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
if (useHDR)
|
||||||
|
DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||||
|
else
|
||||||
|
DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ varying vec3 fragPosition;
|
||||||
// Input uniform values
|
// Input uniform values
|
||||||
uniform samplerCube environmentMap;
|
uniform samplerCube environmentMap;
|
||||||
uniform bool vflipped;
|
uniform bool vflipped;
|
||||||
|
uniform bool doGamma;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
@ -19,9 +20,11 @@ void main()
|
||||||
|
|
||||||
vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z);
|
vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z);
|
||||||
|
|
||||||
// Apply gamma correction
|
if (doGamma)// Apply gamma correction
|
||||||
color = color/(color + vec3(1.0));
|
{
|
||||||
color = pow(color, vec3(1.0/2.2));
|
color = color/(color + vec3(1.0));
|
||||||
|
color = pow(color, vec3(1.0/2.2));
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate final fragment color
|
// Calculate final fragment color
|
||||||
gl_FragColor = vec4(color, 1.0);
|
gl_FragColor = vec4(color, 1.0);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ in vec3 fragPosition;
|
||||||
// Input uniform values
|
// Input uniform values
|
||||||
uniform samplerCube environmentMap;
|
uniform samplerCube environmentMap;
|
||||||
uniform bool vflipped;
|
uniform bool vflipped;
|
||||||
|
uniform bool doGamma;
|
||||||
|
|
||||||
// Output fragment color
|
// Output fragment color
|
||||||
out vec4 finalColor;
|
out vec4 finalColor;
|
||||||
|
|
@ -28,9 +29,11 @@ void main()
|
||||||
if (vflipped) color = texture(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
|
if (vflipped) color = texture(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
|
||||||
else color = texture(environmentMap, fragPosition).rgb;
|
else color = texture(environmentMap, fragPosition).rgb;
|
||||||
|
|
||||||
// Apply gamma correction
|
if (doGamma)// Apply gamma correction
|
||||||
color = color/(color + vec3(1.0));
|
{
|
||||||
color = pow(color, vec3(1.0/2.2));
|
color = color/(color + vec3(1.0));
|
||||||
|
color = pow(color, vec3(1.0/2.2));
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate final fragment color
|
// Calculate final fragment color
|
||||||
finalColor = vec4(color, 1.0);
|
finalColor = vec4(color, 1.0);
|
||||||
|
|
|
||||||
BIN
examples/models/resources/skybox.png
Normal file
BIN
examples/models/resources/skybox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -80,7 +80,7 @@ int main(void)
|
||||||
|
|
||||||
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
int bytesRecv = 0;
|
int bytesRecv = 0;
|
||||||
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, (int)strlen(pingmsg) + 1);
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
if (bytesRecv > 0)
|
if (bytesRecv > 0)
|
||||||
|
|
@ -96,12 +96,12 @@ int main(void)
|
||||||
if (ping)
|
if (ping)
|
||||||
{
|
{
|
||||||
ping = false;
|
ping = false;
|
||||||
SocketSend(clientResult->socket, pingmsg, strlen(pingmsg) + 1);
|
SocketSend(clientResult->socket, pingmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
else if (pong)
|
else if (pong)
|
||||||
{
|
{
|
||||||
pong = false;
|
pong = false;
|
||||||
SocketSend(clientResult->socket, pongmsg, strlen(pingmsg) + 1);
|
SocketSend(clientResult->socket, pongmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ int main(void)
|
||||||
|
|
||||||
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
int bytesRecv = 0;
|
int bytesRecv = 0;
|
||||||
if (IsSocketReady(connection)) bytesRecv = SocketReceive(connection, receiveBuffer, strlen(pingmsg) + 1);
|
if (IsSocketReady(connection)) bytesRecv = SocketReceive(connection, receiveBuffer, (int)strlen(pingmsg) + 1);
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
if (bytesRecv > 0)
|
if (bytesRecv > 0)
|
||||||
|
|
@ -110,12 +110,12 @@ int main(void)
|
||||||
if (ping)
|
if (ping)
|
||||||
{
|
{
|
||||||
ping = false;
|
ping = false;
|
||||||
SocketSend(connection, pingmsg, strlen(pingmsg) + 1);
|
SocketSend(connection, pingmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
else if (pong)
|
else if (pong)
|
||||||
{
|
{
|
||||||
pong = false;
|
pong = false;
|
||||||
SocketSend(connection, pongmsg, strlen(pingmsg) + 1);
|
SocketSend(connection, pongmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ int main(void)
|
||||||
|
|
||||||
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
int bytesRecv = 0;
|
int bytesRecv = 0;
|
||||||
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, (int)strlen(pingmsg) + 1);
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
if (bytesRecv > 0)
|
if (bytesRecv > 0)
|
||||||
|
|
@ -89,12 +89,12 @@ int main(void)
|
||||||
if (ping)
|
if (ping)
|
||||||
{
|
{
|
||||||
ping = false;
|
ping = false;
|
||||||
SocketSend(clientResult->socket, pingmsg, strlen(pingmsg) + 1);
|
SocketSend(clientResult->socket, pingmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
else if (pong)
|
else if (pong)
|
||||||
{
|
{
|
||||||
pong = false;
|
pong = false;
|
||||||
SocketSend(clientResult->socket, pongmsg, strlen(pongmsg) + 1);
|
SocketSend(clientResult->socket, pongmsg, (int)strlen(pongmsg) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ int main(void)
|
||||||
// if (IsSocketReady(serverResult->socket)) {
|
// if (IsSocketReady(serverResult->socket)) {
|
||||||
// bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, msglen);
|
// bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, msglen);
|
||||||
// }
|
// }
|
||||||
int bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
int bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, (int)strlen(pingmsg) + 1);
|
||||||
|
|
||||||
// If we received data, is that data a "Ping!" or a "Pong!"?
|
// If we received data, is that data a "Ping!" or a "Pong!"?
|
||||||
if (bytesRecv > 0)
|
if (bytesRecv > 0)
|
||||||
|
|
@ -93,12 +93,12 @@ int main(void)
|
||||||
if (ping)
|
if (ping)
|
||||||
{
|
{
|
||||||
ping = false;
|
ping = false;
|
||||||
SocketSend(serverResult->socket, pingmsg, strlen(pingmsg) + 1);
|
SocketSend(serverResult->socket, pingmsg, (int)strlen(pingmsg) + 1);
|
||||||
}
|
}
|
||||||
else if (pong)
|
else if (pong)
|
||||||
{
|
{
|
||||||
pong = false;
|
pong = false;
|
||||||
SocketSend(serverResult->socket, pongmsg, strlen(pongmsg) + 1);
|
SocketSend(serverResult->socket, pongmsg, (int)strlen(pongmsg) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,12 @@ EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t
|
||||||
EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); }
|
EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); }
|
||||||
|
|
||||||
// Circular Easing functions
|
// Circular Easing functions
|
||||||
EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrt(1.0f - t*t) - 1.0f) + b); }
|
EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); }
|
||||||
EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrt(1.0f - t*t) + b); }
|
EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrtf(1.0f - t*t) + b); }
|
||||||
EASEDEF float EaseCircInOut(float t, float b, float c, float d)
|
EASEDEF float EaseCircInOut(float t, float b, float c, float d)
|
||||||
{
|
{
|
||||||
if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrt(1.0f - t*t) - 1.0f) + b);
|
if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrtf(1.0f - t*t) - 1.0f) + b);
|
||||||
t -= 2.0f; return (c/2.0f*(sqrt(1.0f - t*t) + 1.0f) + b);
|
t -= 2.0f; return (c/2.0f*(sqrtf(1.0f - t*t) + 1.0f) + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cubic Easing functions
|
// Cubic Easing functions
|
||||||
|
|
@ -139,15 +139,15 @@ EASEDEF float EaseQuadInOut(float t, float b, float c, float d)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exponential Easing functions
|
// Exponential Easing functions
|
||||||
EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c*pow(2.0f, 10.0f*(t/d - 1.0f)) + b); }
|
EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c * powf(2.0f, 10.0f*(t/d - 1.0f)) + b); }
|
||||||
EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c*(-pow(2.0f, -10.0f*t/d) + 1.0f) + b); }
|
EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c * (-powf(2.0f, -10.0f*t/d) + 1.0f) + b); }
|
||||||
EASEDEF float EaseExpoInOut(float t, float b, float c, float d)
|
EASEDEF float EaseExpoInOut(float t, float b, float c, float d)
|
||||||
{
|
{
|
||||||
if (t == 0.0f) return b;
|
if (t == 0.0f) return b;
|
||||||
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* powf(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*(-powf(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back Easing functions
|
// Back Easing functions
|
||||||
|
|
@ -219,7 +219,7 @@ EASEDEF float EaseElasticIn(float t, float b, float c, float d)
|
||||||
float p = d*0.3f;
|
float p = d*0.3f;
|
||||||
float a = c;
|
float a = c;
|
||||||
float s = p/4.0f;
|
float s = p/4.0f;
|
||||||
float postFix = a*pow(2.0f, 10.0f*(t-=1.0f));
|
float postFix = a*powf(2.0f, 10.0f*(t-=1.0f));
|
||||||
|
|
||||||
return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b);
|
return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b);
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ EASEDEF float EaseElasticOut(float t, float b, float c, float d)
|
||||||
float a = c;
|
float a = c;
|
||||||
float s = p/4.0f;
|
float s = p/4.0f;
|
||||||
|
|
||||||
return (a*pow(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b);
|
return (a*powf(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
|
EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
|
||||||
|
|
@ -247,11 +247,11 @@ EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
|
||||||
|
|
||||||
if (t < 1.0f)
|
if (t < 1.0f)
|
||||||
{
|
{
|
||||||
float postFix = a*pow(2.0f, 10.0f*(t-=1.0f));
|
float postFix = a*powf(2.0f, 10.0f*(t-=1.0f));
|
||||||
return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b;
|
return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
float postFix = a*pow(2.0f, -10.0f*(t-=1.0f));
|
float postFix = a*powf(2.0f, -10.0f*(t-=1.0f));
|
||||||
|
|
||||||
return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b);
|
return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue