5 Commits

Author SHA1 Message Date
Ray
d3cc78d9d7 Update rexm.c 2026-03-29 01:44:33 +01:00
Ray
e3dcb144bc Update rexm.c 2026-03-29 01:33:27 +01:00
Ray
da93ec4a21 Remove trailing spaces 2026-03-29 01:17:25 +01:00
Ray
fb0f83bc91 Remove trailing spaces on shaders 2026-03-29 01:10:29 +01:00
Ray
29ded51ea4 Update rlgl.h 2026-03-29 00:43:50 +01:00
52 changed files with 237 additions and 232 deletions

View File

@ -28,20 +28,20 @@ jobs:
max-parallel: 1 max-parallel: 1
matrix: matrix:
ARCH: ["arm64", "x86_64"] ARCH: ["arm64", "x86_64"]
env: env:
RELEASE_NAME: raylib-dev_android_api29_${{ matrix.ARCH }} RELEASE_NAME: raylib-dev_android_api29_${{ matrix.ARCH }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup Release Version - name: Setup Release Version
run: | run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_android_api29_${{ matrix.ARCH }}" >> $GITHUB_ENV echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_android_api29_${{ matrix.ARCH }}" >> $GITHUB_ENV
shell: bash shell: bash
if: github.event_name == 'release' && github.event.action == 'published' if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Android NDK - name: Setup Android NDK
id: setup-ndk id: setup-ndk
uses: nttld/setup-ndk@v1 uses: nttld/setup-ndk@v1
@ -52,7 +52,7 @@ jobs:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Setup Environment - name: Setup Environment
run: | run: |
mkdir build mkdir build
cd build cd build
mkdir ${{ env.RELEASE_NAME }} mkdir ${{ env.RELEASE_NAME }}
@ -60,7 +60,7 @@ jobs:
mkdir include mkdir include
mkdir lib mkdir lib
cd ../.. cd ../..
# Generating static + shared library for 64bit arquitectures and API version 29 # Generating static + shared library for 64bit arquitectures and API version 29
- name: Build Library - name: Build Library
run: | run: |
@ -69,7 +69,7 @@ jobs:
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
shell: cmd shell: cmd
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -80,7 +80,7 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -88,7 +88,7 @@ jobs:
path: | path: |
./build/${{ env.RELEASE_NAME }} ./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz !./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release - name: Upload Artifact to Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:

View File

@ -23,18 +23,18 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Environment - name: Setup Environment
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
- name: Build Library - name: Build Library
run: | run: |
cd src cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC
cd .. cd ..
- name: Build Examples - name: Build Examples
run: | run: |
cd examples cd examples

View File

@ -13,7 +13,7 @@ on:
- 'src/**' - 'src/**'
- 'examples/**' - 'examples/**'
- '.github/workflows/windows_examples.yml' - '.github/workflows/windows_examples.yml'
permissions: permissions:
contents: read contents: read

View File

@ -42,23 +42,23 @@ jobs:
ARCH_NAME: "arm64" ARCH_NAME: "arm64"
COMPILER_PATH: "/usr/bin" COMPILER_PATH: "/usr/bin"
runner: "ubuntu-24.04-arm" runner: "ubuntu-24.04-arm"
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
env: env:
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }} RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup Release Version - name: Setup Release Version
run: | run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}" >> $GITHUB_ENV echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}" >> $GITHUB_ENV
shell: bash shell: bash
if: github.event_name == 'release' && github.event.action == 'published' if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment - name: Setup Environment
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
mkdir build mkdir build
@ -74,7 +74,7 @@ jobs:
run : | run : |
sudo apt-get install gcc-multilib sudo apt-get install gcc-multilib
if: matrix.bits == 32 && matrix.ARCH == 'i386' if: matrix.bits == 32 && matrix.ARCH == 'i386'
# TODO: Support 32bit (i386) static/shared library building # TODO: Support 32bit (i386) static/shared library building
- name: Build Library (32-bit) - name: Build Library (32-bit)
run: | run: |
@ -91,7 +91,7 @@ jobs:
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
if: matrix.bits == 64 && matrix.ARCH == 'x86_64' if: matrix.bits == 64 && matrix.ARCH == 'x86_64'
- name: Build Library (64-bit ARM) - name: Build Library (64-bit ARM)
run: | run: |
cd src cd src
@ -99,7 +99,7 @@ jobs:
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
if: matrix.bits == 64 && matrix.ARCH == 'aarch64' if: matrix.bits == 64 && matrix.ARCH == 'aarch64'
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -110,7 +110,7 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -118,7 +118,7 @@ jobs:
path: | path: |
./build/${{ env.RELEASE_NAME }} ./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz !./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release - name: Upload Artifact to Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:

View File

@ -23,14 +23,14 @@ jobs:
permissions: permissions:
contents: write # for actions/upload-release-asset to upload release asset contents: write # for actions/upload-release-asset to upload release asset
runs-on: macos-latest runs-on: macos-latest
env: env:
RELEASE_NAME: raylib-dev_macos RELEASE_NAME: raylib-dev_macos
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup Release Version - name: Setup Release Version
run: | run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
@ -38,7 +38,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published' if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment - name: Setup Environment
run: | run: |
mkdir build mkdir build
cd build cd build
mkdir ${{ env.RELEASE_NAME }} mkdir ${{ env.RELEASE_NAME }}
@ -46,47 +46,47 @@ jobs:
mkdir include mkdir include
mkdir lib mkdir lib
cd ../.. cd ../..
# Generating static + shared library, note that i386 architecture is deprecated # Generating static + shared library, note that i386 architecture is deprecated
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS # Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
- name: Build Library - name: Build Library
run: | run: |
cd src cd src
clang --version clang --version
# Extract version numbers from Makefile # Extract version numbers from Makefile
brew install grep brew install grep
RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile` RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile`
RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile` RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile`
# Build raylib x86_64 static # Build raylib x86_64 static
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
mv libraylib.a /tmp/libraylib_x86_64.a mv libraylib.a /tmp/libraylib_x86_64.a
make clean make clean
# Build raylib arm64 static # Build raylib arm64 static
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
mv libraylib.a /tmp/libraylib_arm64.a mv libraylib.a /tmp/libraylib_arm64.a
make clean make clean
# Join x86_64 and arm64 static # Join x86_64 and arm64 static
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a
# Build raylib x86_64 dynamic # Build raylib x86_64 dynamic
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target x86_64-apple-macos10.12" -B make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target x86_64-apple-macos10.12" -B
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib
make clean make clean
# Build raylib arm64 dynamic # Build raylib arm64 dynamic
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
# Join x86_64 and arm64 dynamic # Join x86_64 and arm64 dynamic
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib
cd .. cd ..
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -97,7 +97,7 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -105,7 +105,7 @@ jobs:
path: | path: |
./build/${{ env.RELEASE_NAME }} ./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz !./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release - name: Upload Artifact to Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:

View File

@ -12,11 +12,11 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup emsdk - name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14 uses: mymindstorm/setup-emsdk@v14
with: with:

View File

@ -23,15 +23,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth); float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0; float barWidth = cellWidth - 1.0;
vec4 color = WHITE; vec4 color = WHITE;
if (localX <= barWidth) if (localX <= barWidth)
{ {
float sampleX = (binIndex + 0.5)/NUM_OF_BINS; float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW); vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK; if (fragTexCoord.y < amplitude) color = BLACK;
} }
gl_FragColor = color; gl_FragColor = color;
} }

View File

@ -21,15 +21,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth); float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0; float barWidth = cellWidth - 1.0;
vec4 color = WHITE; vec4 color = WHITE;
if (localX <= barWidth) if (localX <= barWidth)
{ {
float sampleX = (binIndex + 0.5)/NUM_OF_BINS; float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW); vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK; if (fragTexCoord.y < amplitude) color = BLACK;
} }
gl_FragColor = color; gl_FragColor = color;
} }

View File

@ -21,15 +21,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth); float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0; float barWidth = cellWidth - 1.0;
vec4 color = WHITE; vec4 color = WHITE;
if (localX <= barWidth) if (localX <= barWidth)
{ {
float sampleX = (binIndex + 0.5)/NUM_OF_BINS; float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW); vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use float amplitude = texture(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK; if (fragTexCoord.y < amplitude) color = BLACK;
} }
finalColor = color; finalColor = color;
} }

View File

@ -14,7 +14,7 @@ void main()
{ {
// Fetch color from texture sampler // Fetch color from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture2D(texture0, fragTexCoord);
// Calculate final fragment color // Calculate final fragment color
gl_FragColor = texelColor*colDiffuse*fragColor; gl_FragColor = texelColor*colDiffuse*fragColor;
} }

View File

@ -23,7 +23,7 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y); int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z); int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w); int boneIndex3 = int(vertexBoneIndices.w);
// WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function // WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function
mat4 boneMatrixTransposed0 = mat4( mat4 boneMatrixTransposed0 = mat4(
vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x), vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x),
@ -45,13 +45,13 @@ void main()
vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y), vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y),
vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z), vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z),
vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w)); vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w));
vec4 skinnedPosition = vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) + vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) + vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) + vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0)); vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragColor = vertexColor; fragColor = vertexColor;

View File

@ -12,7 +12,7 @@ void main()
{ {
// Fetch color from texture sampler // Fetch color from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture2D(texture0, fragTexCoord);
// Calculate final fragment color // Calculate final fragment color
gl_FragColor = texelColor*colDiffuse*fragColor; gl_FragColor = texelColor*colDiffuse*fragColor;
} }

View File

@ -23,7 +23,7 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y); int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z); int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w); int boneIndex3 = int(vertexBoneIndices.w);
// WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function // WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function
mat4 boneMatrixTransposed0 = mat4( mat4 boneMatrixTransposed0 = mat4(
vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x), vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x),
@ -45,13 +45,13 @@ void main()
vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y), vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y),
vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z), vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z),
vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w)); vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w));
vec4 skinnedPosition = vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) + vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) + vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) + vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0)); vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragColor = vertexColor; fragColor = vertexColor;

View File

@ -26,17 +26,17 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y); int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z); int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w); int boneIndex3 = int(vertexBoneIndices.w);
vec4 skinnedPosition = vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexPosition, 1.0)) + vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) + vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) + vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexPosition, 1.0)); vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexPosition, 1.0));
vec4 skinnedNormal = vec4 skinnedNormal =
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexNormal, 0.0)) + vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexNormal, 0.0)) + vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexNormal, 0.0)) + vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexNormal, 0.0)); vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexNormal, 0.0));
skinnedNormal.w = 0.0; skinnedNormal.w = 0.0;

View File

@ -58,12 +58,12 @@ void main()
float gray = GreyScale(cellColor); float gray = GreyScale(cellColor);
float n = 4096.0; float n = 4096.0;
// Character set from https://www.shadertoy.com/view/lssGDj // Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/ // Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600.0; // : if (gray > 0.2) n = 65600.0; // :
if (gray > 0.3) n = 18725316.0; // v if (gray > 0.3) n = 18725316.0; // v
if (gray > 0.4) n = 15255086.0; // o if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.5) n = 13121101.0; // & if (gray > 0.5) n = 13121101.0; // &
if (gray > 0.6) n = 15252014.0; // 8 if (gray > 0.6) n = 15252014.0; // 8
if (gray > 0.7) n = 13195790.0; // @ if (gray > 0.7) n = 13195790.0; // @

View File

@ -12,5 +12,5 @@ void main()
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
// Calculate final vertex position // Calculate final vertex position
gl_Position = vec4(vertexPosition, 1.0); gl_Position = vec4(vertexPosition, 1.0);
} }

View File

@ -1,5 +1,5 @@
#version 100 #version 100
#extension GL_EXT_frag_depth : enable #extension GL_EXT_frag_depth : enable
precision mediump float; precision mediump float;
@ -14,7 +14,7 @@ uniform vec4 colDiffuse;
void main() void main()
{ {
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture2D(texture0, fragTexCoord);
gl_FragColor = texelColor*colDiffuse*fragColor; gl_FragColor = texelColor*colDiffuse*fragColor;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z; gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
} }

View File

@ -24,13 +24,13 @@ void main()
{ {
// Store the fragment position vector in the first gbuffer texture // Store the fragment position vector in the first gbuffer texture
//gPosition = fragPosition; //gPosition = fragPosition;
// Store the per-fragment normals into the gbuffer // Store the per-fragment normals into the gbuffer
//gNormal = normalize(fragNormal); //gNormal = normalize(fragNormal);
// Store the diffuse per-fragment color // Store the diffuse per-fragment color
gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb; gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb;
// Store specular intensity in gAlbedoSpec's alpha component // Store specular intensity in gAlbedoSpec's alpha component
gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r; gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r;
} }

View File

@ -48,7 +48,7 @@ void main()
{ {
// Calculate vertex attributes for fragment shader // Calculate vertex attributes for fragment shader
vec4 worldPos = matModel*vec4(vertexPosition, 1.0); vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz; fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragColor = vertexColor; fragColor = vertexColor;

View File

@ -1,7 +1,7 @@
#version 100 #version 100
#extension GL_EXT_frag_depth : enable // Extension required for writing depth #extension GL_EXT_frag_depth : enable // Extension required for writing depth
precision mediump float; // Precision required for OpenGL ES2 (WebGL) precision mediump float; // Precision required for OpenGL ES2 (WebGL)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;

View File

@ -32,12 +32,12 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
{ {
p.x = abs(p.x); p.x = abs(p.x);
float l = length(p.xy); float l = length(p.xy);
p.xy = mat2(-c.x, c.y, p.xy = mat2(-c.x, c.y,
c.y, c.x)*p.xy; c.y, c.x)*p.xy;
p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x), p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x),
(p.x>0.0)?p.y:l); (p.x>0.0)?p.y:l);
p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0); p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0);
vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z); vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z);
vec2 d = abs(q) - w; vec2 d = abs(q) - w;
return min(max(d.x,d.y),0.0) + length(max(d,0.0)); return min(max(d.x,d.y),0.0) + length(max(d,0.0));
@ -56,9 +56,9 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
} }
vec2 q = vec2(length(ap.yz), ap.x); vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h); float w = sqrt(r*r-h*h);
return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t; return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t;
} }
@ -110,8 +110,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t>tmax) break; if (t>tmax) break;
vec2 h = map(ro+rd*t); vec2 h = map(ro+rd*t);
if (abs(h.x) < (0.0001*t)) if (abs(h.x) < (0.0001*t))
{ {
res = vec2(t,h.y); res = vec2(t,h.y);
break; break;
} }
t += h.x; t += h.x;
@ -146,9 +146,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos) vec3 calcNormal(in vec3 pos)
{ {
vec2 e = vec2(1.0,-1.0)*0.5773*0.0005; vec2 e = vec2(1.0,-1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x + return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x + e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x + e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x); e.xxx*map(pos + e.xxx).x);
} }
@ -176,15 +176,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter) // analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w; vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w;
// xor pattern // xor pattern
return 0.5 - 0.5*i.x*i.y; return 0.5 - 0.5*i.x*i.y;
} }
// https://www.shadertoy.com/view/tdS3DG // https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd) vec4 render(in vec3 ro, in vec3 rd)
{ {
// background // background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3; vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene // raycast scene
vec2 res = raycast(ro,rd); vec2 res = raycast(ro,rd);
float t = res.x; float t = res.x;
@ -194,11 +194,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd; vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos); vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor); vec3 ref = reflect(rd, nor);
// material // material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0)); col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0; float ks = 1.0;
if (m<1.5) if (m<1.5)
{ {
float f = checkersGradBox(3.0*pos.xz); float f = checkersGradBox(3.0*pos.xz);
@ -208,7 +208,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting // lighting
float occ = calcAO(pos, nor); float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0); vec3 lin = vec3(0.0);
// sun // sun
@ -249,7 +249,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ; dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00); lin += col*0.25*dif*vec3(1.00,1.00,1.00);
} }
col = lin; col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t)); col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));
@ -289,7 +289,7 @@ void main()
color = res.xyz; color = res.xyz;
depth = CalcDepth(rd,res.w); depth = CalcDepth(rd,res.w);
} }
gl_FragColor = vec4(color , 1.0); gl_FragColor = vec4(color , 1.0);
gl_FragDepthEXT = depth; gl_FragDepthEXT = depth;
} }

View File

@ -48,7 +48,7 @@ void main()
float normR = float(iter - (iter/55)*55)/55.0; float normR = float(iter - (iter/55)*55)/55.0;
float normG = float(iter - (iter/69)*69)/69.0; float normG = float(iter - (iter/69)*69)/69.0;
float normB = float(iter - (iter/40)*40)/40.0; float normB = float(iter - (iter/40)*40)/40.0;
gl_FragColor = vec4(sin(normR*PI), sin(normG*PI), sin(normB*PI), 1.0); gl_FragColor = vec4(sin(normR*PI), sin(normG*PI), sin(normB*PI), 1.0);
return; return;
} }

View File

@ -21,7 +21,7 @@ void main()
// Convert the (normalized) texel color RED component (GB would work, too) // Convert the (normalized) texel color RED component (GB would work, too)
// to the palette index by scaling up from [0..1] to [0..255] // to the palette index by scaling up from [0..1] to [0..255]
int index = int(texelColor.r*255.0); int index = int(texelColor.r*255.0);
ivec3 color = ivec3(0); ivec3 color = ivec3(0);
// NOTE: On GLSL 100 we are not allowed to index a uniform array by a variable value, // NOTE: On GLSL 100 we are not allowed to index a uniform array by a variable value,
@ -34,7 +34,7 @@ void main()
else if (index == 5) color = palette[5]; else if (index == 5) color = palette[5];
else if (index == 6) color = palette[6]; else if (index == 6) color = palette[6];
else if (index == 7) color = palette[7]; else if (index == 7) color = palette[7];
//gl_FragColor = texture2D(palette, texelColor.xy); // Alternative to ivec3 //gl_FragColor = texture2D(palette, texelColor.xy); // Alternative to ivec3
// Calculate final fragment color. Note that the palette color components // Calculate final fragment color. Note that the palette color components

View File

@ -83,11 +83,11 @@ vec3 ComputePBR()
{ {
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb; vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z); albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0); float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0); float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0); float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1) if (useTexMRA == 1)
{ {
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)); vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -132,18 +132,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL); vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0 // Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent // kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F; vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light // Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic; kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
} }
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5; vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive); return (ambientFinal + lightAccum*ao + emissive);
} }
@ -153,7 +153,7 @@ void main()
// HDR tonemapping // HDR tonemapping
color = pow(color, color + vec3(1.0)); color = pow(color, color + vec3(1.0));
// Gamma correction // Gamma correction
color = pow(color, vec3(1.0/2.2)); color = pow(color, vec3(1.0/2.2));

View File

@ -60,7 +60,7 @@ void main()
float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008); float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008);
int shadowCounter = 0; int shadowCounter = 0;
const int numSamples = 9; const int numSamples = 9;
// PCF (percentage-closer filtering) algorithm: // PCF (percentage-closer filtering) algorithm:
// Instead of testing if just one point is closer to the current point, // Instead of testing if just one point is closer to the current point,
// we test the surrounding points as well // we test the surrounding points as well
@ -74,7 +74,7 @@ void main()
if (curDepth - bias > sampleDepth) shadowCounter++; if (curDepth - bias > sampleDepth) shadowCounter++;
} }
} }
finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples)); finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples));
// Add ambient lighting whether in shadow or not // Add ambient lighting whether in shadow or not

View File

@ -56,12 +56,12 @@ void main()
float gray = GreyScale(cellColor); float gray = GreyScale(cellColor);
float n = 4096.0; float n = 4096.0;
// Character set from https://www.shadertoy.com/view/lssGDj // Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/ // Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600.0; // : if (gray > 0.2) n = 65600.0; // :
if (gray > 0.3) n = 18725316.0; // v if (gray > 0.3) n = 18725316.0; // v
if (gray > 0.4) n = 15255086.0; // o if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.5) n = 13121101.0; // & if (gray > 0.5) n = 13121101.0; // &
if (gray > 0.6) n = 15252014.0; // 8 if (gray > 0.6) n = 15252014.0; // 8
if (gray > 0.7) n = 13195790.0; // @ if (gray > 0.7) n = 13195790.0; // @

View File

@ -12,5 +12,5 @@ void main()
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
// Calculate final vertex position // Calculate final vertex position
gl_Position = vec4(vertexPosition, 1.0); gl_Position = vec4(vertexPosition, 1.0);
} }

View File

@ -1,6 +1,6 @@
#version 120 #version 120
#extension GL_EXT_frag_depth : enable #extension GL_EXT_frag_depth : enable
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor; varying vec4 fragColor;
@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
void main() void main()
{ {
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture2D(texture0, fragTexCoord);
gl_FragColor = texelColor*colDiffuse*fragColor; gl_FragColor = texelColor*colDiffuse*fragColor;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z; gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
} }

View File

@ -22,13 +22,13 @@ void main()
{ {
// Store the fragment position vector in the first gbuffer texture // Store the fragment position vector in the first gbuffer texture
//gPosition = fragPosition; //gPosition = fragPosition;
// Store the per-fragment normals into the gbuffer // Store the per-fragment normals into the gbuffer
//gNormal = normalize(fragNormal); //gNormal = normalize(fragNormal);
// Store the diffuse per-fragment color // Store the diffuse per-fragment color
gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb; gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb;
// Store specular intensity in gAlbedoSpec's alpha component // Store specular intensity in gAlbedoSpec's alpha component
gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r; gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r;
} }

View File

@ -48,7 +48,7 @@ void main()
{ {
// Calculate vertex attributes for fragment shader // Calculate vertex attributes for fragment shader
vec4 worldPos = matModel*vec4(vertexPosition, 1.0); vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz; fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragColor = vertexColor; fragColor = vertexColor;

View File

@ -1,6 +1,6 @@
#version 120 #version 120
#extension GL_EXT_frag_depth : enable // Extension required for writing depth #extension GL_EXT_frag_depth : enable // Extension required for writing depth
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor; varying vec4 fragColor;

View File

@ -30,12 +30,12 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
{ {
p.x = abs(p.x); p.x = abs(p.x);
float l = length(p.xy); float l = length(p.xy);
p.xy = mat2(-c.x, c.y, p.xy = mat2(-c.x, c.y,
c.y, c.x)*p.xy; c.y, c.x)*p.xy;
p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x), p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x),
(p.x>0.0)?p.y:l); (p.x>0.0)?p.y:l);
p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0); p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0);
vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z); vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z);
vec2 d = abs(q) - w; vec2 d = abs(q) - w;
return min(max(d.x,d.y),0.0) + length(max(d,0.0)); return min(max(d.x,d.y),0.0) + length(max(d,0.0));
@ -54,9 +54,9 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
} }
vec2 q = vec2(length(ap.yz), ap.x); vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h); float w = sqrt(r*r-h*h);
return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t; return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t;
} }
@ -108,8 +108,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t>tmax) break; if (t>tmax) break;
vec2 h = map(ro+rd*t); vec2 h = map(ro+rd*t);
if (abs(h.x) < (0.0001*t)) if (abs(h.x) < (0.0001*t))
{ {
res = vec2(t,h.y); res = vec2(t,h.y);
break; break;
} }
t += h.x; t += h.x;
@ -144,9 +144,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos) vec3 calcNormal(in vec3 pos)
{ {
vec2 e = vec2(1.0, -1.0)*0.5773*0.0005; vec2 e = vec2(1.0, -1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x + return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x + e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x + e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x); e.xxx*map(pos + e.xxx).x);
} }
@ -174,15 +174,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter) // analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w; vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w;
// xor pattern // xor pattern
return 0.5 - 0.5*i.x*i.y; return 0.5 - 0.5*i.x*i.y;
} }
// https://www.shadertoy.com/view/tdS3DG // https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd) vec4 render(in vec3 ro, in vec3 rd)
{ {
// background // background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3; vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene // raycast scene
vec2 res = raycast(ro,rd); vec2 res = raycast(ro,rd);
float t = res.x; float t = res.x;
@ -192,11 +192,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd; vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos); vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor); vec3 ref = reflect(rd, nor);
// material // material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0)); col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0; float ks = 1.0;
if (m<1.5) if (m<1.5)
{ {
float f = checkersGradBox(3.0*pos.xz); float f = checkersGradBox(3.0*pos.xz);
@ -206,7 +206,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting // lighting
float occ = calcAO(pos, nor); float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0); vec3 lin = vec3(0.0);
// sun // sun
@ -247,7 +247,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ; dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00); lin += col*0.25*dif*vec3(1.00,1.00,1.00);
} }
col = lin; col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t)); col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));

View File

@ -81,11 +81,11 @@ vec3 ComputePBR()
{ {
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb; vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z); albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0); float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0); float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0); float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1) if (useTexMRA == 1)
{ {
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)); vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -130,18 +130,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL); vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0 // Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent // kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F; vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light // Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic; kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
} }
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5; vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive); return (ambientFinal + lightAccum*ao + emissive);
} }
@ -151,7 +151,7 @@ void main()
// HDR tonemapping // HDR tonemapping
color = pow(color, color + vec3(1.0)); color = pow(color, color + vec3(1.0));
// Gamma correction // Gamma correction
color = pow(color, vec3(1.0/2.2)); color = pow(color, vec3(1.0/2.2));

View File

@ -58,7 +58,7 @@ void main()
float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008); float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008);
int shadowCounter = 0; int shadowCounter = 0;
const int numSamples = 9; const int numSamples = 9;
// PCF (percentage-closer filtering) algorithm: // PCF (percentage-closer filtering) algorithm:
// Instead of testing if just one point is closer to the current point, // Instead of testing if just one point is closer to the current point,
// we test the surrounding points as well // we test the surrounding points as well
@ -72,7 +72,7 @@ void main()
if (curDepth - bias > sampleDepth) shadowCounter++; if (curDepth - bias > sampleDepth) shadowCounter++;
} }
} }
finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples)); finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples));
// Add ambient lighting whether in shadow or not // Add ambient lighting whether in shadow or not

View File

@ -52,12 +52,12 @@ void main()
float gray = GreyScale(cellColor); float gray = GreyScale(cellColor);
int n = 4096; int n = 4096;
// Character set from https://www.shadertoy.com/view/lssGDj // Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/ // Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600; // : if (gray > 0.2) n = 65600; // :
if (gray > 0.3) n = 18725316; // v if (gray > 0.3) n = 18725316; // v
if (gray > 0.4) n = 15255086; // o if (gray > 0.4) n = 15255086; // o
if (gray > 0.5) n = 13121101; // & if (gray > 0.5) n = 13121101; // &
if (gray > 0.6) n = 15252014; // 8 if (gray > 0.6) n = 15252014; // 8
if (gray > 0.7) n = 13195790; // @ if (gray > 0.7) n = 13195790; // @

View File

@ -20,7 +20,7 @@ void main()
// NOTE: Implement here your fragment shader code // NOTE: Implement here your fragment shader code
// final color is the color from the texture // final color is the color from the texture
// times the tint color (colDiffuse) // times the tint color (colDiffuse)
// times the fragment color (interpolated vertex color) // times the fragment color (interpolated vertex color)
finalColor = texelColor*colDiffuse*fragColor; finalColor = texelColor*colDiffuse*fragColor;

View File

@ -14,7 +14,7 @@ out vec4 finalColor;
void main() void main()
{ {
vec4 texelColor = texture(texture0, fragTexCoord); vec4 texelColor = texture(texture0, fragTexCoord);
finalColor = texelColor*colDiffuse*fragColor; finalColor = texelColor*colDiffuse*fragColor;
gl_FragDepth = 1.0 - finalColor.z; gl_FragDepth = 1.0 - finalColor.z;
} }

View File

@ -14,7 +14,7 @@ uniform mat4 matProjection;
void main() void main()
{ {
vec4 worldPos = matModel*vec4(vertexPosition, 1.0); vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz; fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
mat3 normalMatrix = transpose(inverse(mat3(matModel))); mat3 normalMatrix = transpose(inverse(mat3(matModel)));

View File

@ -16,7 +16,7 @@ out vec4 finalColor;
void main() void main()
{ {
vec4 texelColor = texture(texture0, fragTexCoord); vec4 texelColor = texture(texture0, fragTexCoord);
finalColor = texelColor*colDiffuse*fragColor; finalColor = texelColor*colDiffuse*fragColor;
gl_FragDepth = finalColor.z; gl_FragDepth = finalColor.z;
} }

View File

@ -33,7 +33,7 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
p.xy = mat2(-c.x, c.y, c.y, c.x)*p.xy; p.xy = mat2(-c.x, c.y, c.y, c.x)*p.xy;
p.xy = vec2(((p.y > 0.0) || (p.x > 0.0))? p.x : l*sign(-c.x), (p.x>0.0)? p.y : l); p.xy = vec2(((p.y > 0.0) || (p.x > 0.0))? p.x : l*sign(-c.x), (p.x>0.0)? p.y : l);
p.xy = vec2(p.x, abs(p.y - r)) - vec2(le, 0.0); p.xy = vec2(p.x, abs(p.y - r)) - vec2(le, 0.0);
vec2 q = vec2(length(max(p.xy, 0.0)) + min(0.0, max(p.x, p.y)), p.z); vec2 q = vec2(length(max(p.xy, 0.0)) + min(0.0, max(p.x, p.y)), p.z);
vec2 d = abs(q) - w; vec2 d = abs(q) - w;
return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)); return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
@ -54,7 +54,7 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
vec2 q = vec2(length(ap.yz), ap.x); vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h); float w = sqrt(r*r-h*h);
return ((h*q.x < w*q.y)? length(q - vec2(w, h)) : abs(length(q) - r)) - t; return ((h*q.x < w*q.y)? length(q - vec2(w, h)) : abs(length(q) - r)) - t;
} }
@ -79,7 +79,7 @@ vec2 map(in vec3 pos)
{ {
vec2 res = vec2(sdHorseshoe(pos - vec3(-1.0, 0.08, 1.0), vec2(cos(1.3), sin(1.3)), 0.2, 0.3, vec2(0.03,0.5)), 11.5); vec2 res = vec2(sdHorseshoe(pos - vec3(-1.0, 0.08, 1.0), vec2(cos(1.3), sin(1.3)), 0.2, 0.3, vec2(0.03,0.5)), 11.5);
res = opU(res, vec2(sdSixWayCutHollowSphere(pos-vec3(0.0, 1.0, 0.0), 4.0, 3.5, 0.5), 4.5)); res = opU(res, vec2(sdSixWayCutHollowSphere(pos-vec3(0.0, 1.0, 0.0), 4.0, 3.5, 0.5), 4.5));
return res; return res;
} }
@ -105,8 +105,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t > tmax) break; if (t > tmax) break;
vec2 h = map(ro + rd*t); vec2 h = map(ro + rd*t);
if (abs(h.x )< (0.0001*t)) if (abs(h.x )< (0.0001*t))
{ {
res = vec2(t, h.y); res = vec2(t, h.y);
break; break;
} }
t += h.x; t += h.x;
@ -131,9 +131,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
t += clamp(h, 0.01, 0.2); t += clamp(h, 0.01, 0.2);
if ((res < 0.004) || (t > tmax)) break; if ((res < 0.004) || (t > tmax)) break;
} }
res = clamp(res, 0.0, 1.0); res = clamp(res, 0.0, 1.0);
return res*res*(3.0-2.0*res); return res*res*(3.0-2.0*res);
} }
@ -141,9 +141,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos) vec3 calcNormal(in vec3 pos)
{ {
vec2 e = vec2(1.0, -1.0)*0.5773*0.0005; vec2 e = vec2(1.0, -1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x + return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x + e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x + e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x); e.xxx*map(pos + e.xxx).x);
} }
@ -160,7 +160,7 @@ float calcAO(in vec3 pos, in vec3 nor)
sca *= 0.95; sca *= 0.95;
if (occ>0.35) break; if (occ>0.35) break;
} }
return clamp(1.0 - 3.0*occ, 0.0, 1.0)*(0.5+0.5*nor.y); return clamp(1.0 - 3.0*occ, 0.0, 1.0)*(0.5+0.5*nor.y);
} }
@ -172,15 +172,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter) // analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p - 0.5*w)*0.5)-0.5) - abs(fract((p + 0.5*w)*0.5) - 0.5))/w; vec2 i = 2.0*(abs(fract((p - 0.5*w)*0.5)-0.5) - abs(fract((p + 0.5*w)*0.5) - 0.5))/w;
// xor pattern // xor pattern
return (0.5 - 0.5*i.x*i.y); return (0.5 - 0.5*i.x*i.y);
} }
// https://www.shadertoy.com/view/tdS3DG // https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd) vec4 render(in vec3 ro, in vec3 rd)
{ {
// background // background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3; vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene // raycast scene
vec2 res = raycast(ro,rd); vec2 res = raycast(ro,rd);
float t = res.x; float t = res.x;
@ -190,11 +190,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd; vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos); vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor); vec3 ref = reflect(rd, nor);
// material // material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0)); col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0; float ks = 1.0;
if (m < 1.5) if (m < 1.5)
{ {
float f = checkersGradBox(3.0*pos.xz); float f = checkersGradBox(3.0*pos.xz);
@ -204,7 +204,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting // lighting
float occ = calcAO(pos, nor); float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0); vec3 lin = vec3(0.0);
// sun // sun
@ -245,7 +245,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ; dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00); lin += col*0.25*dif*vec3(1.00,1.00,1.00);
} }
col = lin; col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t)); col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));
@ -285,7 +285,7 @@ void main()
color = res.xyz; color = res.xyz;
depth = CalcDepth(rd,res.w); depth = CalcDepth(rd,res.w);
} }
finalColor = vec4(color , 1.0); finalColor = vec4(color , 1.0);
gl_FragDepth = depth; gl_FragDepth = depth;
} }

View File

@ -24,7 +24,7 @@ void main()
// to the palette index by scaling up from [0..1] to [0..255] // to the palette index by scaling up from [0..1] to [0..255]
int index = int(texelColor.r*255.0); int index = int(texelColor.r*255.0);
ivec3 color = palette[index]; ivec3 color = palette[index];
//finalColor = texture(palette, texelColor.xy); // Alternative to ivec3 //finalColor = texture(palette, texelColor.xy); // Alternative to ivec3
// Calculate final fragment color. Note that the palette color components // Calculate final fragment color. Note that the palette color components

View File

@ -84,11 +84,11 @@ vec3 ComputePBR()
{ {
vec3 albedo = texture(albedoMap,vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb; vec3 albedo = texture(albedoMap,vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z); albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0); float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0); float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0); float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1) if (useTexMRA == 1)
{ {
vec4 mra = texture(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)); vec4 mra = texture(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -133,18 +133,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL); vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0 // Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent // kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F; vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light // Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic; kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*lights[i].enabled; // Angle of light has impact on result lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*lights[i].enabled; // Angle of light has impact on result
} }
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5; vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive); return (ambientFinal + lightAccum*ao + emissive);
} }
@ -154,7 +154,7 @@ void main()
// HDR tonemapping // HDR tonemapping
color = pow(color, color + vec3(1.0)); color = pow(color, color + vec3(1.0));
// Gamma correction // Gamma correction
color = pow(color, vec3(1.0/2.2)); color = pow(color, vec3(1.0/2.2));

View File

@ -11,7 +11,7 @@ uniform mat4 mvp;
uniform mat4 matModel; uniform mat4 matModel;
uniform mat4 matNormal; uniform mat4 matNormal;
uniform float time; uniform float time;
uniform sampler2D perlinNoiseMap; uniform sampler2D perlinNoiseMap;

View File

@ -34,7 +34,7 @@ int main()
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
} }
CloseWindow(); CloseWindow();
return 0; return 0;
} }

View File

@ -19,7 +19,7 @@ int main()
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@ -44,7 +44,7 @@ int main()
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -15,9 +15,9 @@
<Param name="float alpha" /> <Param name="float alpha" />
</Overload> </Overload>
</KeyWord> </KeyWord>
NOTE: Generated XML text should be copied inside raylib\Notepad++\plugins\APIs\c.xml NOTE: Generated XML text should be copied inside raylib\Notepad++\plugins\APIs\c.xml
WARNING: Be careful with functions that split parameters into several lines, it breaks the process! WARNING: Be careful with functions that split parameters into several lines, it breaks the process!
LICENSE: zlib/libpng LICENSE: zlib/libpng
@ -42,13 +42,13 @@ int main(int argc, char *argv[])
{ {
FILE *rFile = fopen(argv[1], "rt"); FILE *rFile = fopen(argv[1], "rt");
FILE *rxmlFile = fopen("raylib_npp.xml", "wt"); FILE *rxmlFile = fopen("raylib_npp.xml", "wt");
if ((rFile == NULL) || (rxmlFile == NULL)) if ((rFile == NULL) || (rxmlFile == NULL))
{ {
printf("File could not be opened.\n"); printf("File could not be opened.\n");
return 0; return 0;
} }
char *buffer = (char *)calloc(MAX_BUFFER_SIZE, 1); char *buffer = (char *)calloc(MAX_BUFFER_SIZE, 1);
int count = 0; int count = 0;
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
{ {
// Read one full line // Read one full line
fgets(buffer, MAX_BUFFER_SIZE, rFile); fgets(buffer, MAX_BUFFER_SIZE, rFile);
if (buffer[0] == '/') fprintf(rxmlFile, " <!--%.*s -->\n", strlen(buffer) - 3, buffer + 2); if (buffer[0] == '/') fprintf(rxmlFile, " <!--%.*s -->\n", strlen(buffer) - 3, buffer + 2);
else if (buffer[0] == '\n') fprintf(rxmlFile, "%s", buffer); // Direct copy of code comments else if (buffer[0] == '\n') fprintf(rxmlFile, "%s", buffer); // Direct copy of code comments
else if (strncmp(buffer, "RLAPI", 5) == 0) // raylib function declaration else if (strncmp(buffer, "RLAPI", 5) == 0) // raylib function declaration
@ -65,33 +65,33 @@ int main(int argc, char *argv[])
char funcTypeAux[64]; char funcTypeAux[64];
char funcName[64]; char funcName[64];
char funcDesc[256]; char funcDesc[256];
char params[128]; char params[128];
char paramType[16][16]; char paramType[16][16];
char paramName[16][32]; char paramName[16][32];
int index = 0; int index = 0;
char *ptr = NULL; char *ptr = NULL;
sscanf(buffer, "RLAPI %s %[^(]s", funcType, funcName); sscanf(buffer, "RLAPI %s %[^(]s", funcType, funcName);
if (strcmp(funcType, "const") == 0) if (strcmp(funcType, "const") == 0)
{ {
sscanf(buffer, "RLAPI %s %s %[^(]s", funcType, funcTypeAux, funcName); sscanf(buffer, "RLAPI %s %s %[^(]s", funcType, funcTypeAux, funcName);
strcat(funcType, " "); strcat(funcType, " ");
strcat(funcType, funcTypeAux); strcat(funcType, funcTypeAux);
} }
ptr = strchr(buffer, '/'); ptr = strchr(buffer, '/');
index = (int)(ptr - buffer); index = (int)(ptr - buffer);
sscanf(buffer + index, "%[^\n]s", funcDesc); // Read function comment after declaration sscanf(buffer + index, "%[^\n]s", funcDesc); // Read function comment after declaration
ptr = strchr(buffer, '('); ptr = strchr(buffer, '(');
if (ptr != NULL) index = (int)(ptr - buffer); if (ptr != NULL) index = (int)(ptr - buffer);
else printf("Character not found!\n"); else printf("Character not found!\n");
sscanf(buffer + (index + 1), "%[^)]s", params); // Read what's inside '(' and ')' sscanf(buffer + (index + 1), "%[^)]s", params); // Read what's inside '(' and ')'
// Scan params string for number of func params, type and name // Scan params string for number of func params, type and name
@ -102,23 +102,23 @@ int main(int argc, char *argv[])
if ((funcName[0] == '*') && (funcName[1] == '*')) fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName + 2); if ((funcName[0] == '*') && (funcName[1] == '*')) fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName + 2);
else if (funcName[0] == '*') fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName + 1); else if (funcName[0] == '*') fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName + 1);
else fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName); else fprintf(rxmlFile, " <KeyWord name=\"%s\" func=\"yes\">\n", funcName);
fprintf(rxmlFile, " <Overload retVal=\"%s\" descr=\"%s\">", funcType, funcDesc + 3); fprintf(rxmlFile, " <Overload retVal=\"%s\" descr=\"%s\">", funcType, funcDesc + 3);
bool paramsVoid = false; bool paramsVoid = false;
char paramConst[8][16]; char paramConst[8][16];
while (paramPtr[paramsCount] != NULL) while (paramPtr[paramsCount] != NULL)
{ {
sscanf(paramPtr[paramsCount], "%s %s\n", paramType[paramsCount], paramName[paramsCount]); sscanf(paramPtr[paramsCount], "%s %s\n", paramType[paramsCount], paramName[paramsCount]);
if (strcmp(paramType[paramsCount], "void") == 0) if (strcmp(paramType[paramsCount], "void") == 0)
{ {
paramsVoid = true; paramsVoid = true;
break; break;
} }
if ((strcmp(paramType[paramsCount], "const") == 0) || (strcmp(paramType[paramsCount], "unsigned") == 0)) if ((strcmp(paramType[paramsCount], "const") == 0) || (strcmp(paramType[paramsCount], "unsigned") == 0))
{ {
sscanf(paramPtr[paramsCount], "%s %s %s\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount]); sscanf(paramPtr[paramsCount], "%s %s %s\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount]);
@ -130,17 +130,17 @@ int main(int argc, char *argv[])
paramsCount++; paramsCount++;
paramPtr[paramsCount] = strtok(NULL, ","); paramPtr[paramsCount] = strtok(NULL, ",");
} }
fprintf(rxmlFile, "%s</Overload>\n", paramsVoid ? "" : "\n "); fprintf(rxmlFile, "%s</Overload>\n", paramsVoid ? "" : "\n ");
fprintf(rxmlFile, " </KeyWord>\n"); fprintf(rxmlFile, " </KeyWord>\n");
count++; count++;
printf("Function processed %02i: %s\n", count, funcName); printf("Function processed %02i: %s\n", count, funcName);
memset(buffer, 0, MAX_BUFFER_SIZE); memset(buffer, 0, MAX_BUFFER_SIZE);
} }
} }
free(buffer); free(buffer);
fclose(rFile); fclose(rFile);
fclose(rxmlFile); fclose(rxmlFile);

View File

@ -2184,14 +2184,14 @@ void UpdateAudioStream(AudioStream stream, const void *data, int frameCount)
bool IsAudioStreamProcessed(AudioStream stream) bool IsAudioStreamProcessed(AudioStream stream)
{ {
bool result = false; bool result = false;
if (stream.buffer != NULL) if (stream.buffer != NULL)
{ {
ma_mutex_lock(&AUDIO.System.lock); ma_mutex_lock(&AUDIO.System.lock);
result = stream.buffer->isSubBufferProcessed[0] || stream.buffer->isSubBufferProcessed[1]; result = stream.buffer->isSubBufferProcessed[0] || stream.buffer->isSubBufferProcessed[1];
ma_mutex_unlock(&AUDIO.System.lock); ma_mutex_unlock(&AUDIO.System.lock);
} }
return result; return result;
} }
@ -2885,7 +2885,7 @@ static unsigned char *LoadFileData(const char *fileName, int *dataSize)
static bool SaveFileData(const char *fileName, void *data, int dataSize) static bool SaveFileData(const char *fileName, void *data, int dataSize)
{ {
bool result = true; bool result = true;
if (fileName != NULL) if (fileName != NULL)
{ {
FILE *file = fopen(fileName, "wb"); FILE *file = fopen(fileName, "wb");
@ -2919,7 +2919,7 @@ static bool SaveFileData(const char *fileName, void *data, int dataSize)
static bool SaveFileText(const char *fileName, char *text) static bool SaveFileText(const char *fileName, char *text)
{ {
bool result = true; bool result = true;
if (fileName != NULL) if (fileName != NULL)
{ {
FILE *file = fopen(fileName, "wt"); FILE *file = fopen(fileName, "wt");

View File

@ -1614,8 +1614,11 @@ void rlNormal3f(float x, float y, float z)
normalz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z; normalz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z;
} }
/* Normalize the vector if required. Default behavior assumes the normal vector is in the correct space for what the shader expects. // NOTE: Default behavior assumes the normal vector is in the correct space for what the shader expects,
float length = sqrtf(normalx * normalx + normaly * normaly + normalz * normalz); // it could be not normalized to 0.0f..1.0f, magnitud can be useed for some effects
/*
// WARNING: Vector normalization if required
float length = sqrtf(normalx*normalx + normaly*normaly + normalz*normalz);
if (length != 0.0f) if (length != 0.0f)
{ {
float ilength = 1.0f/length; float ilength = 1.0f/length;
@ -1623,7 +1626,7 @@ void rlNormal3f(float x, float y, float z)
normaly *= ilength; normaly *= ilength;
normalz *= ilength; normalz *= ilength;
} }
*/ */
RLGL.State.normalx = normalx; RLGL.State.normalx = normalx;
RLGL.State.normaly = normaly; RLGL.State.normaly = normaly;
RLGL.State.normalz = normalz; RLGL.State.normalz = normalz;

View File

@ -2440,7 +2440,7 @@ bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2
float dx2 = (p1.x - (dotProduct*(dx))) - center.x; float dx2 = (p1.x - (dotProduct*(dx))) - center.x;
float dy2 = (p1.y - (dotProduct*(dy))) - center.y; float dy2 = (p1.y - (dotProduct*(dy))) - center.y;
float distanceSQ = ((dx2*dx2) + (dy2*dy2)); float distanceSQ = ((dx2*dx2) + (dy2*dy2));
if (distanceSQ <= radius*radius) collision = true; if (distanceSQ <= radius*radius) collision = true;
} }

View File

@ -1785,7 +1785,7 @@ char *TextReplace(const char *text, const char *search, const char *replacement)
// Count the number of replacements needed // Count the number of replacements needed
insertPoint = (char *)text; insertPoint = (char *)text;
for (count = 0; (tempPtr = strstr(insertPoint, search)); count++) insertPoint = tempPtr + searchLen; for (count = 0; (tempPtr = strstr(insertPoint, search)); count++) insertPoint = tempPtr + searchLen;
if ((textLen + count*(replaceLen - searchLen)) < (MAX_TEXT_BUFFER_LENGTH - 1)) if ((textLen + count*(replaceLen - searchLen)) < (MAX_TEXT_BUFFER_LENGTH - 1))
{ {
// TODO: Allow copying data replaced up to maximum buffer size and stop // TODO: Allow copying data replaced up to maximum buffer size and stop
@ -1971,7 +1971,7 @@ char *TextInsert(const char *text, const char *insert, int position)
{ {
int textLen = TextLength(text); int textLen = TextLength(text);
int insertLen = TextLength(insert); int insertLen = TextLength(insert);
if ((textLen + insertLen) < (MAX_TEXT_BUFFER_LENGTH - 1)) if ((textLen + insertLen) < (MAX_TEXT_BUFFER_LENGTH - 1))
{ {
// TODO: Allow copying data inserted up to maximum buffer size and stop // TODO: Allow copying data inserted up to maximum buffer size and stop

View File

@ -1572,13 +1572,13 @@ int main(int argc, char *argv[])
" SaveFileText(\"outputLogFileName\", logText);\n" " SaveFileText(\"outputLogFileName\", logText);\n"
" emscripten_run_script(\"saveFileFromMEMFSToDisk('outputLogFileName','outputLogFileName')\");\n\n" " emscripten_run_script(\"saveFileFromMEMFSToDisk('outputLogFileName','outputLogFileName')\");\n\n"
" return 0"; " return 0";
char *returnReplaceTextUpdated = TextReplacEx(returnReplaceText, "outputLogFileName", TextFormat("%s.log", exName)); char *returnReplaceTextUpdated = TextReplaceAlloc(returnReplaceText, "outputLogFileName", TextFormat("%s.log", exName));
char *srcTextUpdated[4] = { 0 }; char *srcTextUpdated[4] = { 0 };
srcTextUpdated[0] = TextReplacEx(srcText, "int main(void)\n{", mainReplaceText); srcTextUpdated[0] = TextReplaceAlloc(srcText, "int main(void)\n{", mainReplaceText);
srcTextUpdated[1] = TextReplacEx(srcTextUpdated[0], "WindowShouldClose()", "WindowShouldClose() && (testFramesCount < requestedTestFrames)"); srcTextUpdated[1] = TextReplaceAlloc(srcTextUpdated[0], "WindowShouldClose()", "WindowShouldClose() && (testFramesCount < requestedTestFrames)");
srcTextUpdated[2] = TextReplacEx(srcTextUpdated[1], "EndDrawing();", "EndDrawing(); testFramesCount++;"); srcTextUpdated[2] = TextReplaceAlloc(srcTextUpdated[1], "EndDrawing();", "EndDrawing(); testFramesCount++;");
srcTextUpdated[3] = TextReplacEx(srcTextUpdated[2], " return 0", returnReplaceTextUpdated); srcTextUpdated[3] = TextReplaceAlloc(srcTextUpdated[2], " return 0", returnReplaceTextUpdated);
MemFree(returnReplaceTextUpdated); MemFree(returnReplaceTextUpdated);
UnloadFileText(srcText); UnloadFileText(srcText);
@ -1628,9 +1628,9 @@ int main(int argc, char *argv[])
" if ((argc > 1) && (argc == 3) && (strcmp(argv[1], \"--frames\") != 0)) requestedTestFrames = atoi(argv[2]);\n"; " if ((argc > 1) && (argc == 3) && (strcmp(argv[1], \"--frames\") != 0)) requestedTestFrames = atoi(argv[2]);\n";
char *srcTextUpdated[3] = { 0 }; char *srcTextUpdated[3] = { 0 };
srcTextUpdated[0] = TextReplacEx(srcText, "int main(void)\n{", mainReplaceText); srcTextUpdated[0] = TextReplaceAlloc(srcText, "int main(void)\n{", mainReplaceText);
srcTextUpdated[1] = TextReplacEx(srcTextUpdated[0], "WindowShouldClose()", "WindowShouldClose() && (testFramesCount < requestedTestFrames)"); srcTextUpdated[1] = TextReplaceAlloc(srcTextUpdated[0], "WindowShouldClose()", "WindowShouldClose() && (testFramesCount < requestedTestFrames)");
srcTextUpdated[2] = TextReplacEx(srcTextUpdated[1], "EndDrawing();", "EndDrawing(); testFramesCount++;"); srcTextUpdated[2] = TextReplaceAlloc(srcTextUpdated[1], "EndDrawing();", "EndDrawing(); testFramesCount++;");
UnloadFileText(srcText); UnloadFileText(srcText);
SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), srcTextUpdated[2]); SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), srcTextUpdated[2]);
@ -2037,8 +2037,10 @@ static int UpdateRequiredFiles(void)
// In this case, we focus on web building for: glsl100 // In this case, we focus on web building for: glsl100
if (TextFindIndex(resPaths[r], "glsl%i") > -1) if (TextFindIndex(resPaths[r], "glsl%i") > -1)
{ {
char *resPathUpdated = TextReplaceAlloc(resPaths[r], "glsl%i", "glsl100");
memset(resPaths[r], 0, 256); memset(resPaths[r], 0, 256);
strcpy(resPaths[r], TextReplace(resPaths[r], "glsl%i", "glsl100")); strcpy(resPaths[r], resPathUpdated);
RL_FREE(resPathUpdated);
} }
if (r < (resPathCount - 1)) if (r < (resPathCount - 1))
@ -2140,7 +2142,7 @@ static int UpdateRequiredFiles(void)
{ {
mdIndex += sprintf(mdTextUpdated + mdListStartIndex + mdIndex, TextFormat("\n### category: shaders [%i]\n\n", exCollectionCount)); mdIndex += sprintf(mdTextUpdated + mdListStartIndex + mdIndex, TextFormat("\n### category: shaders [%i]\n\n", exCollectionCount));
mdIndex += sprintf(mdTextUpdated + mdListStartIndex + mdIndex, mdIndex += sprintf(mdTextUpdated + mdListStartIndex + mdIndex,
"Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module.\n\n"); "Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.h) module.\n\n");
} }
else if (i == 6) // "audio" else if (i == 6) // "audio"
{ {
@ -2903,14 +2905,14 @@ static void UpdateWebMetadata(const char *exHtmlPath, const char *exFilePath)
UnloadFileText(exText); UnloadFileText(exText);
// Update example.html required text // Update example.html required text
exHtmlTextUpdated[0] = TextReplace(exHtmlText, "raylib web game", exTitle); exHtmlTextUpdated[0] = TextReplaceAlloc(exHtmlText, "raylib web game", exTitle);
exHtmlTextUpdated[1] = TextReplace(exHtmlTextUpdated[0], "New raylib web videogame, developed using raylib videogames library", exDescription); exHtmlTextUpdated[1] = TextReplaceAlloc(exHtmlTextUpdated[0], "New raylib web videogame, developed using raylib videogames library", exDescription);
exHtmlTextUpdated[2] = TextReplace(exHtmlTextUpdated[1], "https://www.raylib.com/common/raylib_logo.png", exHtmlTextUpdated[2] = TextReplaceAlloc(exHtmlTextUpdated[1], "https://www.raylib.com/common/raylib_logo.png",
TextFormat("https://raw.githubusercontent.com/raysan5/raylib/master/examples/%s/%s.png", exCategory, exName)); TextFormat("https://raw.githubusercontent.com/raysan5/raylib/master/examples/%s/%s.png", exCategory, exName));
exHtmlTextUpdated[3] = TextReplace(exHtmlTextUpdated[2], "https://www.raylib.com/games.html", exHtmlTextUpdated[3] = TextReplaceAlloc(exHtmlTextUpdated[2], "https://www.raylib.com/games.html",
TextFormat("https://www.raylib.com/examples/%s/%s.html", exCategory, exName)); TextFormat("https://www.raylib.com/examples/%s/%s.html", exCategory, exName));
exHtmlTextUpdated[4] = TextReplace(exHtmlTextUpdated[3], "raylib - example", TextFormat("raylib - %s", exName)); // og:site_name exHtmlTextUpdated[4] = TextReplaceAlloc(exHtmlTextUpdated[3], "raylib - example", TextFormat("raylib - %s", exName)); // og:site_name
exHtmlTextUpdated[5] = TextReplace(exHtmlTextUpdated[4], "https://github.com/raysan5/raylib", exHtmlTextUpdated[5] = TextReplaceAlloc(exHtmlTextUpdated[4], "https://github.com/raysan5/raylib",
TextFormat("https://github.com/raysan5/raylib/blob/master/examples/%s/%s.c", exCategory, exName)); TextFormat("https://github.com/raysan5/raylib/blob/master/examples/%s/%s.c", exCategory, exName));
SaveFileText(exHtmlPathCopy, exHtmlTextUpdated[5]); SaveFileText(exHtmlPathCopy, exHtmlTextUpdated[5]);

View File

@ -9,10 +9,10 @@
- struct AliasInfo - struct AliasInfo
- struct EnumInfo - struct EnumInfo
- struct FunctionInfo - struct FunctionInfo
WARNING: This parser is specifically designed to work with raylib.h, and has some contraints WARNING: This parser is specifically designed to work with raylib.h, and has some contraints
in that regards. Still, it can also work with other header files that follow same file structure in that regards. Still, it can also work with other header files that follow same file structure
conventions as raylib.h: rlgl.h, raymath.h, raygui.h, reasings.h conventions as raylib.h: rlgl.h, raymath.h, raygui.h, reasings.h
CONSTRAINTS: CONSTRAINTS:
This parser is specifically designed to work with raylib.h, so, it has some constraints: This parser is specifically designed to work with raylib.h, so, it has some constraints: