Merge remote-tracking branch 'raysan5/master' into drmkms
This commit is contained in:
commit
e1ed0ffbe0
51 changed files with 35992 additions and 15285 deletions
|
|
@ -119,7 +119,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit
|
||||
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||
NODE_PATH = $(EMSDK_PATH)/node/12.18.1_64bit/bin
|
||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||
endif
|
||||
|
||||
|
|
@ -176,6 +176,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
MAKE = make
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),OSX)
|
||||
MAKE = make
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define compiler flags:
|
||||
|
|
@ -196,7 +199,7 @@ ifeq ($(BUILD_MODE),DEBUG)
|
|||
endif
|
||||
else
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -Os
|
||||
else
|
||||
CFLAGS += -s -O1
|
||||
endif
|
||||
|
|
@ -264,7 +267,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
# Reset everything.
|
||||
# Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include
|
||||
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
|
||||
#INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
|
||||
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src/external
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -287,7 +291,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
# Reset everything.
|
||||
# Precedence: immediately local, installed version, raysan5 provided libs
|
||||
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH)
|
||||
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -378,7 +382,8 @@ CORE = \
|
|||
core/core_scissor_test \
|
||||
core/core_storage_values \
|
||||
core/core_vr_simulator \
|
||||
core/core_loading_thread
|
||||
core/core_loading_thread \
|
||||
core/core_quat_conversion
|
||||
|
||||
SHAPES = \
|
||||
shapes/shapes_basic_shapes \
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int main(void)
|
|||
DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
|
||||
DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
|
||||
|
||||
DrawText(FormatText("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
|
||||
DrawText(TextFormat("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ int main(void)
|
|||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText(FormatText("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
|
||||
DrawText(TextFormat("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
|
||||
DrawText("click mouse button to change frequency", 10, 10, 20, DARKGRAY);
|
||||
|
||||
// Draw the current buffer state proportionate to the screen
|
||||
|
|
|
|||
10
examples/audio/resources/LICENSE.md
Normal file
10
examples/audio/resources/LICENSE.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
| resource | author | licence | notes |
|
||||
| :------------------- | :---------: | :------ | :---- |
|
||||
| country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - |
|
||||
|
|
@ -59,7 +59,7 @@ int main(void)
|
|||
|
||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||
{
|
||||
DrawText(FormatText("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))
|
||||
{
|
||||
|
|
@ -106,8 +106,8 @@ int main(void)
|
|||
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
|
||||
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
|
||||
|
||||
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
}
|
||||
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||
{
|
||||
|
|
@ -161,14 +161,14 @@ int main(void)
|
|||
// TODO: Draw generic gamepad
|
||||
}
|
||||
|
||||
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
||||
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
||||
|
||||
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
||||
{
|
||||
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||
}
|
||||
|
||||
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||
if (GetGamepadButtonPressed() != -1) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ int main(void)
|
|||
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
|
||||
|
||||
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
|
||||
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
|
||||
DrawText(TextFormat("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int main(void)
|
|||
{
|
||||
// Draw circle and touch index number
|
||||
DrawCircleV(touchPosition, 34, ORANGE);
|
||||
DrawText(FormatText("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK);
|
||||
DrawText(TextFormat("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
131
examples/core/core_quat_conversion.c
Normal file
131
examples/core/core_quat_conversion.c
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - quat conversions
|
||||
*
|
||||
* Welcome to raylib!
|
||||
*
|
||||
* generally you should really stick to eulers OR quats...
|
||||
* This tests that various conversions are equivilant.
|
||||
*
|
||||
* You can find all basic examples on [C:\raylib\raylib\examples] directory and
|
||||
* raylib official webpage: [www.raylib.com]
|
||||
*
|
||||
* Enjoy using raylib. :)
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
#ifndef PI2
|
||||
#define PI2 PI*2
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - quat conversions");
|
||||
|
||||
Camera3D camera = { 0 };
|
||||
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Mesh msh = GenMeshCylinder(.2, 1, 32);
|
||||
Model mod = LoadModelFromMesh(msh);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
Quaternion q1;
|
||||
Matrix m1,m2,m3,m4;
|
||||
Vector3 v1,v2;
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
if (!IsKeyDown(KEY_SPACE)) {
|
||||
v1.x += 0.01;
|
||||
v1.y += 0.03;
|
||||
v1.z += 0.05;
|
||||
}
|
||||
|
||||
if (v1.x > PI2) v1.x-=PI2;
|
||||
if (v1.y > PI2) v1.y-=PI2;
|
||||
if (v1.z > PI2) v1.z-=PI2;
|
||||
|
||||
q1 = QuaternionFromEuler(v1.x, v1.y, v1.z);
|
||||
m1 = MatrixRotateZYX(v1);
|
||||
m2 = QuaternionToMatrix(q1);
|
||||
|
||||
q1 = QuaternionFromMatrix(m1);
|
||||
m3 = QuaternionToMatrix(q1);
|
||||
|
||||
v2 = QuaternionToEuler(q1);
|
||||
v2.x*=DEG2RAD; v2.y*=DEG2RAD; v2.z*=DEG2RAD;
|
||||
|
||||
m4 = MatrixRotateZYX(v2);
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginMode3D(camera);
|
||||
|
||||
mod.transform = m1;
|
||||
DrawModel(mod, (Vector3){-1,0,0},1.0,RED);
|
||||
mod.transform = m2;
|
||||
DrawModel(mod, (Vector3){1,0,0},1.0,RED);
|
||||
mod.transform = m3;
|
||||
DrawModel(mod, (Vector3){0,0,0},1.0,RED);
|
||||
mod.transform = m4;
|
||||
DrawModel(mod, (Vector3){0,0,-1},1.0,RED);
|
||||
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (v2.x<0) v2.x+=PI2;
|
||||
if (v2.y<0) v2.y+=PI2;
|
||||
if (v2.z<0) v2.z+=PI2;
|
||||
|
||||
Color cx,cy,cz;
|
||||
cx=cy=cz=BLACK;
|
||||
if (v1.x == v2.x) cx = GREEN;
|
||||
if (v1.y == v2.y) cy = GREEN;
|
||||
if (v1.z == v2.z) cz = GREEN;
|
||||
|
||||
DrawText(TextFormat("%2.3f",v1.x),20,20,20,cx);
|
||||
DrawText(TextFormat("%2.3f",v1.y),20,40,20,cy);
|
||||
DrawText(TextFormat("%2.3f",v1.z),20,60,20,cz);
|
||||
|
||||
|
||||
DrawText(TextFormat("%2.3f",v2.x),200,20,20,cx);
|
||||
DrawText(TextFormat("%2.3f",v2.y),200,40,20,cy);
|
||||
DrawText(TextFormat("%2.3f",v2.z),200,60,20,cz);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ int main(void)
|
|||
|
||||
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
|
||||
|
||||
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
|
||||
DrawText(TextFormat("%i", randValue), 360, 180, 80, LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ int main(void)
|
|||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
|
||||
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
|
||||
DrawText(TextFormat("SCORE: %i", score), 280, 130, 40, MAROON);
|
||||
DrawText(TextFormat("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
|
||||
|
||||
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
|
||||
DrawText(TextFormat("frames: %i", framesCounter), 10, 10, 20, LIME);
|
||||
|
||||
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
|
||||
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ int main(void)
|
|||
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
|
||||
|
||||
// Distortion shader (uses device lens distortion and chroma)
|
||||
Shader distortion = LoadShader(0, FormatText("resources/distortion%i.fs", GLSL_VERSION));
|
||||
Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION));
|
||||
|
||||
SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
4
examples/core/resources/LICENSE
Normal file
4
examples/core/resources/LICENSE
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
| resource | author | licence | notes |
|
||||
| :------------ | :---------: | :------ | :---- |
|
||||
| ps3.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| xbox.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
|
|
@ -160,25 +160,25 @@ int main(void)
|
|||
EndMode3D();
|
||||
|
||||
// Draw some debug GUI text
|
||||
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
||||
DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
||||
|
||||
if (nearestHit.hit)
|
||||
{
|
||||
int ypos = 70;
|
||||
|
||||
DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
||||
DrawText(TextFormat("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
||||
|
||||
DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f",
|
||||
DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f",
|
||||
nearestHit.position.x,
|
||||
nearestHit.position.y,
|
||||
nearestHit.position.z), 10, ypos + 15, 10, BLACK);
|
||||
|
||||
DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f",
|
||||
DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f",
|
||||
nearestHit.normal.x,
|
||||
nearestHit.normal.y,
|
||||
nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
|
||||
if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
if (hitTriangle) DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
}
|
||||
|
||||
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
||||
|
|
|
|||
|
|
@ -195,6 +195,6 @@ void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[
|
|||
|
||||
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
|
||||
|
||||
DrawText(FormatText("%5.1f", angle), x - MeasureText(FormatText("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
|
||||
DrawText(TextFormat("%5.1f", angle), x - MeasureText(TextFormat("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
|
||||
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -9,14 +9,11 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPosition;
|
||||
varying vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D equirectangularMap;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
vec2 SampleSphericalMap(vec3 v)
|
||||
{
|
||||
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
|
||||
|
|
@ -34,5 +31,5 @@ void main()
|
|||
vec3 color = texture(equirectangularMap, uv).rgb;
|
||||
|
||||
// Calculate final fragment color
|
||||
finalColor = vec4(color, 1.0);
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
attribute vec3 vertexPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec3 fragPosition;
|
||||
varying vec3 fragPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,33 +11,24 @@
|
|||
#version 110
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPosition;
|
||||
varying vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform samplerCube environmentMap;
|
||||
uniform bool vflipped;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) {
|
||||
return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Fetch color from texture map
|
||||
vec3 color;
|
||||
vec3 color = { 0.0 };
|
||||
|
||||
if (vflipped )
|
||||
color = flipTextureCube(environmentMap, fragPosition).rgb;
|
||||
else
|
||||
color = texture(environmentMap, fragPosition).rgb;
|
||||
if (vflipped) color = texture2D(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
|
||||
else color = texture2D(environmentMap, fragPosition).rgb;
|
||||
|
||||
// Apply gamma correction
|
||||
color = color/(color + vec3(1.0));
|
||||
color = pow(color, vec3(1.0/2.2));
|
||||
|
||||
// Calculate final fragment color
|
||||
finalColor = vec4(color, 1.0);
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,19 +20,13 @@ uniform bool vflipped;
|
|||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) {
|
||||
return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Fetch color from texture map
|
||||
vec3 color;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
if (vflipped )
|
||||
color = flipTextureCube(environmentMap, fragPosition).rgb;
|
||||
else
|
||||
color = texture(environmentMap, fragPosition).rgb;
|
||||
if (vflipped) color = texture(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
|
||||
else color = texture(environmentMap, fragPosition).rgb;
|
||||
|
||||
// Apply gamma correction
|
||||
color = color/(color + vec3(1.0));
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue