Added random color for chess figures, random chess figures, random number of figures
This commit is contained in:
parent
200daf32da
commit
4d57e9f63f
Binary file not shown.
Binary file not shown.
@ -2,61 +2,62 @@
|
||||
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(174,30): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(234,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(257,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(305,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(374,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(404,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(418,98): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(249,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(272,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(320,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(389,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(419,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(433,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(421,68): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(436,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(467,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(499,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(528,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(537,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(560,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(642,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(654,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(496,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(528,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(557,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(566,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(589,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(695,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(707,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(662,87): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(715,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(662,223): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(665,59): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(715,223): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(718,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(666,37): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(737,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(742,50): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(743,51): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(820,21): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(822,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(845,17): warning C4101: 'data': unreferenced local variable
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(988,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(989,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(990,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1014,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1015,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,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1052,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1053,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1054,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1220,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1222,21): warning C4305: '+=': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(719,37): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(796,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(801,50): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(802,51): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(864,21): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(866,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(889,17): warning C4101: 'data': unreferenced local variable
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(983,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1030,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1031,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1032,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1056,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1057,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1058,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1094,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1095,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1096,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1272,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||
C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1274,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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -205,7 +205,8 @@ std::vector<glm::vec3> lasersLightPos{ laserLightPos0, laserLightPos1, laserLigh
|
||||
// laserLightPos8, laserLightPos9, laserLightPos10, laserLightPos11, laserLightPos12, laserLightPos13, laserLightPos14, laserLightPos15,
|
||||
// laserLightPos16, laserLightPos17, laserLightPos18, laserLightPos19 };
|
||||
|
||||
|
||||
std::vector<char*> figuresPathToObject{ "./models/pawnFigure.obj", "./models/towerFigure.obj", "./models/horseFigure.obj" };
|
||||
std::vector<Core::RenderContext> figuresContexts{ models::pawnFigureContext, models::towerFigureContext, models::horseFigureContext };
|
||||
|
||||
std::vector<Laser> lasers;
|
||||
|
||||
@ -223,6 +224,20 @@ float startEnemy = 0;
|
||||
glm::vec3 pawnCoord;
|
||||
glm::vec3 towerCoord;
|
||||
glm::vec3 horseCoord;
|
||||
int figuresCount;
|
||||
|
||||
glm::vec3 figureCoord1;
|
||||
glm::vec3 figureCoord2;
|
||||
glm::vec3 figureCoord3;
|
||||
|
||||
glm::vec3 figure1Color;
|
||||
glm::vec3 figure2Color;
|
||||
glm::vec3 figure3Color;
|
||||
|
||||
Core::RenderContext figureRandomContext1;
|
||||
Core::RenderContext figureRandomContext2;
|
||||
Core::RenderContext figureRandomContext3;
|
||||
|
||||
|
||||
void updateDeltaTime(float time) {
|
||||
if (lastTime < 0) {
|
||||
@ -440,9 +455,23 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) {
|
||||
drawObjectDepth(models::paintFaceContext, lightVP, glm::mat4());
|
||||
|
||||
//FIGURES
|
||||
drawObjectDepth(models::pawnFigureContext, lightVP, glm::mat4() * glm::translate(pawnCoord) * glm::scale(glm::vec3(0.1f)));
|
||||
drawObjectDepth(models::towerFigureContext, lightVP, glm::mat4() * glm::translate(towerCoord) * glm::scale(glm::vec3(0.1f)));
|
||||
drawObjectDepth(models::horseFigureContext, lightVP, glm::mat4() * glm::translate(horseCoord) * glm::scale(glm::vec3(0.1f)));
|
||||
switch (figuresCount)
|
||||
{
|
||||
case 1:
|
||||
drawObjectDepth(figureRandomContext1, lightVP, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)));
|
||||
break;
|
||||
case 2:
|
||||
drawObjectDepth(figureRandomContext1, lightVP, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)));
|
||||
drawObjectDepth(figureRandomContext2, lightVP, glm::mat4() * glm::translate(figureCoord2) * glm::scale(glm::vec3(0.1f)));
|
||||
break;
|
||||
case 3:
|
||||
drawObjectDepth(figureRandomContext1, lightVP, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)));
|
||||
drawObjectDepth(figureRandomContext2, lightVP, glm::mat4() * glm::translate(figureCoord2) * glm::scale(glm::vec3(0.1f)));
|
||||
drawObjectDepth(figureRandomContext3, lightVP, glm::mat4() * glm::translate(figureCoord3) * glm::scale(glm::vec3(0.1f)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
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()));
|
||||
@ -585,9 +614,7 @@ void drawSkybox(Core::RenderContext& context, GLuint textureID) {
|
||||
glm::mat4 transformation = viewProjectionMatrix * pos;
|
||||
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "modelMatrix"), 1, GL_FALSE, (float*)&pos);
|
||||
//glUniform3f(glGetUniformLocation(programSkybox, "lightPos"), 0, 0, 0);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||
//Core::SetActiveTexture(textureID, "skybox", programSkybox, 0);
|
||||
Core::DrawContext(context);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
@ -614,26 +641,52 @@ void initDepthMap()
|
||||
}
|
||||
|
||||
glm::vec3 randomFiguresCoord() {
|
||||
//srand(time(0));
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 generator(rd());
|
||||
std::uniform_real_distribution<double> distributionX(-0.2, 0.2);
|
||||
double random_x_number = floor(distributionX(generator) / 0.01) * 0.01;
|
||||
|
||||
|
||||
std::uniform_real_distribution<double> distributionZ(-0.13, 0.3);
|
||||
double random_z_number = floor(distributionZ(generator) / 0.01) * 0.01;
|
||||
|
||||
|
||||
/*double random_x_number = (rand() / double(RAND_MAX)) * 0.4 - 0.2;
|
||||
|
||||
|
||||
double random_z_number = floor((rand() / double(RAND_MAX)) * (0.3 - (-0.13) / 0.01 + 1) * 0.01 - 0.13 / 0.01) * 0.01 + (-0.13);*///(rand() / double(RAND_MAX)) * (0.3 + 0.13) - 0.13;
|
||||
std::cout << "Rand X = " << random_x_number << ", Rand Z = " << random_z_number << "\n";
|
||||
return glm::vec3(random_x_number, 0.58, random_z_number);
|
||||
}
|
||||
|
||||
int randomFiguresCount() {
|
||||
std::random_device rd;
|
||||
std::mt19937 generator(rd());
|
||||
std::uniform_int_distribution<int> distribution(1, 3);
|
||||
|
||||
int random_number = distribution(generator);
|
||||
|
||||
return random_number;
|
||||
}
|
||||
|
||||
Core::RenderContext randomFiguresContext() {
|
||||
std::random_device rd;
|
||||
std::mt19937 generator(rd());
|
||||
std::uniform_int_distribution<int> distribution(0, 2);
|
||||
|
||||
int random_number = distribution(generator);
|
||||
|
||||
return figuresContexts[random_number];
|
||||
}
|
||||
|
||||
glm::vec3 blackOrWhiteFigureColor() {
|
||||
std::random_device rd;
|
||||
std::mt19937 generator(rd());
|
||||
std::uniform_int_distribution<int> distribution(0, 1);
|
||||
|
||||
int random_number = distribution(generator);
|
||||
|
||||
if (random_number == 0) {
|
||||
return glm::vec3(0.01, 0.01, 0.01);
|
||||
}
|
||||
else {
|
||||
return glm::vec3(0.9, 0.9, 0.9);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void renderScene(GLFWwindow* window)
|
||||
{
|
||||
@ -679,17 +732,23 @@ void renderScene(GLFWwindow* window)
|
||||
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.3
|
||||
//x = 0.2, z = -0.13
|
||||
//randomFiguresCoord();
|
||||
|
||||
|
||||
|
||||
drawObjectPBR(models::pawnFigureContext, glm::mat4() * glm::translate(pawnCoord) * 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(towerCoord) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.1f, 0.1f, 0.1f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::horseFigureContext, glm::mat4() * glm::translate(horseCoord) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
|
||||
switch (figuresCount)
|
||||
{
|
||||
case 1:
|
||||
drawObjectPBR(figureRandomContext1, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)), figure1Color, 0.2f, 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
drawObjectPBR(figureRandomContext1, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)), figure1Color, 0.2f, 0.0f);
|
||||
drawObjectPBR(figureRandomContext2, glm::mat4() * glm::translate(figureCoord2) * glm::scale(glm::vec3(0.1f)), figure2Color, 0.2f, 0.0f);
|
||||
break;
|
||||
case 3:
|
||||
drawObjectPBR(figureRandomContext1, glm::mat4() * glm::translate(figureCoord1) * glm::scale(glm::vec3(0.1f)), figure1Color, 0.2f, 0.0f);
|
||||
drawObjectPBR(figureRandomContext2, glm::mat4() * glm::translate(figureCoord2) * glm::scale(glm::vec3(0.1f)), figure2Color, 0.2f, 0.0f);
|
||||
drawObjectPBR(figureRandomContext3, glm::mat4() * glm::translate(figureCoord3) * glm::scale(glm::vec3(0.1f)), figure3Color, 0.2f, 0.0f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//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);
|
||||
@ -744,12 +803,6 @@ void renderScene(GLFWwindow* window)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*std::cout << spaceShip.getSpaceShipPos().x << std::endl;
|
||||
std::cout << spaceShip.getSpaceShipPos().y << std::endl;*/
|
||||
//std::cout << spaceShip.getSpaceShipPos().z << std::endl;
|
||||
|
||||
|
||||
//test depth buffer
|
||||
/*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glUseProgram(programTest);
|
||||
@ -782,27 +835,18 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
|
||||
|
||||
void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
{
|
||||
//std::cout << "yStart: " << startCursorYPos << "\n";
|
||||
|
||||
float angleSpeed = 0.05f * deltaTime * 60;
|
||||
|
||||
if (ypos < startCursorYPos) {
|
||||
startCursorYPos = ypos;
|
||||
spaceShip.setSpaceShipDir(glm::vec3(glm::eulerAngleX(angleSpeed) * glm::vec4(spaceShip.getSpaceShipDir(), 0)));
|
||||
//startCursorYPos = ypos;
|
||||
//std::cout << "yNew: " << ypos << "\n";
|
||||
}
|
||||
else if (ypos > startCursorYPos) {
|
||||
startCursorYPos = ypos;
|
||||
spaceShip.setSpaceShipDir(glm::vec3(glm::eulerAngleX(-angleSpeed) * glm::vec4(spaceShip.getSpaceShipDir(), 0)));
|
||||
//startCursorYPos = ypos;
|
||||
//std::cout << "yNew: " << ypos << "\n";
|
||||
}
|
||||
|
||||
|
||||
//spaceShip.setSpaceShipDir(glm::vec3(glm::eulerAngleZ(angleSpeed) * glm::vec4(spaceShip.getSpaceShipDir(), 0)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -936,6 +980,10 @@ void init(GLFWwindow* window)
|
||||
loadModelToContext("./models/towerFigure.obj", models::towerFigureContext);
|
||||
loadModelToContext("./models/horseFigure.obj", models::horseFigureContext);
|
||||
|
||||
for (int i = 0; i < figuresContexts.size(); i++) {
|
||||
loadModelToContext(figuresPathToObject[i], figuresContexts[i]);
|
||||
}
|
||||
|
||||
|
||||
texture::sofa = Core::LoadTexture("textures/sofa1.jpg");
|
||||
texture::xThing = Core::LoadTexture("textures/xThing.png");
|
||||
@ -963,12 +1011,6 @@ void init(GLFWwindow* window)
|
||||
lasers.push_back(Laser(spaceShip.getSpaceShipDir(), spaceShip.getSpaceShipPos(), 10, false));
|
||||
|
||||
}
|
||||
|
||||
/*for (int i = 0; i < spaceShip.getMaxNumberOfLasers(); i++) {
|
||||
|
||||
loadModelToContext("./models/newlaser2.obj", spaceShip.getGun()[i].getLaserContext());
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
void shutdown(GLFWwindow* window)
|
||||
@ -1206,9 +1248,19 @@ void processInput(GLFWwindow* window)
|
||||
if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
|
||||
//spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceShip.getSpaceShipDir(), 0));
|
||||
|
||||
pawnCoord = randomFiguresCoord();
|
||||
towerCoord = randomFiguresCoord();
|
||||
horseCoord = randomFiguresCoord();
|
||||
figureRandomContext1 = randomFiguresContext();
|
||||
figureRandomContext2 = randomFiguresContext();
|
||||
figureRandomContext3 = randomFiguresContext();
|
||||
|
||||
figure1Color = blackOrWhiteFigureColor();
|
||||
figure2Color = blackOrWhiteFigureColor();
|
||||
figure3Color = blackOrWhiteFigureColor();
|
||||
|
||||
figuresCount = randomFiguresCount();
|
||||
|
||||
figureCoord1 = randomFiguresCoord();
|
||||
figureCoord2 = randomFiguresCoord();
|
||||
figureCoord3 = randomFiguresCoord();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user