Support float texture data on OpenGL ES 2.0
This commit is contained in:
parent
35a6e9a074
commit
7b8965eb38
7 changed files with 23 additions and 14 deletions
|
@ -21,7 +21,7 @@ int main()
|
|||
InitWindow(screenWidth, screenHeight, "raylib [models] example - skybox loading and drawing");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = {{ 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
|
||||
Camera camera = {{ 1.0f, 1.0f, 1.0f }, { 4.0f, 1.0f, 4.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
|
||||
|
||||
// Load skybox model
|
||||
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPos;
|
||||
in vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D equirectangularMap;
|
||||
|
@ -28,7 +28,7 @@ vec2 SampleSphericalMap(vec3 v)
|
|||
void main()
|
||||
{
|
||||
// Normalize local position
|
||||
vec2 uv = SampleSphericalMap(normalize(fragPos));
|
||||
vec2 uv = SampleSphericalMap(normalize(fragPosition));
|
||||
|
||||
// Fetch color from texture map
|
||||
vec3 color = texture(equirectangularMap, uv).rgb;
|
||||
|
|
|
@ -16,12 +16,12 @@ uniform mat4 projection;
|
|||
uniform mat4 view;
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec3 fragPos;
|
||||
out vec3 fragPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Calculate fragment position based on model transformations
|
||||
fragPos = vertexPosition;
|
||||
fragPosition = vertexPosition;
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = projection*view*vec4(vertexPosition, 1.0);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPos;
|
||||
in vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform samplerCube environmentMap;
|
||||
|
@ -20,7 +20,7 @@ out vec4 finalColor;
|
|||
void main()
|
||||
{
|
||||
// Fetch color from texture map
|
||||
vec3 color = texture(environmentMap, fragPos).rgb;
|
||||
vec3 color = texture(environmentMap, fragPosition).rgb;
|
||||
|
||||
// Apply gamma correction
|
||||
color = color/(color + vec3(1.0));
|
||||
|
|
|
@ -16,12 +16,12 @@ uniform mat4 projection;
|
|||
uniform mat4 view;
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec3 fragPos;
|
||||
out vec3 fragPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Calculate fragment position based on model transformations
|
||||
fragPos = vertexPosition;
|
||||
fragPosition = vertexPosition;
|
||||
|
||||
// Remove translation from the view matrix
|
||||
mat4 rotView = mat4(mat3(view));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue