Init commit. Windows version was checked.

This commit is contained in:
tomas
2025-03-23 20:03:23 +01:00
commit 5029165272
83 changed files with 199947 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 KiB

View File

@ -0,0 +1,28 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 08.06.2011 15:26:00
newmtl _10634_SpeedBoat_v01_LOD310634_SpeedBoat_v01
Ns 53.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5882 0.5882 0.5882
Kd 0.5882 0.5882 0.5882
Ks 0.2000 0.2000 0.2000
Ke 0.0000 0.0000 0.0000
map_Ka boat.jpg
map_Kd boat.jpg
newmtl glass
Ns 80.0000
Ni 1.5000
d 0.2000
Tr 0.8000
Tf 0.2000 0.2000 0.2000
illum 2
Ka 0.5882 0.5882 0.5882
Kd 0.5882 0.5882 0.5882
Ks 0.5000 0.5000 0.5000
Ke 0.0000 0.0000 0.0000

93618
windows/assets/models/boat.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
#version 330 core
// Fragment Shader for Ocean Rendering with Texture Normals
in vec3 NormalInterp; // **IN variable declaration - crucial!**
// Input from Vertex Shader
in vec2 TexCoord;
in vec3 FragPosWorld;
in vec3 NormalWorld;
// Output fragment color
out vec4 FragColor;
// Uniforms (textures, lighting parameters, camera position)
uniform sampler2D oceanTexture; // Sampler for ocean color texture
uniform sampler2D normalMap; // Sampler for normal map texture
uniform vec3 lightDir; // Directional light direction (world space)
uniform vec3 lightColor; // Light color
uniform vec3 viewPosWorld; // Camera position in world space
void main() {
// 1. Sample textures
vec3 albedoColor = texture(oceanTexture, TexCoord).rgb; // Sample ocean color texture
//vec3 normalMapSample = texture(normalMap, TexCoord).rgb; // Sample normal map
// 2. Unpack and transform normal from normal map (Tangent Space to World Space - Simplified)
//vec3 normalMapNormal = normalize(normalMapSample * 2.0 - 1.0); // Unpack from [0, 1] to [-1, 1] and normalize
vec3 normalWorld = normalize(NormalInterp); // Get interpolated geometric normal from vertex shader
// **Basic Tangent Space Normal Mapping Approximation:**
// For truly correct tangent-space normal mapping, you'd need to construct a proper TBN matrix.
vec3 finalNormal = normalize(normalWorld ); // **Blend/Perturb geometric normal with texture normal**
// 3. Lighting calculations (Blinn-Phong example)
vec3 lightDirNorm = normalize(lightDir);
vec3 viewDirNorm = normalize(viewPosWorld - FragPosWorld);
vec3 reflectDir = reflect(-lightDirNorm, finalNormal);
// Diffuse component
float diff = max(dot(finalNormal, lightDirNorm), 0.0);
vec3 diffuse = diff * lightColor * albedoColor;
// Specular component (Blinn-Phong)
float spec = pow(max(dot(viewDirNorm, reflectDir), 0.0), 32.0);
vec3 specular = spec * lightColor * vec3(0.8); // Example specular color
// Ambient component
vec3 ambient = 0.3 * lightColor * albedoColor; // Example ambient
// 4. Combine lighting components for final color
vec3 finalColor = ambient + diffuse + specular;
FragColor = vec4(finalColor, 1.0); // Output final fragment color
}

View File

@ -0,0 +1,34 @@
#version 330 core
// Vertex Shader for Ocean Rendering
// Input vertex attributes (from VBOs)
layout (location = 0) in vec3 aPos; // Vertex position (from Ocean::vertices VBO)
layout (location = 1) in vec3 aNormal; // Vertex normal (from Ocean::normals VBO)
layout (location = 2) in vec2 aTexCoord; // Texture coordinates (from Ocean::texCoords VBO)
// Output to Fragment Shader
out vec2 TexCoord;
out vec3 FragPosWorld; // Fragment position in world space
out vec3 NormalWorld; // Normal vector in world space
out vec3 NormalInterp; // **OUT variable declaration - crucial!**
// Uniforms (matrices, light parameters, etc.)
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat3 normalMatrix; // Normal matrix for correct normal transformation
void main() {
// 1. Transform vertex position to clip space
gl_Position = projection * view * vec4(aPos, 1.0);
// 2. Pass texture coordinates to fragment shader
TexCoord = aTexCoord;
// 3. Calculate fragment position in world space
FragPosWorld = vec3(model * vec4(aPos, 1.0));
// 4. Transform normal vector to world space using the Normal Matrix
NormalWorld = normalize(normalMatrix * aNormal);
}

View File

@ -0,0 +1,50 @@
#version 330 core
// Fragment Shader for Terrain Rendering
in vec3 NormalInterp; // **IN variable declaration - crucial!**
in vec2 TexCoord;
in vec3 FragPosWorld;
in vec3 NormalWorld;
out vec4 FragColor;
uniform sampler2D terrainTexture; // Sampler for terrain color texture (no normal map for now)
uniform sampler2D heightMapTexture; // **New: Sampler for heightmap texture**
uniform vec3 lightDir;
uniform vec3 lightColor;
uniform vec3 viewPosWorld;
void main() {
// 1. Sample terrain texture
vec3 albedoColor = texture(terrainTexture, TexCoord).rgb;
float heightValue = texture(heightMapTexture, TexCoord).r; // **Sample heightmap (Red channel = grayscale height)**
// 2. Lighting calculations (Blinn-Phong - similar to ocean shader)
vec3 normal = normalize(NormalWorld); // Use geometric normal for terrain
vec3 lightDirNorm = normalize(lightDir);
vec3 viewDirNorm = normalize(viewPosWorld - FragPosWorld);
vec3 reflectDir = reflect(-lightDirNorm, normal);
// Diffuse component
float diff = max(dot(normal, lightDirNorm), 0.0);
vec3 diffuse = diff * lightColor * albedoColor;
// Specular component
float spec = pow(max(dot(viewDirNorm, reflectDir), 0.0), 16.0); // Adjust shininess (exponent)
vec3 specular = spec * lightColor * vec3(0.3); // Example specular color - less shiny than ocean
// Ambient component
vec3 ambient = 0.2 * lightColor * albedoColor;
vec3 lowColor = vec3(0.2, 0.3, 0.05); // Darker green/brown for lower areas
vec3 highColor = vec3(0.5, 0.7, 0.2); // Lighter green for higher areas
vec3 heightBasedColor = mix(lowColor, highColor, heightValue); // Linear interpolation based on heightValue
// 4. Combine lighting components for final color
vec3 finalColor = ambient + diffuse + specular;
FragColor = vec4(finalColor * heightBasedColor, 1.0);
}

View File

@ -0,0 +1,22 @@
#version 330 core
// Vertex Shader for Terrain Rendering
layout (location = 0) in vec3 aPos; // Vertex position
layout (location = 1) in vec3 aNormal; // Vertex normal
layout (location = 2) in vec2 aTexCoord; // Texture coordinates
out vec2 TexCoord;
out vec3 FragPosWorld;
out vec3 NormalWorld;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat3 normalMatrix;
void main() {
gl_Position = projection * view * vec4(aPos, 1.0);
TexCoord = aTexCoord;
FragPosWorld = vec3(model * vec4(aPos, 1.0));
NormalWorld = normalize(normalMatrix * aNormal);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB