convert submodules to normal folders for now
22
raylib/examples/models/resources/LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
| resource | author | licence | notes |
|
||||
| :------------------- | :---------: | :------ | :---- |
|
||||
| models/obj/castle.obj,<br>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,<br>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,<br>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,<br>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,<br>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,<br>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,<br>models/obj/cube_diffuse.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/obj/plane.obj,<br>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,<br>models/iqm/guyanim.iqm,<br>models/iqm/guytex.png,<br>models/iqm/guy.blend | [@culacant](https://github.com/culacant) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/gltf/robot.glb,<br>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 | ❔ | ❔ | - |
|
||||
BIN
raylib/examples/models/resources/billboard.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
raylib/examples/models/resources/cubicmap.png
Normal file
|
After Width: | Height: | Size: 164 B |
BIN
raylib/examples/models/resources/cubicmap_atlas.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
raylib/examples/models/resources/dresden_square_1k.hdr
Normal file
BIN
raylib/examples/models/resources/dresden_square_2k.hdr
Normal file
BIN
raylib/examples/models/resources/heightmap.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
5
raylib/examples/models/resources/models/gltf/LICENSE
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
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/)
|
||||
|
||||
greenman.glb, greenman_hat.glb, greenman_sword.glb, greenman_shield.glb models by @iP (https://github.com/ipzaur)
|
||||
Licensed under CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
BIN
raylib/examples/models/resources/models/gltf/greenman.glb
Normal file
BIN
raylib/examples/models/resources/models/gltf/greenman_hat.glb
Normal file
BIN
raylib/examples/models/resources/models/gltf/greenman_shield.glb
Normal file
BIN
raylib/examples/models/resources/models/gltf/greenman_sword.glb
Normal file
BIN
raylib/examples/models/resources/models/gltf/raylib_logo_3d.glb
Normal file
BIN
raylib/examples/models/resources/models/gltf/robot.blend
Normal file
BIN
raylib/examples/models/resources/models/gltf/robot.glb
Normal file
BIN
raylib/examples/models/resources/models/iqm/guy.blend
Normal file
BIN
raylib/examples/models/resources/models/iqm/guy.iqm
Normal file
BIN
raylib/examples/models/resources/models/iqm/guyanim.iqm
Normal file
BIN
raylib/examples/models/resources/models/iqm/guytex.png
Normal file
|
After Width: | Height: | Size: 295 KiB |
BIN
raylib/examples/models/resources/models/m3d/cesium_man.m3d
Normal file
BIN
raylib/examples/models/resources/models/m3d/seagull.m3d
Normal file
BIN
raylib/examples/models/resources/models/m3d/suzanne.m3d
Normal file
1725
raylib/examples/models/resources/models/obj/bridge.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/bridge_diffuse.png
Normal file
|
After Width: | Height: | Size: 311 KiB |
12919
raylib/examples/models/resources/models/obj/castle.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/castle_diffuse.png
Normal file
|
After Width: | Height: | Size: 434 KiB |
68
raylib/examples/models/resources/models/obj/cube.obj
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# reference material
|
||||
#mtllib cube.mtl
|
||||
|
||||
# object box
|
||||
|
||||
# vertex (XZY)
|
||||
v 5.5 0 1.5
|
||||
v 8.5 0 1.5
|
||||
v 5.5 0 -1.5
|
||||
v 8.5 0 -1.5
|
||||
v 5.5 3 1.5
|
||||
v 8.5 3 1.5
|
||||
v 5.5 3 -1.5
|
||||
v 8.5 3 -1.5
|
||||
|
||||
# normals (XYZ)
|
||||
vn 0 -1 0
|
||||
vn 0 1 0
|
||||
vn 0 0 1
|
||||
vn 1 0 0
|
||||
vn 0 0 -1
|
||||
vn -1 0 0
|
||||
|
||||
# UVs (XY)
|
||||
vt 0.5 0 0
|
||||
vt 1 0 0
|
||||
vt 1 0.5 0
|
||||
vt 0.5 0.5 0
|
||||
vt 0.5 0.5 0
|
||||
vt 1 0.5 0
|
||||
vt 0.5 1 0
|
||||
vt 1 1 0
|
||||
vt 0 0.5 0
|
||||
vt 1 0.5 0
|
||||
vt 1 0 0
|
||||
vt 0 0 0
|
||||
vt 0 0.5 0
|
||||
vt 1 0.5 0
|
||||
vt 1 1 0
|
||||
vt 0 1 0
|
||||
vt 0.5 0 0
|
||||
vt 0 0 0
|
||||
vt 0 0.5 0
|
||||
vt 0.5 0.5 0
|
||||
vt 0 0.5 0
|
||||
vt 0.5 0.5 0
|
||||
vt 0.5 1 0
|
||||
vt 0 1 0
|
||||
|
||||
# merger
|
||||
g box
|
||||
|
||||
# reference material
|
||||
#usemtl mat01
|
||||
|
||||
# faces
|
||||
f 1/9/1 3/10/1 4/11/1
|
||||
f 4/11/1 2/12/1 1/9/1
|
||||
f 5/13/2 6/14/2 8/15/2
|
||||
f 8/15/2 7/16/2 5/13/2
|
||||
f 1/17/6 2/18/6 6/19/6
|
||||
f 6/19/6 5/20/6 1/17/6
|
||||
f 2/6/1 4/5/1 8/7/1
|
||||
f 8/7/1 6/8/1 2/6/1
|
||||
f 4/2/3 3/1/3 7/4/3
|
||||
f 7/4/3 8/3/3 4/2/3
|
||||
f 3/22/5 1/21/5 5/24/5
|
||||
f 5/24/5 7/23/5 3/22/5
|
||||
BIN
raylib/examples/models/resources/models/obj/cube_diffuse.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
4564
raylib/examples/models/resources/models/obj/house.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/house_diffuse.png
Normal file
|
After Width: | Height: | Size: 383 KiB |
7301
raylib/examples/models/resources/models/obj/market.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/market_diffuse.png
Normal file
|
After Width: | Height: | Size: 380 KiB |
10858
raylib/examples/models/resources/models/obj/plane.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/plane_diffuse.png
Normal file
|
After Width: | Height: | Size: 804 KiB |
1888
raylib/examples/models/resources/models/obj/turret.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/turret_diffuse.png
Normal file
|
After Width: | Height: | Size: 371 KiB |
1030
raylib/examples/models/resources/models/obj/well.obj
Normal file
BIN
raylib/examples/models/resources/models/obj/well_diffuse.png
Normal file
|
After Width: | Height: | Size: 334 KiB |
9
raylib/examples/models/resources/models/vox/LICENSE
Normal file
|
|
@ -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
|
||||
BIN
raylib/examples/models/resources/models/vox/chr_knight.vox
Normal file
BIN
raylib/examples/models/resources/models/vox/chr_sword.vox
Normal file
BIN
raylib/examples/models/resources/models/vox/fez.vox
Normal file
BIN
raylib/examples/models/resources/models/vox/monu9.vox
Normal file
29
raylib/examples/models/resources/shaders/glsl100/cubemap.fs
Normal file
|
|
@ -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);
|
||||
}
|
||||
20
raylib/examples/models/resources/shaders/glsl100/cubemap.vs
Normal file
|
|
@ -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);
|
||||
}
|
||||
20
raylib/examples/models/resources/shaders/glsl100/skinning.fs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#version 100
|
||||
|
||||
precision mediump float;
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Fetch color from texture sampler
|
||||
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||
|
||||
// Calculate final fragment color
|
||||
gl_FragColor = texelColor*colDiffuse*fragColor;
|
||||
}
|
||||
59
raylib/examples/models/resources/shaders/glsl100/skinning.vs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#version 100
|
||||
|
||||
#define MAX_BONE_NUM 64
|
||||
|
||||
// Input vertex attributes
|
||||
attribute vec3 vertexPosition;
|
||||
attribute vec2 vertexTexCoord;
|
||||
attribute vec4 vertexColor;
|
||||
attribute vec4 vertexBoneIds;
|
||||
attribute vec4 vertexBoneWeights;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
uniform mat4 boneMatrices[MAX_BONE_NUM];
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
int boneIndex0 = int(vertexBoneIds.x);
|
||||
int boneIndex1 = int(vertexBoneIds.y);
|
||||
int boneIndex2 = int(vertexBoneIds.z);
|
||||
int boneIndex3 = int(vertexBoneIds.w);
|
||||
|
||||
// WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function
|
||||
mat4 boneMatrixTransposed0 = mat4(
|
||||
vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x),
|
||||
vec4(boneMatrices[boneIndex0][0].y, boneMatrices[boneIndex0][1].y, boneMatrices[boneIndex0][2].y, boneMatrices[boneIndex0][3].y),
|
||||
vec4(boneMatrices[boneIndex0][0].z, boneMatrices[boneIndex0][1].z, boneMatrices[boneIndex0][2].z, boneMatrices[boneIndex0][3].z),
|
||||
vec4(boneMatrices[boneIndex0][0].w, boneMatrices[boneIndex0][1].w, boneMatrices[boneIndex0][2].w, boneMatrices[boneIndex0][3].w));
|
||||
mat4 boneMatrixTransposed1 = mat4(
|
||||
vec4(boneMatrices[boneIndex1][0].x, boneMatrices[boneIndex1][1].x, boneMatrices[boneIndex1][2].x, boneMatrices[boneIndex1][3].x),
|
||||
vec4(boneMatrices[boneIndex1][0].y, boneMatrices[boneIndex1][1].y, boneMatrices[boneIndex1][2].y, boneMatrices[boneIndex1][3].y),
|
||||
vec4(boneMatrices[boneIndex1][0].z, boneMatrices[boneIndex1][1].z, boneMatrices[boneIndex1][2].z, boneMatrices[boneIndex1][3].z),
|
||||
vec4(boneMatrices[boneIndex1][0].w, boneMatrices[boneIndex1][1].w, boneMatrices[boneIndex1][2].w, boneMatrices[boneIndex1][3].w));
|
||||
mat4 boneMatrixTransposed2 = mat4(
|
||||
vec4(boneMatrices[boneIndex2][0].x, boneMatrices[boneIndex2][1].x, boneMatrices[boneIndex2][2].x, boneMatrices[boneIndex2][3].x),
|
||||
vec4(boneMatrices[boneIndex2][0].y, boneMatrices[boneIndex2][1].y, boneMatrices[boneIndex2][2].y, boneMatrices[boneIndex2][3].y),
|
||||
vec4(boneMatrices[boneIndex2][0].z, boneMatrices[boneIndex2][1].z, boneMatrices[boneIndex2][2].z, boneMatrices[boneIndex2][3].z),
|
||||
vec4(boneMatrices[boneIndex2][0].w, boneMatrices[boneIndex2][1].w, boneMatrices[boneIndex2][2].w, boneMatrices[boneIndex2][3].w));
|
||||
mat4 boneMatrixTransposed3 = mat4(
|
||||
vec4(boneMatrices[boneIndex3][0].x, boneMatrices[boneIndex3][1].x, boneMatrices[boneIndex3][2].x, boneMatrices[boneIndex3][3].x),
|
||||
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].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w));
|
||||
|
||||
vec4 skinnedPosition =
|
||||
vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0));
|
||||
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
|
||||
gl_Position = mvp*skinnedPosition;
|
||||
}
|
||||
31
raylib/examples/models/resources/shaders/glsl100/skybox.fs
Normal file
|
|
@ -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);
|
||||
}
|
||||
24
raylib/examples/models/resources/shaders/glsl100/skybox.vs
Normal file
|
|
@ -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;
|
||||
}
|
||||
30
raylib/examples/models/resources/shaders/glsl330/cubemap.fs
Normal file
|
|
@ -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);
|
||||
}
|
||||
20
raylib/examples/models/resources/shaders/glsl330/cubemap.vs
Normal file
|
|
@ -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);
|
||||
}
|
||||
17
raylib/examples/models/resources/shaders/glsl330/skinning.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
finalColor = texelColor*colDiffuse*fragColor;
|
||||
}
|
||||
37
raylib/examples/models/resources/shaders/glsl330/skinning.vs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#version 330
|
||||
|
||||
#define MAX_BONE_NUM 128
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
in vec4 vertexColor;
|
||||
in vec4 vertexBoneIds;
|
||||
in vec4 vertexBoneWeights;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
uniform mat4 boneMatrices[MAX_BONE_NUM];
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec2 fragTexCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
int boneIndex0 = int(vertexBoneIds.x);
|
||||
int boneIndex1 = int(vertexBoneIds.y);
|
||||
int boneIndex2 = int(vertexBoneIds.z);
|
||||
int boneIndex3 = int(vertexBoneIds.w);
|
||||
|
||||
vec4 skinnedPosition =
|
||||
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexPosition, 1.0));
|
||||
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
|
||||
gl_Position = mvp*skinnedPosition;
|
||||
}
|
||||
30
raylib/examples/models/resources/shaders/glsl330/skybox.fs
Normal file
|
|
@ -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);
|
||||
}
|
||||
24
raylib/examples/models/resources/shaders/glsl330/skybox.vs
Normal file
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPosition;
|
||||
//in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
in vec3 fragNormal;
|
||||
|
||||
// Input uniform values
|
||||
//uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
#define MAX_LIGHTS 4
|
||||
#define LIGHT_DIRECTIONAL 0
|
||||
#define LIGHT_POINT 1
|
||||
|
||||
struct Light {
|
||||
int enabled;
|
||||
int type;
|
||||
vec3 position;
|
||||
vec3 target;
|
||||
vec4 color;
|
||||
};
|
||||
|
||||
// Input lighting values
|
||||
uniform Light lights[MAX_LIGHTS];
|
||||
uniform vec4 ambient;
|
||||
uniform vec3 viewPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Texel color fetching from texture sampler
|
||||
//vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
vec3 lightDot = vec3(0.0);
|
||||
vec3 normal = normalize(fragNormal);
|
||||
vec3 viewD = normalize(viewPos - fragPosition);
|
||||
vec3 specular = vec3(0.0);
|
||||
|
||||
// NOTE: Implement here your fragment shader code
|
||||
|
||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||
{
|
||||
if (lights[i].enabled == 1)
|
||||
{
|
||||
vec3 light = vec3(0.0);
|
||||
|
||||
if (lights[i].type == LIGHT_DIRECTIONAL)
|
||||
{
|
||||
light = -normalize(lights[i].target - lights[i].position);
|
||||
}
|
||||
|
||||
if (lights[i].type == LIGHT_POINT)
|
||||
{
|
||||
light = normalize(lights[i].position - fragPosition);
|
||||
}
|
||||
|
||||
float NdotL = max(dot(normal, light), 0.0);
|
||||
lightDot += lights[i].color.rgb*NdotL;
|
||||
|
||||
float specCo = 0.0;
|
||||
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // 16 refers to shine
|
||||
specular += specCo;
|
||||
}
|
||||
}
|
||||
|
||||
finalColor = (fragColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
|
||||
finalColor += fragColor*(ambient/10.0)*colDiffuse;
|
||||
|
||||
// Gamma correction
|
||||
finalColor = pow(finalColor, vec4(1.0/2.2));
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
//in vec2 vertexTexCoord;
|
||||
in vec3 vertexNormal;
|
||||
in vec4 vertexColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
uniform mat4 matModel;
|
||||
uniform mat4 matNormal;
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec3 fragPosition;
|
||||
//out vec2 fragTexCoord;
|
||||
out vec4 fragColor;
|
||||
out vec3 fragNormal;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
// Send vertex attributes to fragment shader
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||
//fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||
}
|
||||
BIN
raylib/examples/models/resources/skybox.png
Normal file
|
After Width: | Height: | Size: 11 KiB |