Added chess figures

This commit is contained in:
CybArciom 2023-02-09 21:43:38 +01:00
parent c9ce0b01af
commit 5e6f5aaa0c
32 changed files with 75922 additions and 135 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project> <Project>
<ProjectOutputs> <ProjectOutputs>
<ProjectOutput> <ProjectOutput>
<FullPath>C:\Users\Serhii\source\repos\GRK_game_scene\Debug\grk-cw9.exe</FullPath> <FullPath>C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe</FullPath>
</ProjectOutput> </ProjectOutput>
</ProjectOutputs> </ProjectOutputs>
<ContentFiles /> <ContentFiles />

View File

@ -1 +1,62 @@
 grk-cw9.vcxproj -> C:\Users\Serhii\source\repos\GRK_game_scene\Debug\grk-cw9.exe  main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
C:\Users\arciom\Desktop\GRK_game_scene_new2\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(172,30): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(226,38): warning C4305: '=': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(249,16): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(297,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(366,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(396,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(410,98): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(413,68): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(459,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(491,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(520,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(529,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(552,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(615,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(626,108): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(634,87): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(634,223): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(637,59): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(638,37): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(705,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(710,50): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(711,51): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(788,21): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(790,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(813,17): warning C4101: 'data': unreferenced local variable
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(952,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(953,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(954,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(978,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(979,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(980,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1016,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1017,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1018,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1175,21): warning C4305: '-=': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1177,21): warning C4305: '+=': truncation from 'double' to 'float'
Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
grk-cw9.vcxproj -> C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0: PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionMFC=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:TargetPlatformVersion=10.0.22000.0:
Debug|Win32|C:\Users\Serhii\source\repos\GRK_game_scene\| Debug|Win32|C:\Users\arciom\Desktop\GRK_game_scene_new2\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

48985
cw 9/models/horseFigure.obj Normal file

File diff suppressed because it is too large Load Diff

5146
cw 9/models/pawnFigure.obj Normal file

File diff suppressed because it is too large Load Diff

21641
cw 9/models/towerFigure.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
#version 330 core
in vec2 TexCoord;
in vec3 FragPos;
in vec3 Normal;
in vec3 Tangent;
in vec3 Bitangent;
out vec4 color;
uniform sampler2D diffuseMap;
uniform sampler2D normalMap;
uniform sampler2D heightMap;
uniform vec3 lightPos;
uniform float heightScale;
vec3 GetNormalFromMap()
{
vec3 normal = texture(normalMap, TexCoord).rgb;
normal = normalize(normal * 2.0 - 1.0);
mat3 TBN = mat3(Tangent, Bitangent, Normal);
return normalize(TBN * normal);
}
void main()
{
vec3 ambient = vec3(0.3);
vec3 diffuse = vec3(0.7);
vec3 specular = vec3(0.2);
vec3 lightColor = vec3(1.0);
vec3 viewPos = vec3(0.0, 0.0, 3.0);
vec3 lightDir = normalize(lightPos - FragPos);
vec3 normal = GetNormalFromMap();
vec3 viewDir = normalize(viewPos - FragPos);
vec3 height = texture(heightMap, TexCoord).r;
vec3 pos = FragPos + normal * height * heightScale;
vec3 diffuseValue = max(dot(normal, lightDir), 0.0) * diffuse * lightColor;
vec3 specularValue = pow(max(dot(viewDir, reflect(-lightDir, normal)), 0.0), 32.0) * specular *lightColor;
vec4 result = vec4((ambient + diffuseValue + specularValue) * texture(diffuseMap, TexCoord).rgb, 1.0);
color = vec4(result);
}

View File

@ -1,29 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in vec3 aNormal;
layout (location = 3) in vec3 aTangent;
layout (location = 4) in vec3 aBitangent;
out vec2 TexCoord;
out vec3 FragPos;
out vec3 Normal;
out vec3 Tangent;
out vec3 Bitangent;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main()
{
TexCoord = aTexCoord;
FragPos = vec3(model * vec4(aPos, 1.0));
Normal = mat3(transpose(inverse(model))) * aNormal;
Tangent = mat3(transpose(inverse(model))) * aTangent;
Bitangent = mat3(transpose(inverse(model))) * aBitangent;
gl_Position = projection * view * vec4(FragPos, 1.0);
}

View File

@ -1,32 +1,49 @@
#version 430 core #version 330 core
out vec4 FragColor;
in VS_OUT { in vec2 TexCoord;
vec3 FragPos; in vec3 FragPos;
vec2 TexCoords; in vec3 Normal;
vec3 TangentLightPos; in vec3 Tangent;
vec3 TangentViewPos; in vec3 Bitangent;
vec3 TangentFragPos;
} fs_in; out vec4 color;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
uniform sampler2D normalMap; uniform sampler2D normalMap;
uniform sampler2D depthMap; uniform sampler2D heightMap;
uniform float height_scale; uniform vec3 lightPos;
uniform float heightScale;
vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir); vec3 GetNormalFromMap()
{
vec3 normal = texture(normalMap, TexCoord).rgb;
normal = normalize(normal * 2.0 - 1.0);
mat3 TBN = mat3(Tangent, Bitangent, Normal);
return normalize(TBN * normal);
}
void main() void main()
{ {
// offset texture coordinates with Parallax Mapping vec3 ambient = vec3(0.3);
vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos); vec3 diffuse = vec3(0.7);
vec2 texCoords = ParallaxMapping(fs_in.TexCoords, viewDir); vec3 specular = vec3(0.2);
// then sample textures with new texture coords vec3 lightColor = vec3(1.0);
vec3 diffuse = texture(diffuseMap, texCoords);
vec3 normal = texture(normalMap, texCoords);
normal = normalize(normal * 2.0 - 1.0);
// proceed with lighting code
vec3 viewPos = vec3(0.0, 0.0, 3.0);
vec3 lightDir = normalize(lightPos - FragPos);
vec3 normal = GetNormalFromMap();
vec3 viewDir = normalize(viewPos - FragPos);
vec3 height = texture(heightMap, TexCoord).rgb;
vec3 pos = FragPos + normal * height * heightScale;
vec3 diffuseValue = max(dot(normal, lightDir), 0.0) * diffuse * lightColor;
vec3 specularValue = pow(max(dot(viewDir, reflect(-lightDir, normal)), 0.0), 32.0) * specular *lightColor;
vec4 result = vec4((ambient + diffuseValue + specularValue) * texture(diffuseMap, TexCoord).rgb, 1.0);
color = vec4(result);
} }

View File

@ -1,37 +1,29 @@
#version 430 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal; layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in vec2 aTexCoords; layout (location = 2) in vec3 aNormal;
layout (location = 3) in vec3 aTangent; layout (location = 3) in vec3 aTangent;
layout (location = 4) in vec3 aBitangent; layout (location = 4) in vec3 aBitangent;
out VS_OUT { out vec2 TexCoord;
vec3 FragPos; out vec3 FragPos;
vec2 TexCoords; out vec3 Normal;
vec3 TangentLightPos; out vec3 Tangent;
vec3 TangentViewPos; out vec3 Bitangent;
vec3 TangentFragPos;
} vs_out;
uniform mat4 projection;
uniform mat4 view;
uniform mat4 model; uniform mat4 model;
uniform mat4 view;
uniform vec3 lightPos; uniform mat4 projection;
uniform vec3 viewPos;
void main() void main()
{ {
gl_Position = projection * view * model * vec4(aPos, 1.0); TexCoord = aTexCoord;
vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); FragPos = vec3(model * vec4(aPos, 1.0));
vs_out.TexCoords = aTexCoords; Normal = mat3(transpose(inverse(model))) * aNormal;
Tangent = mat3(transpose(inverse(model))) * aTangent;
Bitangent = mat3(transpose(inverse(model))) * aBitangent;
vec3 T = normalize(mat3(model) * aTangent); gl_Position = projection * view * vec4(FragPos, 1.0);
vec3 B = normalize(mat3(model) * aBitangent);
vec3 N = normalize(mat3(model) * aNormal);
mat3 TBN = transpose(mat3(T, B, N));
vs_out.TangentLightPos = TBN * lightPos;
vs_out.TangentViewPos = TBN * viewPos;
vs_out.TangentFragPos = TBN * vs_out.FragPos;
} }

View File

@ -66,6 +66,10 @@ namespace models {
Core::RenderContext roomInsideContext; Core::RenderContext roomInsideContext;
Core::RenderContext roofContext; Core::RenderContext roofContext;
Core::RenderContext pawnFigureContext;
Core::RenderContext towerFigureContext;
Core::RenderContext horseFigureContext;
Core::RenderContext spaceshipContext; Core::RenderContext spaceshipContext;
Core::RenderContext sphereContext; Core::RenderContext sphereContext;
Core::RenderContext windowContext; Core::RenderContext windowContext;
@ -427,6 +431,11 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) {
drawObjectDepth(models::paintBackContext, lightVP, glm::mat4()); drawObjectDepth(models::paintBackContext, lightVP, glm::mat4());
drawObjectDepth(models::paintFaceContext, lightVP, glm::mat4()); drawObjectDepth(models::paintFaceContext, lightVP, glm::mat4());
//FIGURES
drawObjectDepth(models::pawnFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(0, 0.58, 0)) * glm::scale(glm::vec3(0.1f)));
drawObjectDepth(models::towerFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(0.2, 0.58, 0.3)) * glm::scale(glm::vec3(0.1f)));
drawObjectDepth(models::horseFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(-0.2, 0.58, -0.13)) * glm::scale(glm::vec3(0.1f)));
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceShip.getSpaceShipDir(), glm::vec3(0.f, 1.f, 0.f))); glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceShip.getSpaceShipDir(), glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceShip.getSpaceShipDir())); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceShip.getSpaceShipDir()));
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({ glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
@ -641,6 +650,15 @@ void renderScene(GLFWwindow* window)
drawObjectPBR(models::tvContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f); drawObjectPBR(models::tvContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f);
drawObjectPBR(models::windowContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); drawObjectPBR(models::windowContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
//FIGURES
//x = -0.2, z = -0.13
//x = -0.2, z = 0.3
//
//x = 0.2, z = -0.13
drawObjectPBR(models::pawnFigureContext, glm::mat4() * glm::translate(glm::vec3(0, 0.58, 0)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::towerFigureContext, glm::mat4() * glm::translate(glm::vec3(0.2, 0.58, 0.3)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::horseFigureContext, glm::mat4() * glm::translate(glm::vec3(-0.2, 0.58, -0.13)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
//drawObjectPBR(models::sofaContext, glm::mat4(), glm::vec3(0.620f, 0.313f, 0.131f), 0.2f, 0.0f); //drawObjectPBR(models::sofaContext, glm::mat4(), glm::vec3(0.620f, 0.313f, 0.131f), 0.2f, 0.0f);
//drawObjectPBR(models::xThingContext, glm::mat4(), glm::vec3(0.10039f, 0.018356f, 0.001935f), 0.1f, 0.0f); //drawObjectPBR(models::xThingContext, glm::mat4(), glm::vec3(0.10039f, 0.018356f, 0.001935f), 0.1f, 0.0f);
//drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); //drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
@ -825,7 +843,7 @@ void init(GLFWwindow* window)
glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetMouseButtonCallback(window, mouse_button_callback);
//glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); //glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwSetCursorPosCallback(window, cursor_position_callback); //glfwSetCursorPosCallback(window, cursor_position_callback);
initDepthMap(); initDepthMap();
@ -878,6 +896,11 @@ void init(GLFWwindow* window)
loadModelToContext("./models/window.obj", models::windowContext); loadModelToContext("./models/window.obj", models::windowContext);
loadModelToContext("./models/test.obj", models::testContext); loadModelToContext("./models/test.obj", models::testContext);
loadModelToContext("./models/pawnFigure.obj", models::pawnFigureContext);
loadModelToContext("./models/towerFigure.obj", models::towerFigureContext);
loadModelToContext("./models/horseFigure.obj", models::horseFigureContext);
texture::sofa = Core::LoadTexture("textures/sofa1.jpg"); texture::sofa = Core::LoadTexture("textures/sofa1.jpg");
texture::xThing = Core::LoadTexture("textures/xThing.png"); texture::xThing = Core::LoadTexture("textures/xThing.png");