add working terrain

This commit is contained in:
Matraf 2022-01-12 15:07:37 +01:00
parent 9100642ce7
commit 44164da244
10 changed files with 984331 additions and 569971 deletions

View File

@ -29,7 +29,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,6 @@ void main()
vec3 R = reflect(-normalize(lightDir),normal);
float ambient = 0.2;
float specular = pow(max(0,dot(R,V)),1000);
gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0) * (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);;
gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0) * (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);
//gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0);
}

View File

@ -23,4 +23,5 @@ void main()
{
float depth = logisticDepth(gl_FragCoord.z, 0.1f, 3.0f);
FragColor = texture(skybox, TexCoords)* (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);
//FragColor = texture(skybox, TexCoords);
}

View File

@ -5,7 +5,7 @@
namespace Core
{
glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 200.0f);
glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 700.0f);
// position - pozycja kamery
// forward - wektor "do przodu" kamery (jednostkowy)

View File

@ -78,8 +78,8 @@ std::string skyboxTextures[6] = {
"models/skybox/back.jpg"
};
float skyboxVerticeParameter = 50.0f;
float skyboxBoundary = 48.0f;
float skyboxVerticeParameter = 200.0f;
float skyboxBoundary = 500.0f;
float cubeVertices[] = {
// positions // normals
@ -367,7 +367,7 @@ void renderScene()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glm::mat4 submarineInitialTransformation = glm::translate(glm::vec3(0, -0.5, -0.4)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.25f));
glm::mat4 floorTransformation = glm::translate(glm::vec3(-50, -40, 50)) * glm::rotate(glm::radians(0.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(1.f));
glm::mat4 floorTransformation = glm::translate(glm::vec3(-50, -190, 50)) * glm::rotate(glm::radians(0.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(100.f));
glm::mat4 submarineModelMatrix = glm::translate(cameraPos + cameraDir) * glm::mat4_cast(glm::inverse(rotation)) * submarineInitialTransformation;
@ -380,7 +380,7 @@ void renderScene()
glm::vec3 change0 = glm::vec3(0, 0, 0);
for (int j = 0; j < 100; j++) {
drawObjectTexture(bubbleContext, animationMatrix(time + j, change0, bubbleArray[j], glm::vec3(0.04f), 0.2f), cubemapTexture, bubbleProgram);
drawObjectTexture(bubbleContext, animationMatrix(time + j, change0, bubbleArray[j], glm::vec3(0.04f), 0.1f), cubemapTexture, bubbleProgram);
}
for (int i = 0; i < 5; i++) {
@ -515,8 +515,8 @@ void init()
loadModelToContext("models/sphere.obj", bubbleContext);
textureBubble = Core::LoadTexture("textures/bubble.png");
loadModelToContext("models/seabed.obj", floorContext);
textureFloor = Core::LoadTexture("textures/seabed.jpg");
loadModelToContext("models/terrain.obj", floorContext);
textureFloor = Core::LoadTexture("textures/sand.png");
generateBubbleArray();
initCube();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 KiB