From 1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 Mon Sep 17 00:00:00 2001 From: Uneven Prankster Date: Sun, 15 Oct 2023 21:28:29 -0300 Subject: A lot has certainly happened! --- raylib/examples/models/resources/LICENSE.md | 22 +++++++++++++++ raylib/examples/models/resources/billboard.png | Bin 0 -> 22374 bytes raylib/examples/models/resources/cubicmap.png | Bin 0 -> 164 bytes .../examples/models/resources/cubicmap_atlas.png | Bin 0 -> 37160 bytes .../models/resources/dresden_square_1k.hdr | Bin 0 -> 1524733 bytes .../models/resources/dresden_square_2k.hdr | Bin 0 -> 6019615 bytes raylib/examples/models/resources/heightmap.png | Bin 0 -> 10883 bytes .../examples/models/resources/models/gltf/LICENSE | 2 ++ .../resources/models/gltf/raylib_logo_3d.glb | Bin 0 -> 266724 bytes .../models/resources/models/gltf/robot.blend | Bin 0 -> 2107372 bytes .../models/resources/models/gltf/robot.glb | Bin 0 -> 1602604 bytes .../examples/models/resources/models/iqm/guy.blend | Bin 0 -> 665304 bytes .../examples/models/resources/models/iqm/guy.iqm | Bin 0 -> 39408 bytes .../models/resources/models/iqm/guyanim.iqm | Bin 0 -> 18244 bytes .../models/resources/models/iqm/guytex.png | Bin 0 -> 301935 bytes .../models/resources/models/m3d/cesium_man.m3d | Bin 0 -> 73844 bytes .../models/resources/models/m3d/seagull.m3d | Bin 0 -> 10263 bytes .../models/resources/models/m3d/suzanne.m3d | Bin 0 -> 11645 bytes .../models/resources/models/obj/bridge_diffuse.png | Bin 0 -> 318466 bytes .../models/resources/models/obj/castle_diffuse.png | Bin 0 -> 444213 bytes .../models/resources/models/obj/cube_diffuse.png | Bin 0 -> 23330 bytes .../models/resources/models/obj/house_diffuse.png | Bin 0 -> 392528 bytes .../models/resources/models/obj/market_diffuse.png | Bin 0 -> 389458 bytes .../models/resources/models/obj/plane_diffuse.png | Bin 0 -> 823493 bytes .../models/resources/models/obj/turret_diffuse.png | Bin 0 -> 380120 bytes .../models/resources/models/obj/well_diffuse.png | Bin 0 -> 342387 bytes .../examples/models/resources/models/vox/LICENSE | 9 ++++++ .../models/resources/models/vox/chr_knight.vox | Bin 0 -> 31031 bytes .../models/resources/models/vox/chr_sword.vox | Bin 0 -> 30775 bytes .../examples/models/resources/models/vox/monu9.vox | Bin 0 -> 160767 bytes .../models/resources/shaders/glsl100/cubemap.fs | 29 +++++++++++++++++++ .../models/resources/shaders/glsl100/cubemap.vs | 20 +++++++++++++ .../models/resources/shaders/glsl100/skybox.fs | 31 +++++++++++++++++++++ .../models/resources/shaders/glsl100/skybox.vs | 24 ++++++++++++++++ .../models/resources/shaders/glsl330/cubemap.fs | 30 ++++++++++++++++++++ .../models/resources/shaders/glsl330/cubemap.vs | 20 +++++++++++++ .../models/resources/shaders/glsl330/skybox.fs | 30 ++++++++++++++++++++ .../models/resources/shaders/glsl330/skybox.vs | 24 ++++++++++++++++ raylib/examples/models/resources/skybox.png | Bin 0 -> 10992 bytes 39 files changed, 241 insertions(+) create mode 100644 raylib/examples/models/resources/LICENSE.md create mode 100644 raylib/examples/models/resources/billboard.png create mode 100644 raylib/examples/models/resources/cubicmap.png create mode 100644 raylib/examples/models/resources/cubicmap_atlas.png create mode 100644 raylib/examples/models/resources/dresden_square_1k.hdr create mode 100644 raylib/examples/models/resources/dresden_square_2k.hdr create mode 100644 raylib/examples/models/resources/heightmap.png create mode 100644 raylib/examples/models/resources/models/gltf/LICENSE create mode 100644 raylib/examples/models/resources/models/gltf/raylib_logo_3d.glb create mode 100644 raylib/examples/models/resources/models/gltf/robot.blend create mode 100644 raylib/examples/models/resources/models/gltf/robot.glb create mode 100644 raylib/examples/models/resources/models/iqm/guy.blend create mode 100644 raylib/examples/models/resources/models/iqm/guy.iqm create mode 100644 raylib/examples/models/resources/models/iqm/guyanim.iqm create mode 100644 raylib/examples/models/resources/models/iqm/guytex.png create mode 100644 raylib/examples/models/resources/models/m3d/cesium_man.m3d create mode 100644 raylib/examples/models/resources/models/m3d/seagull.m3d create mode 100644 raylib/examples/models/resources/models/m3d/suzanne.m3d create mode 100644 raylib/examples/models/resources/models/obj/bridge_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/castle_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/cube_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/house_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/market_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/plane_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/turret_diffuse.png create mode 100644 raylib/examples/models/resources/models/obj/well_diffuse.png create mode 100644 raylib/examples/models/resources/models/vox/LICENSE create mode 100644 raylib/examples/models/resources/models/vox/chr_knight.vox create mode 100644 raylib/examples/models/resources/models/vox/chr_sword.vox create mode 100644 raylib/examples/models/resources/models/vox/monu9.vox create mode 100644 raylib/examples/models/resources/shaders/glsl100/cubemap.fs create mode 100644 raylib/examples/models/resources/shaders/glsl100/cubemap.vs create mode 100644 raylib/examples/models/resources/shaders/glsl100/skybox.fs create mode 100644 raylib/examples/models/resources/shaders/glsl100/skybox.vs create mode 100644 raylib/examples/models/resources/shaders/glsl330/cubemap.fs create mode 100644 raylib/examples/models/resources/shaders/glsl330/cubemap.vs create mode 100644 raylib/examples/models/resources/shaders/glsl330/skybox.fs create mode 100644 raylib/examples/models/resources/shaders/glsl330/skybox.vs create mode 100644 raylib/examples/models/resources/skybox.png (limited to 'raylib/examples/models/resources') diff --git a/raylib/examples/models/resources/LICENSE.md b/raylib/examples/models/resources/LICENSE.md new file mode 100644 index 0000000..d7f85c0 --- /dev/null +++ b/raylib/examples/models/resources/LICENSE.md @@ -0,0 +1,22 @@ +| resource | author | licence | notes | +| :------------------- | :---------: | :------ | :---- | +| models/obj/castle.obj,
models/obj/castle_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/bridge.obj,
models/obj/bridge_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/house.obj,
models/obj/house_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/market.obj,
models/obj/market_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/turret.obj,
models/obj/turret_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/well.obj,
models/obj/well_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - | +| models/obj/cube.obj,
models/obj/cube_diffuse.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| models/obj/plane.obj,
models/obj/plane_diffuse.png | [GiaHanLam](https://sketchfab.com/GiaHanLam) | [CC-BY](https://creativecommons.org/licenses/by/4.0/) | Used by: [`models_yaw_pitch_roll.c`](https://github.com/raysan5/raylib/blob/master/examples/models/models_yaw_pitch_roll.c) +| models/iqm/guy.iqm,
models/iqm/guyanim.iqm,
models/iqm/guytex.png,
models/iqm/guy.blend | [@culacant](https://github.com/culacant) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| models/gltf/robot.glb,
models/gltf/robot.blend | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| models/vox/chr_knight.vox | ❔ | ❔ | - | +| models/vox/chr_sword.vox | ❔ | ❔ | - | +| models/vox/monu9.vox | ❔ | ❔ | - | +| billboard.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| cubicmap_atlas.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| heightmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | +| dresden_square_1k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - | +| dresden_square_2k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - | +| skybox.png | ❔ | ❔ | - | \ No newline at end of file diff --git a/raylib/examples/models/resources/billboard.png b/raylib/examples/models/resources/billboard.png new file mode 100644 index 0000000..8c99118 Binary files /dev/null and b/raylib/examples/models/resources/billboard.png differ diff --git a/raylib/examples/models/resources/cubicmap.png b/raylib/examples/models/resources/cubicmap.png new file mode 100644 index 0000000..392dbf2 Binary files /dev/null and b/raylib/examples/models/resources/cubicmap.png differ diff --git a/raylib/examples/models/resources/cubicmap_atlas.png b/raylib/examples/models/resources/cubicmap_atlas.png new file mode 100644 index 0000000..9fc404a Binary files /dev/null and b/raylib/examples/models/resources/cubicmap_atlas.png differ diff --git a/raylib/examples/models/resources/dresden_square_1k.hdr b/raylib/examples/models/resources/dresden_square_1k.hdr new file mode 100644 index 0000000..b6d0e77 Binary files /dev/null and b/raylib/examples/models/resources/dresden_square_1k.hdr differ diff --git a/raylib/examples/models/resources/dresden_square_2k.hdr b/raylib/examples/models/resources/dresden_square_2k.hdr new file mode 100644 index 0000000..60b4a4c Binary files /dev/null and b/raylib/examples/models/resources/dresden_square_2k.hdr differ diff --git a/raylib/examples/models/resources/heightmap.png b/raylib/examples/models/resources/heightmap.png new file mode 100644 index 0000000..474db87 Binary files /dev/null and b/raylib/examples/models/resources/heightmap.png differ diff --git a/raylib/examples/models/resources/models/gltf/LICENSE b/raylib/examples/models/resources/models/gltf/LICENSE new file mode 100644 index 0000000..3c9a38d --- /dev/null +++ b/raylib/examples/models/resources/models/gltf/LICENSE @@ -0,0 +1,2 @@ +robot.glb model by @Quaternius (https://www.patreon.com/quaternius) +Licensed under CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file diff --git a/raylib/examples/models/resources/models/gltf/raylib_logo_3d.glb b/raylib/examples/models/resources/models/gltf/raylib_logo_3d.glb new file mode 100644 index 0000000..4fc56ad Binary files /dev/null and b/raylib/examples/models/resources/models/gltf/raylib_logo_3d.glb differ diff --git a/raylib/examples/models/resources/models/gltf/robot.blend b/raylib/examples/models/resources/models/gltf/robot.blend new file mode 100644 index 0000000..efe43c5 Binary files /dev/null and b/raylib/examples/models/resources/models/gltf/robot.blend differ diff --git a/raylib/examples/models/resources/models/gltf/robot.glb b/raylib/examples/models/resources/models/gltf/robot.glb new file mode 100644 index 0000000..549011e Binary files /dev/null and b/raylib/examples/models/resources/models/gltf/robot.glb differ diff --git a/raylib/examples/models/resources/models/iqm/guy.blend b/raylib/examples/models/resources/models/iqm/guy.blend new file mode 100644 index 0000000..3880467 Binary files /dev/null and b/raylib/examples/models/resources/models/iqm/guy.blend differ diff --git a/raylib/examples/models/resources/models/iqm/guy.iqm b/raylib/examples/models/resources/models/iqm/guy.iqm new file mode 100644 index 0000000..36bed5e Binary files /dev/null and b/raylib/examples/models/resources/models/iqm/guy.iqm differ diff --git a/raylib/examples/models/resources/models/iqm/guyanim.iqm b/raylib/examples/models/resources/models/iqm/guyanim.iqm new file mode 100644 index 0000000..824a68a Binary files /dev/null and b/raylib/examples/models/resources/models/iqm/guyanim.iqm differ diff --git a/raylib/examples/models/resources/models/iqm/guytex.png b/raylib/examples/models/resources/models/iqm/guytex.png new file mode 100644 index 0000000..05a58ee Binary files /dev/null and b/raylib/examples/models/resources/models/iqm/guytex.png differ diff --git a/raylib/examples/models/resources/models/m3d/cesium_man.m3d b/raylib/examples/models/resources/models/m3d/cesium_man.m3d new file mode 100644 index 0000000..ddf9f50 Binary files /dev/null and b/raylib/examples/models/resources/models/m3d/cesium_man.m3d differ diff --git a/raylib/examples/models/resources/models/m3d/seagull.m3d b/raylib/examples/models/resources/models/m3d/seagull.m3d new file mode 100644 index 0000000..8236820 Binary files /dev/null and b/raylib/examples/models/resources/models/m3d/seagull.m3d differ diff --git a/raylib/examples/models/resources/models/m3d/suzanne.m3d b/raylib/examples/models/resources/models/m3d/suzanne.m3d new file mode 100644 index 0000000..9bc64d7 Binary files /dev/null and b/raylib/examples/models/resources/models/m3d/suzanne.m3d differ diff --git a/raylib/examples/models/resources/models/obj/bridge_diffuse.png b/raylib/examples/models/resources/models/obj/bridge_diffuse.png new file mode 100644 index 0000000..45a86b5 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/bridge_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/castle_diffuse.png b/raylib/examples/models/resources/models/obj/castle_diffuse.png new file mode 100644 index 0000000..c7085a3 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/castle_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/cube_diffuse.png b/raylib/examples/models/resources/models/obj/cube_diffuse.png new file mode 100644 index 0000000..6becd47 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/cube_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/house_diffuse.png b/raylib/examples/models/resources/models/obj/house_diffuse.png new file mode 100644 index 0000000..b36a58a Binary files /dev/null and b/raylib/examples/models/resources/models/obj/house_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/market_diffuse.png b/raylib/examples/models/resources/models/obj/market_diffuse.png new file mode 100644 index 0000000..3ad3046 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/market_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/plane_diffuse.png b/raylib/examples/models/resources/models/obj/plane_diffuse.png new file mode 100644 index 0000000..07371c0 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/plane_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/turret_diffuse.png b/raylib/examples/models/resources/models/obj/turret_diffuse.png new file mode 100644 index 0000000..33628e3 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/turret_diffuse.png differ diff --git a/raylib/examples/models/resources/models/obj/well_diffuse.png b/raylib/examples/models/resources/models/obj/well_diffuse.png new file mode 100644 index 0000000..f8f6686 Binary files /dev/null and b/raylib/examples/models/resources/models/obj/well_diffuse.png differ diff --git a/raylib/examples/models/resources/models/vox/LICENSE b/raylib/examples/models/resources/models/vox/LICENSE new file mode 100644 index 0000000..afb6608 --- /dev/null +++ b/raylib/examples/models/resources/models/vox/LICENSE @@ -0,0 +1,9 @@ +The following models are provided by the official github repo of voxel-model format by MagikaVoxel developer @ephtracy + +GitHub official repo: https://github.com/ephtracy/voxel-model + + - chr_knight.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_knight.vox + - chr_sword.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_sword.vox + - monu9.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/monument/monu9.vox + +Worth mentioning there is no license specified for the models yet: https://github.com/ephtracy/voxel-model/issues/22 diff --git a/raylib/examples/models/resources/models/vox/chr_knight.vox b/raylib/examples/models/resources/models/vox/chr_knight.vox new file mode 100644 index 0000000..c921bf5 Binary files /dev/null and b/raylib/examples/models/resources/models/vox/chr_knight.vox differ diff --git a/raylib/examples/models/resources/models/vox/chr_sword.vox b/raylib/examples/models/resources/models/vox/chr_sword.vox new file mode 100644 index 0000000..05fc482 Binary files /dev/null and b/raylib/examples/models/resources/models/vox/chr_sword.vox differ diff --git a/raylib/examples/models/resources/models/vox/monu9.vox b/raylib/examples/models/resources/models/vox/monu9.vox new file mode 100644 index 0000000..fd77111 Binary files /dev/null and b/raylib/examples/models/resources/models/vox/monu9.vox differ diff --git a/raylib/examples/models/resources/shaders/glsl100/cubemap.fs b/raylib/examples/models/resources/shaders/glsl100/cubemap.fs new file mode 100644 index 0000000..7d1bde0 --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl100/cubemap.fs @@ -0,0 +1,29 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; + +// Input uniform values +uniform sampler2D equirectangularMap; + +vec2 SampleSphericalMap(vec3 v) +{ + vec2 uv = vec2(atan(v.z, v.x), asin(v.y)); + uv *= vec2(0.1591, 0.3183); + uv += 0.5; + return uv; +} + +void main() +{ + // Normalize local position + vec2 uv = SampleSphericalMap(normalize(fragPosition)); + + // Fetch color from texture map + vec3 color = texture2D(equirectangularMap, uv).rgb; + + // Calculate final fragment color + gl_FragColor = vec4(color, 1.0); +} diff --git a/raylib/examples/models/resources/shaders/glsl100/cubemap.vs b/raylib/examples/models/resources/shaders/glsl100/cubemap.vs new file mode 100644 index 0000000..6f486fb --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl100/cubemap.vs @@ -0,0 +1,20 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Calculate final vertex position + gl_Position = matProjection*matView*vec4(vertexPosition, 1.0); +} diff --git a/raylib/examples/models/resources/shaders/glsl100/skybox.fs b/raylib/examples/models/resources/shaders/glsl100/skybox.fs new file mode 100644 index 0000000..0ea6876 --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl100/skybox.fs @@ -0,0 +1,31 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; + +// Input uniform values +uniform samplerCube environmentMap; +uniform bool vflipped; +uniform bool doGamma; + +void main() +{ + // Fetch color from texture map + vec4 texelColor = vec4(0.0); + + if (vflipped) texelColor = textureCube(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)); + else texelColor = textureCube(environmentMap, fragPosition); + + vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z); + + if (doGamma) // Apply gamma correction + { + color = color/(color + vec3(1.0)); + color = pow(color, vec3(1.0/2.2)); + } + + // Calculate final fragment color + gl_FragColor = vec4(color, 1.0); +} diff --git a/raylib/examples/models/resources/shaders/glsl100/skybox.vs b/raylib/examples/models/resources/shaders/glsl100/skybox.vs new file mode 100644 index 0000000..e440ace --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl100/skybox.vs @@ -0,0 +1,24 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Remove translation from the view matrix + mat4 rotView = mat4(mat3(matView)); + vec4 clipPos = matProjection*rotView*vec4(vertexPosition, 1.0); + + // Calculate final vertex position + gl_Position = clipPos; +} diff --git a/raylib/examples/models/resources/shaders/glsl330/cubemap.fs b/raylib/examples/models/resources/shaders/glsl330/cubemap.fs new file mode 100644 index 0000000..f59003f --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl330/cubemap.fs @@ -0,0 +1,30 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in 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)); + uv *= vec2(0.1591, 0.3183); + uv += 0.5; + return uv; +} + +void main() +{ + // Normalize local position + vec2 uv = SampleSphericalMap(normalize(fragPosition)); + + // Fetch color from texture map + vec3 color = texture(equirectangularMap, uv).rgb; + + // Calculate final fragment color + finalColor = vec4(color, 1.0); +} diff --git a/raylib/examples/models/resources/shaders/glsl330/cubemap.vs b/raylib/examples/models/resources/shaders/glsl330/cubemap.vs new file mode 100644 index 0000000..d71f808 --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl330/cubemap.vs @@ -0,0 +1,20 @@ +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +out vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Calculate final vertex position + gl_Position = matProjection*matView*vec4(vertexPosition, 1.0); +} diff --git a/raylib/examples/models/resources/shaders/glsl330/skybox.fs b/raylib/examples/models/resources/shaders/glsl330/skybox.fs new file mode 100644 index 0000000..d71fef0 --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl330/skybox.fs @@ -0,0 +1,30 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec3 fragPosition; + +// Input uniform values +uniform samplerCube environmentMap; +uniform bool vflipped; +uniform bool doGamma; + +// Output fragment color +out vec4 finalColor; + +void main() +{ + // Fetch color from texture map + vec3 color = vec3(0.0); + + if (vflipped) color = texture(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb; + else color = texture(environmentMap, fragPosition).rgb; + + if (doGamma)// 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); +} diff --git a/raylib/examples/models/resources/shaders/glsl330/skybox.vs b/raylib/examples/models/resources/shaders/glsl330/skybox.vs new file mode 100644 index 0000000..f41d469 --- /dev/null +++ b/raylib/examples/models/resources/shaders/glsl330/skybox.vs @@ -0,0 +1,24 @@ +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +out vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Remove translation from the view matrix + mat4 rotView = mat4(mat3(matView)); + vec4 clipPos = matProjection*rotView*vec4(vertexPosition, 1.0); + + // Calculate final vertex position + gl_Position = clipPos; +} diff --git a/raylib/examples/models/resources/skybox.png b/raylib/examples/models/resources/skybox.png new file mode 100644 index 0000000..36a79b2 Binary files /dev/null and b/raylib/examples/models/resources/skybox.png differ -- cgit v1.2.3