window brake sp
This commit is contained in:
parent
6490b0241f
commit
7540e9bf09
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.
@ -2,7 +2,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<ProjectOutputs>
|
<ProjectOutputs>
|
||||||
<ProjectOutput>
|
<ProjectOutput>
|
||||||
<FullPath>C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe</FullPath>
|
<FullPath>C:\Users\Serhii\source\repos\GRK_game_scene\Debug\grk-cw9.exe</FullPath>
|
||||||
</ProjectOutput>
|
</ProjectOutput>
|
||||||
</ProjectOutputs>
|
</ProjectOutputs>
|
||||||
<ContentFiles />
|
<ContentFiles />
|
||||||
|
@ -1 +1,64 @@
|
|||||||
grk-cw9.vcxproj -> C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe
|
main.cpp
|
||||||
|
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(180,30): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(259,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(282,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(329,20): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(382,20): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(412,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(426,98): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||||
|
with
|
||||||
|
[
|
||||||
|
T=float
|
||||||
|
]
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(429,68): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||||
|
with
|
||||||
|
[
|
||||||
|
T=float
|
||||||
|
]
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(516,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(548,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(577,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(586,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(609,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(715,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(727,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||||
|
with
|
||||||
|
[
|
||||||
|
T=float
|
||||||
|
]
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(735,87): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||||
|
with
|
||||||
|
[
|
||||||
|
T=float
|
||||||
|
]
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(735,223): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(738,59): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||||
|
with
|
||||||
|
[
|
||||||
|
T=float
|
||||||
|
]
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(739,37): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(835,20): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(841,50): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(842,51): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(907,21): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(909,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(932,17): warning C4101: 'data': unreferenced local variable
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1028,20): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1080,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1081,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1082,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1114,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1115,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1116,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1152,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1153,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1154,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1334,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1336,21): warning C4305: '+=': truncation from 'double' to 'float'
|
||||||
|
C:\Users\Serhii\source\repos\GRK_game_scene\cw 9\src\ex_9_1.hpp(1356,21): warning C4018: '<': signed/unsigned mismatch
|
||||||
|
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\Serhii\source\repos\GRK_game_scene\Debug\grk-cw9.exe
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +1,2 @@
|
|||||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionMFC=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:TargetPlatformVersion=10.0.22000.0:
|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
|
||||||
Debug|Win32|C:\Users\arciom\Desktop\GRK_game_scene_new2\|
|
Debug|Win32|C:\Users\Serhii\source\repos\GRK_game_scene\|
|
||||||
|
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.
114
cw 9/models/brokenWindow.obj
Normal file
114
cw 9/models/brokenWindow.obj
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# Blender 3.4.1
|
||||||
|
# www.blender.org
|
||||||
|
mtllib brokenWindow.mtl
|
||||||
|
o window_Cube.007
|
||||||
|
v -1.800000 1.970000 0.750784
|
||||||
|
v -1.800000 1.970000 -0.249216
|
||||||
|
v -1.800000 1.015374 0.750784
|
||||||
|
v -1.800000 1.015374 -0.249217
|
||||||
|
v -1.831872 1.970000 0.750784
|
||||||
|
v -1.831872 1.970000 -0.249216
|
||||||
|
v -1.831872 1.015374 0.750784
|
||||||
|
v -1.831872 1.015374 -0.249217
|
||||||
|
v -1.801075 1.937813 -0.215499
|
||||||
|
v -1.801075 1.937813 0.717068
|
||||||
|
v -1.801075 1.047560 0.717067
|
||||||
|
v -1.801075 1.047560 -0.215500
|
||||||
|
v -1.830798 1.937813 -0.215499
|
||||||
|
v -1.830798 1.937813 0.717068
|
||||||
|
v -1.830798 1.047560 0.717067
|
||||||
|
v -1.830798 1.047560 -0.215500
|
||||||
|
v -1.800000 1.492687 0.750784
|
||||||
|
v -1.831872 1.492687 0.750784
|
||||||
|
v -1.801075 1.492687 0.717068
|
||||||
|
v -1.800000 1.492687 -0.249216
|
||||||
|
v -1.831872 1.492687 -0.249216
|
||||||
|
v -1.801075 1.492687 -0.215499
|
||||||
|
v -1.800000 1.970000 0.250784
|
||||||
|
v -1.831872 1.970000 0.250784
|
||||||
|
v -1.801075 1.937813 0.250784
|
||||||
|
v -1.830798 1.937813 0.250784
|
||||||
|
v -1.800000 1.015374 0.250783
|
||||||
|
v -1.831872 1.015374 0.250783
|
||||||
|
v -1.801075 1.047560 0.250783
|
||||||
|
v -1.815936 1.047560 0.717067
|
||||||
|
v -1.815936 1.047560 -0.215500
|
||||||
|
v -1.815936 1.937813 0.717068
|
||||||
|
v -1.815936 1.937813 -0.215499
|
||||||
|
v -1.830748 1.492687 -0.215499
|
||||||
|
v -1.830748 1.937813 0.250784
|
||||||
|
v -1.815936 1.937813 0.270323
|
||||||
|
v -1.801125 1.937813 0.250784
|
||||||
|
v -1.815936 1.937813 0.231245
|
||||||
|
vn -0.0000 -1.0000 -0.0000
|
||||||
|
vn -0.0000 -0.0000 1.0000
|
||||||
|
vn -0.0000 -0.0000 -1.0000
|
||||||
|
vn -0.0000 1.0000 -0.0000
|
||||||
|
vn -0.9994 -0.0333 -0.0000
|
||||||
|
vn 0.9995 -0.0000 0.0319
|
||||||
|
vn 0.9994 -0.0334 -0.0000
|
||||||
|
vn 0.9994 0.0334 -0.0000
|
||||||
|
vn 0.9995 -0.0000 -0.0319
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
s 0
|
||||||
|
usemtl Material.007
|
||||||
|
f 27/25/1 28/26/1 8/8/1 4/4/1
|
||||||
|
f 17/15/2 18/16/2 7/7/2 3/3/2
|
||||||
|
f 20/18/3 4/4/3 8/8/3 21/19/3
|
||||||
|
f 23/21/4 2/2/4 6/6/4 24/22/4
|
||||||
|
f 32/28/1 14/14/1 26/24/1 35/30/1 36/31/1
|
||||||
|
f 24/22/5 26/24/5 14/14/5 5/5/5
|
||||||
|
f 20/18/6 22/20/6 12/12/6 4/4/6
|
||||||
|
f 23/21/7 25/23/7 9/9/7 2/2/7
|
||||||
|
f 27/25/8 4/4/8 12/12/8 29/27/8
|
||||||
|
f 17/15/9 3/3/9 11/11/9 19/17/9
|
||||||
|
f 1/1/9 17/15/9 19/17/9 10/10/9
|
||||||
|
f 1/1/2 5/5/2 18/16/2 17/15/2
|
||||||
|
f 2/2/6 9/9/6 22/20/6 20/18/6
|
||||||
|
f 2/2/3 20/18/3 21/19/3 6/6/3
|
||||||
|
f 1/1/7 10/10/7 25/23/7 23/21/7
|
||||||
|
f 6/6/5 13/13/5 26/24/5 24/22/5
|
||||||
|
f 25/23/1 37/32/1 38/33/1 33/29/1 9/9/1
|
||||||
|
f 1/1/4 23/21/4 24/22/4 5/5/4
|
||||||
|
f 3/3/8 27/25/8 29/27/8 11/11/8
|
||||||
|
f 3/3/1 7/7/1 28/26/1 27/25/1
|
||||||
|
f 35/30/1 26/24/1 13/13/1 33/29/1 38/33/1
|
||||||
|
f 10/10/1 32/28/1 36/31/1 37/32/1 25/23/1
|
||||||
|
l 7 15
|
||||||
|
l 8 16
|
||||||
|
l 15 30
|
||||||
|
l 12 31
|
||||||
|
l 16 31
|
||||||
|
l 11 30
|
38413
cw 9/models/door.obj
38413
cw 9/models/door.obj
File diff suppressed because it is too large
Load Diff
@ -24,8 +24,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <stb_image.h>
|
|
||||||
|
|
||||||
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
|
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
|
||||||
|
|
||||||
int WIDTH = 950, HEIGHT = 950;
|
int WIDTH = 950, HEIGHT = 950;
|
||||||
@ -74,6 +72,7 @@ namespace models {
|
|||||||
Core::RenderContext roomOutsideContext;
|
Core::RenderContext roomOutsideContext;
|
||||||
Core::RenderContext roomInsideContext;
|
Core::RenderContext roomInsideContext;
|
||||||
Core::RenderContext roofContext;
|
Core::RenderContext roofContext;
|
||||||
|
Core::RenderContext brokenWindowContext;
|
||||||
|
|
||||||
Core::RenderContext pawnFigureContext;
|
Core::RenderContext pawnFigureContext;
|
||||||
Core::RenderContext towerFigureContext;
|
Core::RenderContext towerFigureContext;
|
||||||
@ -193,6 +192,8 @@ double startCursorYPos;
|
|||||||
float lastTime = -1.f;
|
float lastTime = -1.f;
|
||||||
float deltaTime = 0.f;
|
float deltaTime = 0.f;
|
||||||
|
|
||||||
|
bool isWindowBroke = false;
|
||||||
|
|
||||||
Laser laser1 = Laser();
|
Laser laser1 = Laser();
|
||||||
Laser laser2 = Laser();
|
Laser laser2 = Laser();
|
||||||
|
|
||||||
@ -351,23 +352,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
|
|||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initparallaxMappingData() {
|
|
||||||
int width, height, nrChannels;
|
|
||||||
unsigned char* data = stbi_load("parallax/paintingDepthParallaxRes.jpg", &width, &height, &nrChannels, 0);
|
|
||||||
unsigned int texture;
|
|
||||||
glGenTextures(1, &texture);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, data);
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
|
||||||
stbi_image_free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void parallaxMapping() {
|
|
||||||
glUseProgram(programParallaxMap);
|
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, glm::vec3 color, float roughness, float metallic) {
|
void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, glm::vec3 color, float roughness, float metallic) {
|
||||||
@ -457,6 +442,7 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) {
|
|||||||
drawObjectDepth(models::roomInsideContext, lightVP, glm::mat4());
|
drawObjectDepth(models::roomInsideContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::roomOutsideContext, lightVP, glm::mat4());
|
drawObjectDepth(models::roomOutsideContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::windowContext, lightVP, glm::mat4());
|
drawObjectDepth(models::windowContext, lightVP, glm::mat4());
|
||||||
|
drawObjectDepth(models::brokenWindowContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::sofaContext, lightVP, glm::mat4());
|
drawObjectDepth(models::sofaContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::booksContext, lightVP, glm::mat4());
|
drawObjectDepth(models::booksContext, lightVP, glm::mat4());
|
||||||
|
|
||||||
@ -499,6 +485,31 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) {
|
|||||||
glViewport(0, 0, WIDTH, HEIGHT);
|
glViewport(0, 0, WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//LASER COLLISION
|
||||||
|
void laser_collision(Laser laser) {
|
||||||
|
float x = laser.getLaserPos().x;
|
||||||
|
float y = laser.getLaserPos().y;
|
||||||
|
float z = laser.getLaserPos().z;
|
||||||
|
|
||||||
|
std::cout << x << " " << y << " " << z << std::endl;
|
||||||
|
|
||||||
|
bool collision =
|
||||||
|
/*(-1.83187 < spaceShipPos.x) &&
|
||||||
|
(spaceShipPos.x < -1.8) &&*/
|
||||||
|
(-1.84 > x) &&
|
||||||
|
(x < 1.79) &&
|
||||||
|
(1.01537 < y) &&
|
||||||
|
(y < 1.97) &&
|
||||||
|
(-0.249217 < z) &&
|
||||||
|
(z < 0.750784);
|
||||||
|
|
||||||
|
|
||||||
|
if (collision) {
|
||||||
|
isWindowBroke = true;
|
||||||
|
std::cout << "WINDOW BROKE";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void drawLaser(Laser laser, Core::RenderContext laserContext, float dyst, int index) {
|
void drawLaser(Laser laser, Core::RenderContext laserContext, float dyst, int index) {
|
||||||
|
|
||||||
@ -765,7 +776,20 @@ void renderScene(GLFWwindow* window)
|
|||||||
|
|
||||||
|
|
||||||
drawObjectTexture(models::doorContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
drawObjectTexture(models::doorContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
||||||
drawObjectTexture(models::windowContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
|
||||||
|
|
||||||
|
if (isWindowBroke)
|
||||||
|
{
|
||||||
|
drawObjectTexture(models::brokenWindowContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drawObjectTexture(models::windowContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
drawObjectTexture(models::doorFrameContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
drawObjectTexture(models::doorFrameContext, glm::mat4(), texture::door, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
||||||
|
|
||||||
drawObjectTexture(models::tvTableContext, glm::mat4(), texture::tvTable, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
drawObjectTexture(models::tvTableContext, glm::mat4(), texture::tvTable, glm::vec3(0.9f, 0.9f, 0.9f), 0.2f, 0.0f);
|
||||||
@ -785,7 +809,6 @@ void renderScene(GLFWwindow* window)
|
|||||||
drawObjectTexture(models::paintBackContext, glm::mat4(), texture::paintBack, glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
drawObjectTexture(models::paintBackContext, glm::mat4(), texture::paintBack, glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
||||||
drawObjectTexture(models::paintFaceContext, glm::mat4(), texture::paintFace, glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
drawObjectTexture(models::paintFaceContext, glm::mat4(), texture::paintFace, glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
||||||
|
|
||||||
parallaxMapping();
|
|
||||||
|
|
||||||
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()));
|
||||||
@ -817,9 +840,12 @@ void renderScene(GLFWwindow* window)
|
|||||||
|
|
||||||
drawLaser(lasers[i], lasersContexts[i], 0.1, i);
|
drawLaser(lasers[i], lasersContexts[i], 0.1, i);
|
||||||
drawLaser(lasers[i], lasersContexts[i], -0.1, i);
|
drawLaser(lasers[i], lasersContexts[i], -0.1, i);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//test depth buffer
|
//test depth buffer
|
||||||
/*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
/*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glUseProgram(programTest);
|
glUseProgram(programTest);
|
||||||
@ -940,7 +966,6 @@ void init(GLFWwindow* window)
|
|||||||
|
|
||||||
initDepthMap();
|
initDepthMap();
|
||||||
|
|
||||||
initparallaxMappingData();
|
|
||||||
|
|
||||||
pawnCoord = randomFiguresCoord();
|
pawnCoord = randomFiguresCoord();
|
||||||
towerCoord = randomFiguresCoord();
|
towerCoord = randomFiguresCoord();
|
||||||
@ -982,6 +1007,8 @@ void init(GLFWwindow* window)
|
|||||||
loadModelToContext("./models/vase1.obj", models::vase1Context);
|
loadModelToContext("./models/vase1.obj", models::vase1Context);
|
||||||
loadModelToContext("./models/vase2.obj", models::vase2Context);
|
loadModelToContext("./models/vase2.obj", models::vase2Context);
|
||||||
|
|
||||||
|
loadModelToContext("./models/brokenWindow.obj", models::brokenWindowContext);
|
||||||
|
|
||||||
loadModelToContext("./models/TV.obj", models::tvContext);
|
loadModelToContext("./models/TV.obj", models::tvContext);
|
||||||
loadModelToContext("./models/TVscreen.obj", models::tvScreen);
|
loadModelToContext("./models/TVscreen.obj", models::tvScreen);
|
||||||
loadModelToContext("./models/x.obj", models::xThingContext);
|
loadModelToContext("./models/x.obj", models::xThingContext);
|
||||||
@ -1046,12 +1073,7 @@ void shutdown(GLFWwindow* window)
|
|||||||
shaderLoader.DeleteProgram(program);
|
shaderLoader.DeleteProgram(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
//LASER COLLISION
|
|
||||||
//void laser_collision(Laser laser) {
|
|
||||||
// float x = laser.getLaserPos().x;
|
|
||||||
// float y = laser.getLaserPos().y;
|
|
||||||
// float z = laser.getLaserPos().z;
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool check_window_collision(int plus_or_minus) {
|
bool check_window_collision(int plus_or_minus) {
|
||||||
|
|
||||||
@ -1066,17 +1088,25 @@ bool check_window_collision(int plus_or_minus) {
|
|||||||
|
|
||||||
//bool collision = (-1 < spaceShipPos.x < 1) && (0.0 < spaceShipPos.y < 0.9) && (-1.5 < spaceShipPos.z < 0.5);
|
//bool collision = (-1 < spaceShipPos.x < 1) && (0.0 < spaceShipPos.y < 0.9) && (-1.5 < spaceShipPos.z < 0.5);
|
||||||
|
|
||||||
|
if (isWindowBroke)
|
||||||
|
{
|
||||||
|
bool collision =
|
||||||
|
/*(-1.83187 < spaceShipPos.x) &&
|
||||||
|
(spaceShipPos.x < -1.8) &&*/
|
||||||
|
(-1.5 + spaceShipX > spaceShipPos.x) &&
|
||||||
|
(1.01537 + spaceShipY < spaceShipPos.y) &&
|
||||||
|
(spaceShipPos.y < 1.97 - spaceShipY) &&
|
||||||
|
(-0.249217 + spaceShipZ < spaceShipPos.z) &&
|
||||||
|
(spaceShipPos.z < 0.750784 - spaceShipZ);
|
||||||
|
|
||||||
|
return collision;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool collision =
|
|
||||||
/*(-1.83187 < spaceShipPos.x) &&
|
|
||||||
(spaceShipPos.x < -1.8) &&*/
|
|
||||||
(-1.5 + spaceShipX > spaceShipPos.x) &&
|
|
||||||
(1.01537 + spaceShipY < spaceShipPos.y) &&
|
|
||||||
(spaceShipPos.y < 1.97 - spaceShipY) &&
|
|
||||||
(-0.249217 + spaceShipZ < spaceShipPos.z) &&
|
|
||||||
(spaceShipPos.z < 0.750784 - spaceShipZ);
|
|
||||||
|
|
||||||
return collision;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_room_collision(int plus_or_minus) {
|
bool check_room_collision(int plus_or_minus) {
|
||||||
@ -1292,6 +1322,10 @@ void processInput(GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS) {
|
||||||
|
isWindowBroke = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cameraPos = spaceShip.getSpaceShipPos() - 0.5 * spaceShip.getSpaceShipDir() + glm::vec3(0, 1, 0) * 0.2f;
|
cameraPos = spaceShip.getSpaceShipPos() - 0.5 * spaceShip.getSpaceShipDir() + glm::vec3(0, 1, 0) * 0.2f;
|
||||||
cameraDir = spaceShip.getSpaceShipDir();
|
cameraDir = spaceShip.getSpaceShipDir();
|
||||||
@ -1318,6 +1352,13 @@ void renderLoop(GLFWwindow* window) {
|
|||||||
{
|
{
|
||||||
processInput(window);
|
processInput(window);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < lasers.size(); i++) {
|
||||||
|
if (lasers[i].isLaserFly()) {
|
||||||
|
laser_collision(lasers[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderScene(window);
|
renderScene(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user