Merge pull request 'fix' (#9) from fix into master

Reviewed-on: #9
This commit is contained in:
Jędrzej Biesek 2023-02-12 19:48:20 +01:00
commit 187fb7dafa
11 changed files with 97 additions and 61 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,74 +9,69 @@ C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warni
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(337,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(375,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(400,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(429,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(642,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(650,73): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(650,66): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(665,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(683,98): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(341,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(369,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(394,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(423,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(640,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(648,73): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(648,66): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(663,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(681,98): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(686,68): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(684,68): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(731,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(745,99): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(729,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(743,99): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(748,69): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(746,69): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(793,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(807,99): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(791,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(805,99): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(810,69): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(808,69): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(932,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(933,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(934,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(935,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(936,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(939,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(940,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(937,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(938,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(994,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(995,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(996,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(997,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(998,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1001,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1002,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1108,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1122,108): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(999,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1000,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1106,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1120,108): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1131,87): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1131,223): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1160,73): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1164,81): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1165,93): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1133,85): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1159,73): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1163,81): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1164,93): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1165,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1166,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1167,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1263,108): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1262,108): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
@ -89,8 +84,8 @@ C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1592,66): warning C4244
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1609,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1611,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu
1 of 723 functions ( 0.1%) were compiled, the rest were copied from previous compilation.
97 of 724 functions (13.4%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
9 functions had inline decision re-evaluated but remain unchanged
16 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe

Binary file not shown.

View File

@ -9,6 +9,7 @@ uniform vec3 cameraPos;
uniform sampler2D depthMap;
uniform sampler2D depthMap2;
uniform sampler2D depthMap3;
uniform sampler2D colorTexture;
uniform sampler2D metallicTexture;
uniform sampler2D roughnessTexture;
@ -17,6 +18,7 @@ uniform sampler2D normalSampler;
uniform vec3 sunDir;
uniform vec3 sunDir2;
uniform vec3 lampDir;
uniform vec3 sunColor;
uniform vec3 lightPos;
@ -49,6 +51,7 @@ float roughness;
in vec4 sunSpacePos;
in vec4 sunSpacePos2;
in vec4 lampSpacePos;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
@ -133,6 +136,19 @@ float calculateShadow2() {
return (0.5*(diff)/abs(diff))+0.5;
}
float calculateShadow3() {
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
float closestDepth = texture2D(depthMap3, sunSpacePosNormalized.xy).r;
if(closestDepth + 0.01 > sunSpacePosNormalized.z){
return 1.0;
} else {
return 0.0;
}
}
void main()
{
@ -175,5 +191,8 @@ void main()
//sun2
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
ilumination=ilumination+PBRLight(lampDir, sunColor * calculateShadow3(), normal, viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -10,6 +10,7 @@ uniform mat4 transformation;
uniform mat4 modelMatrix;
uniform mat4 LightVP;
uniform mat4 LightVP2;
uniform mat4 LightVP3;
out vec3 vecNormal;
out vec3 worldPos;
@ -26,6 +27,7 @@ out vec3 sunDirTS;
out vec2 vecTex;
out vec4 sunSpacePos;
out vec4 sunSpacePos2;
out vec4 lampSpacePos;
void main()
@ -49,5 +51,5 @@ void main()
sunDirTS = TBN*sunDir;
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
}

View File

@ -9,12 +9,14 @@ uniform vec3 cameraPos;
uniform sampler2D depthMap;
uniform sampler2D depthMap2;
uniform sampler2D depthMap3;
uniform sampler2D colorTexture;
uniform sampler2D armTexture;
uniform sampler2D normalSampler;
uniform vec3 sunDir;
uniform vec3 sunDir2;
uniform vec3 lampDir;
uniform vec3 sunColor;
uniform vec3 lightPos;
@ -47,7 +49,7 @@ float roughness;
in vec4 sunSpacePos;
in vec4 sunSpacePos2;
in vec4 lampSpacePos;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
float a = roughness*roughness;
@ -132,6 +134,19 @@ float calculateShadow2() {
return (0.5*(diff)/abs(diff))+0.5;
}
float calculateShadow3() {
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
float closestDepth = texture2D(depthMap3, sunSpacePosNormalized.xy).r;
if(closestDepth + 0.01 > sunSpacePosNormalized.z){
return 1.0;
} else {
return 0.0;
}
}
void main()
{
color = texture2D(colorTexture, vecTex).xyz;
@ -159,12 +174,12 @@ void main()
//flashlight
//vec3 spotlightDir= normalize(spotlightDirTS);
vec3 spotlightDir= normalize(spotlightPos-worldPos);
//vec3 spotlightDir= normalize(spotlightPos-worldPos);
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
@ -172,6 +187,9 @@ void main()
//sun2
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
//lamp
ilumination=ilumination+PBRLight(lampDir, sunColor * calculateShadow3(), normal, viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -10,6 +10,7 @@ uniform mat4 transformation;
uniform mat4 modelMatrix;
uniform mat4 LightVP;
uniform mat4 LightVP2;
uniform mat4 LightVP3;
out vec3 vecNormal;
out vec3 worldPos;
@ -26,6 +27,7 @@ out vec3 sunDirTS;
out vec2 vecTex;
out vec4 sunSpacePos;
out vec4 sunSpacePos2;
out vec4 lampSpacePos;
void main()
{
@ -48,5 +50,5 @@ void main()
sunDirTS = TBN*sunDir;
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
}

View File

@ -93,8 +93,10 @@ namespace models {
Core::RenderContext mug2Context;
Core::RenderContext bookContext;
Core::RenderContext lampContext;
Core::RenderContext cableContext;
}
std::vector<std::string> faces = {
"textures/skybox_2/right.jpg",
"textures/skybox_2/left.jpg",
@ -321,6 +323,8 @@ glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f);
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f);
glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f);
glm::vec3 sunDir2 = glm::vec3(0.93633f, 0.351106, -0.003226f);
glm::vec3 lampPos = glm::vec3(1.5, 1.15, -1.1);
glm::vec3 lampDir = glm::vec3(-0.2, -1.0, 0.3);
glm::vec3 sunColor = glm::vec3(0.9f, 0.9f, 0.7f) * 5;
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
@ -337,26 +341,16 @@ float exposition = 1.f;
float spotlightPhi = 3.14 / 4;
glm::vec3 spotlightPos = glm::vec3(1.5, 1.15, -1.1);
glm::vec3 spotlightConeDir = glm::vec3(0, -1, 0);
glm::vec3 spotlightConeDir = glm::vec3(-0.2, -1.0, 0.3);
glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3;
glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0));
glm::mat4 lightVP2 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos2, sunPos2 - sunDir2, glm::vec3(0, 1, 0));
glm::mat4 lightVP3 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(spotlightPos, spotlightPos - spotlightConeDir, glm::vec3(0, 1, 0));
//glm::mat4 lightVP3 = glm::ortho(-10.0f,10.0f,-10.0f,10.0f,0.1f,10.f) * glm::lookAt(spotlightPos, -spotlightConeDir,glm::vec3(0.0,1.0,0.0));
glm::mat4 ort = glm::ortho(-3.0f, 3.0f, -3.0f, 3.0f, 0.1f, 3.0f);
glm::mat4 lightView = glm::lookAt(spotlightPos, spotlightPos+spotlightConeDir, glm::vec3(0.0, 1.0, 0.0));
//glm::mat4 lightVP3 = glm::perspective(glm::radians(180.0f), 1.0f, 0.05f, 25.0f) * glm::lookAt(spotlightPos, spotlightPos - spotlightConeDir, glm::vec3(0, 1, 0));
//glm::mat4 lightVP3 = ort * lightView;
glm::vec3 pointlightPos = glm::vec3(0, 2, 0);
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
//glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
//glm::vec3 spotlightConeDir = glm::vec3(0, 0, 0);
//glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3;
glm::vec3 lightPos = glm::vec3(-8, 4, 2);
float lastTime = -1.f;
@ -461,6 +455,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
glUniform3f(glGetUniformLocation(program, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(program, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -500,6 +495,7 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro
glUniform3f(glGetUniformLocation(programTex, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTex, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTex, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTex, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -542,6 +538,7 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin
glUniform3f(glGetUniformLocation(programTexPBR, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTexPBR, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -588,6 +585,7 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -1122,10 +1120,11 @@ void renderScene(GLFWwindow* window)
glUseProgram(program);
glm::mat4 transform(1.0f);
//transform = glm::rotate(glm::mat4(), angle, glm::vec3(1.0f, 0.0f, 0.0f));
drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0);
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0);
//drawObjectPBR(models::fanContext, glm::mat4(), glm::vec3(0.01, 0.01, 0.01), 0.1, 0.2);
//drawObjectPBR(models::fanTopContext, glm::mat4()*rotate, glm::vec3(0.01, 0.01, 0.01), 0.1, 0.2);
drawObjectPBR(models::ceilingContext, glm::mat4(), glm::vec3(1,1,1), 0.5, 0);
drawObjectPBR(models::cableContext, glm::mat4(), glm::vec3(0.1, 0.1, 0.1), 0.3, 0.3);
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
@ -1440,7 +1439,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/spray.obj", shipContext, false);
//loadModelToContext("./models/bed.obj", models::bedContext, true);
//loadModelToContext("./models/chair.obj", models::chairContext, true);
loadModelToContext("./models/desk.obj", models::deskContext, true);
loadModelToContext("./models/desk.obj", models::deskContext, false);
//loadModelToContext("./models/door.obj", models::doorContext, false);
//loadModelToContext("./models/drawer.obj", models::drawerContext, false);
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext, false);
@ -1464,7 +1463,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/bed_pillow.obj", models::bed_pillowContext, false);
loadModelToContext("./models/paplan.obj", models::blanketContext, false);
loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, false);
loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, true);
loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, false);
loadModelToContext("./models/Cube_002.obj", models::paper_stack2Context, false);
loadModelToContext("./models/Cube_009.obj", models::paper_stack3Context, false);
@ -1477,7 +1476,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/20848_Folding_Screen_v3.obj", models::foldingContext, true);
loadModelToContext("./models/Foot_Rest_001.obj", models::couchContext, true);
loadModelToContext("./models/dor.obj", models::doorContext, false);
loadModelToContext("./models/uploads_files_1938755_KAUSTBY.obj", models::chairContext, false);
loadModelToContext("./models/uploads_files_1938755_KAUSTBY.obj", models::chairContext, true);
loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, false);
loadModelToContext("./models/laptop.obj", models::laptopContext, false);
loadModelToContext("./models/screen.obj", models::screenContext, false);
@ -1501,6 +1500,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/mug2.obj", models::mug2Context, false);
loadModelToContext("./models/book.obj", models::bookContext, false);
loadModelToContext("./models/lamp.obj", models::lampContext, false);
loadModelToContext("./models/cable.obj", models::cableContext, false);
collisionSystem.calculateSceneBounding();