To Aniela robiła
This commit is contained in:
parent
fabeef2cd6
commit
d994de46eb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,88 +9,83 @@ 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(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(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\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(338,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(376,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(401,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(430,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(643,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(651,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(651,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(666,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(684,98): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(687,68): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(732,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(746,99): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(749,69): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(794,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(808,99): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(811,69): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
T=float
|
||||||
]
|
]
|
||||||
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(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(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(937,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(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(940,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
|
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(941,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
|
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(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(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(1000,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
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(1001,23): 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(1104,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(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(1118,108): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
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"
|
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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"
|
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1127,87): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
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(1127,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(1156,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(1160,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(1161,93): 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(1162,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(1163,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(1259,108): warning C4305: "argument": obcięcie z "double" do "T"
|
||||||
with
|
with
|
||||||
[
|
[
|
||||||
T=float
|
T=float
|
||||||
]
|
]
|
||||||
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1592,66): warning C4244: "=": konwersja z "double" do "T", możliwa utrata danych
|
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1590,21): warning C4305: "-=": obcięcie z "double" do "float"
|
||||||
with
|
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1592,21): warning C4305: "+=": obcięcie z "double" do "float"
|
||||||
[
|
|
||||||
T=float
|
|
||||||
]
|
|
||||||
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
|
Trwa generowanie kodu
|
||||||
1 of 723 functions ( 0.1%) were compiled, the rest were copied from previous compilation.
|
124 of 725 functions (17.1%) were compiled, the rest were copied from previous compilation.
|
||||||
0 functions were new in current compilation
|
2 functions were new in current compilation
|
||||||
9 functions had inline decision re-evaluated but remain unchanged
|
17 functions had inline decision re-evaluated but remain unchanged
|
||||||
Zakończono generowanie kodu
|
Zakończono generowanie kodu
|
||||||
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe
|
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -9,6 +9,7 @@ uniform vec3 cameraPos;
|
|||||||
|
|
||||||
uniform sampler2D depthMap;
|
uniform sampler2D depthMap;
|
||||||
uniform sampler2D depthMap2;
|
uniform sampler2D depthMap2;
|
||||||
|
uniform sampler2D depthMap3;
|
||||||
uniform sampler2D colorTexture;
|
uniform sampler2D colorTexture;
|
||||||
uniform sampler2D metallicTexture;
|
uniform sampler2D metallicTexture;
|
||||||
uniform sampler2D roughnessTexture;
|
uniform sampler2D roughnessTexture;
|
||||||
@ -17,6 +18,7 @@ uniform sampler2D normalSampler;
|
|||||||
|
|
||||||
uniform vec3 sunDir;
|
uniform vec3 sunDir;
|
||||||
uniform vec3 sunDir2;
|
uniform vec3 sunDir2;
|
||||||
|
uniform vec3 lampDir;
|
||||||
uniform vec3 sunColor;
|
uniform vec3 sunColor;
|
||||||
|
|
||||||
uniform vec3 lightPos;
|
uniform vec3 lightPos;
|
||||||
@ -49,6 +51,7 @@ float roughness;
|
|||||||
|
|
||||||
in vec4 sunSpacePos;
|
in vec4 sunSpacePos;
|
||||||
in vec4 sunSpacePos2;
|
in vec4 sunSpacePos2;
|
||||||
|
in vec4 lampSpacePos;
|
||||||
|
|
||||||
|
|
||||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||||
@ -133,6 +136,19 @@ float calculateShadow2() {
|
|||||||
return (0.5*(diff)/abs(diff))+0.5;
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
@ -175,5 +191,8 @@ void main()
|
|||||||
|
|
||||||
//sun2
|
//sun2
|
||||||
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
|
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);
|
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ uniform mat4 transformation;
|
|||||||
uniform mat4 modelMatrix;
|
uniform mat4 modelMatrix;
|
||||||
uniform mat4 LightVP;
|
uniform mat4 LightVP;
|
||||||
uniform mat4 LightVP2;
|
uniform mat4 LightVP2;
|
||||||
|
uniform mat4 LightVP3;
|
||||||
|
|
||||||
out vec3 vecNormal;
|
out vec3 vecNormal;
|
||||||
out vec3 worldPos;
|
out vec3 worldPos;
|
||||||
@ -26,6 +27,7 @@ out vec3 sunDirTS;
|
|||||||
out vec2 vecTex;
|
out vec2 vecTex;
|
||||||
out vec4 sunSpacePos;
|
out vec4 sunSpacePos;
|
||||||
out vec4 sunSpacePos2;
|
out vec4 sunSpacePos2;
|
||||||
|
out vec4 lampSpacePos;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@ -49,5 +51,5 @@ void main()
|
|||||||
sunDirTS = TBN*sunDir;
|
sunDirTS = TBN*sunDir;
|
||||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||||
|
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,14 @@ uniform vec3 cameraPos;
|
|||||||
|
|
||||||
uniform sampler2D depthMap;
|
uniform sampler2D depthMap;
|
||||||
uniform sampler2D depthMap2;
|
uniform sampler2D depthMap2;
|
||||||
|
uniform sampler2D depthMap3;
|
||||||
uniform sampler2D colorTexture;
|
uniform sampler2D colorTexture;
|
||||||
uniform sampler2D armTexture;
|
uniform sampler2D armTexture;
|
||||||
uniform sampler2D normalSampler;
|
uniform sampler2D normalSampler;
|
||||||
|
|
||||||
uniform vec3 sunDir;
|
uniform vec3 sunDir;
|
||||||
uniform vec3 sunDir2;
|
uniform vec3 sunDir2;
|
||||||
|
uniform vec3 lampDir;
|
||||||
uniform vec3 sunColor;
|
uniform vec3 sunColor;
|
||||||
|
|
||||||
uniform vec3 lightPos;
|
uniform vec3 lightPos;
|
||||||
@ -47,7 +49,7 @@ float roughness;
|
|||||||
|
|
||||||
in vec4 sunSpacePos;
|
in vec4 sunSpacePos;
|
||||||
in vec4 sunSpacePos2;
|
in vec4 sunSpacePos2;
|
||||||
|
in vec4 lampSpacePos;
|
||||||
|
|
||||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||||
float a = roughness*roughness;
|
float a = roughness*roughness;
|
||||||
@ -132,6 +134,19 @@ float calculateShadow2() {
|
|||||||
return (0.5*(diff)/abs(diff))+0.5;
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
color = texture2D(colorTexture, vecTex).xyz;
|
color = texture2D(colorTexture, vecTex).xyz;
|
||||||
@ -159,12 +174,12 @@ void main()
|
|||||||
|
|
||||||
//flashlight
|
//flashlight
|
||||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
//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);
|
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
|
||||||
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
||||||
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
||||||
|
|
||||||
//sun
|
//sun
|
||||||
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||||
@ -172,6 +187,9 @@ void main()
|
|||||||
|
|
||||||
//sun2
|
//sun2
|
||||||
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
|
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);
|
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ uniform mat4 transformation;
|
|||||||
uniform mat4 modelMatrix;
|
uniform mat4 modelMatrix;
|
||||||
uniform mat4 LightVP;
|
uniform mat4 LightVP;
|
||||||
uniform mat4 LightVP2;
|
uniform mat4 LightVP2;
|
||||||
|
uniform mat4 LightVP3;
|
||||||
|
|
||||||
out vec3 vecNormal;
|
out vec3 vecNormal;
|
||||||
out vec3 worldPos;
|
out vec3 worldPos;
|
||||||
@ -26,6 +27,7 @@ out vec3 sunDirTS;
|
|||||||
out vec2 vecTex;
|
out vec2 vecTex;
|
||||||
out vec4 sunSpacePos;
|
out vec4 sunSpacePos;
|
||||||
out vec4 sunSpacePos2;
|
out vec4 sunSpacePos2;
|
||||||
|
out vec4 lampSpacePos;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
@ -48,5 +50,5 @@ void main()
|
|||||||
sunDirTS = TBN*sunDir;
|
sunDirTS = TBN*sunDir;
|
||||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||||
|
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
|
||||||
}
|
}
|
||||||
|
@ -265,11 +265,11 @@ namespace texture {
|
|||||||
GLuint spray_ao;
|
GLuint spray_ao;
|
||||||
GLuint spray_normal;
|
GLuint spray_normal;
|
||||||
|
|
||||||
GLuint lamp_albedo;
|
|
||||||
GLuint lamp_metallic;
|
|
||||||
GLuint lamp_ao;
|
|
||||||
GLuint lamp_roughness;
|
GLuint lamp_roughness;
|
||||||
|
GLuint lamp_metallic;
|
||||||
|
GLuint lamp_albedo;
|
||||||
GLuint lamp_normal;
|
GLuint lamp_normal;
|
||||||
|
GLuint lamp_ao;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint depthMapFBO;
|
GLuint depthMapFBO;
|
||||||
@ -311,12 +311,13 @@ glm::vec3 bubbleOriginalLocation[bubbleQuantity];
|
|||||||
bool bubbleZdir[bubbleQuantity];
|
bool bubbleZdir[bubbleQuantity];
|
||||||
bool bubbleXdir[bubbleQuantity];
|
bool bubbleXdir[bubbleQuantity];
|
||||||
|
|
||||||
CONST int bubblenumber = 1;
|
CONST int bubblenumber = 500;
|
||||||
glm::vec3 bubbleLocationInRoom[bubblenumber];
|
glm::vec3 bubbleLocationInRoom[bubblenumber];
|
||||||
glm::vec3 bubbleOriginalLocationInRoom[bubblenumber];
|
glm::vec3 bubbleOriginalLocationInRoom[bubblenumber];
|
||||||
bool bubbleZdirInRoom[bubblenumber];
|
bool bubbleZdirInRoom[bubblenumber];
|
||||||
bool bubbleXdirInRoom[bubblenumber];
|
bool bubbleXdirInRoom[bubblenumber];
|
||||||
|
|
||||||
|
|
||||||
glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f);
|
glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f);
|
||||||
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f);
|
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f);
|
||||||
glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f);
|
glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f);
|
||||||
@ -345,7 +346,7 @@ glm::mat4 lightVP2 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::loo
|
|||||||
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(-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 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 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 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 = 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::mat4 lightVP3 = ort * lightView;
|
||||||
|
|
||||||
@ -471,7 +472,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
|
|||||||
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spotlightColor.x, spotlightColor.y, spotlightColor.z);
|
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spotlightColor.x, spotlightColor.y, spotlightColor.z);
|
||||||
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spotlightPhi);
|
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spotlightPhi);
|
||||||
|
|
||||||
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
||||||
Core::SetActiveTexture(depthMap, "depthMap", program, 0);
|
Core::SetActiveTexture(depthMap, "depthMap", program, 0);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
||||||
@ -513,7 +514,7 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro
|
|||||||
|
|
||||||
//Core::DrawContext(context);
|
//Core::DrawContext(context);
|
||||||
|
|
||||||
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
||||||
Core::SetActiveTexture(depthMap, "depthMap", programTex, 1);
|
Core::SetActiveTexture(depthMap, "depthMap", programTex, 1);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
||||||
@ -559,7 +560,7 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin
|
|||||||
|
|
||||||
//Core::DrawContext(context);
|
//Core::DrawContext(context);
|
||||||
|
|
||||||
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
||||||
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0);
|
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
||||||
@ -603,7 +604,7 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G
|
|||||||
|
|
||||||
//Core::DrawContext(context);
|
//Core::DrawContext(context);
|
||||||
|
|
||||||
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
|
||||||
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0);
|
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
|
||||||
@ -644,15 +645,15 @@ void drawBubble(glm::mat4 transformSphere) {
|
|||||||
glm::mat4 cameraMatrix = createCameraMatrix();
|
glm::mat4 cameraMatrix = createCameraMatrix();
|
||||||
glm::mat4 perspectiveMatrix = createPerspectiveMatrix();
|
glm::mat4 perspectiveMatrix = createPerspectiveMatrix();
|
||||||
glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix;
|
glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix;
|
||||||
//glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
|
glm::mat4 transformation = viewProjectionMatrix * transformSphere;
|
||||||
glm::mat4 bubbleSkyboxViewMatrix = perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix));
|
glm::mat4 bubbleSkyboxViewMatrix = glm::mat3(perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix)));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programBubble, "transformation"), 1, GL_FALSE, (float*)&transformSphere);
|
glUniformMatrix4fv(glGetUniformLocation(programBubble, "transformation"), 1, GL_FALSE, (float*)&transformSphere);
|
||||||
glUniform3f(glGetUniformLocation(programBubble, "iResolution"), WIDTH, HEIGHT, 1.0);
|
glUniform3f(glGetUniformLocation(programBubble, "iResolution"), WIDTH, HEIGHT, 1.0);
|
||||||
glUniform1f(glGetUniformLocation(programBubble, "time"), time);
|
glUniform1f(glGetUniformLocation(programBubble, "time"), time);
|
||||||
//glUniform3f(glGetUniformLocation(programBubble, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z);
|
//glUniform3f(glGetUniformLocation(programBubble, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z);
|
||||||
//glUniform3f(glGetUniformLocation(programBubble, "cameraDir"), cameraDir.x, cameraDir.y, cameraDir.z);
|
//glUniform3f(glGetUniformLocation(programBubble, "cameraDir"), cameraDir.x, cameraDir.y, cameraDir.z);
|
||||||
glUniformMatrix3fv(glGetUniformLocation(programBubble, "camMat"), 1, GL_FALSE, (float*)&glm::mat3(bubbleSkyboxViewMatrix));
|
glUniformMatrix3fv(glGetUniformLocation(programBubble, "camMat"), 1, GL_FALSE, (float*)&glm::mat3(bubbleSkyboxViewMatrix));
|
||||||
|
|
||||||
Core::SetActiveTexture(bubbleTexture0, "iChannel0", programBubble, 1);
|
Core::SetActiveTexture(bubbleTexture0, "iChannel0", programBubble, 1);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, bubbleTexture0);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, bubbleTexture0);
|
||||||
Core::SetActiveTexture(bubbleTexture1, "iChannel1", programBubble, 0);
|
Core::SetActiveTexture(bubbleTexture1, "iChannel1", programBubble, 0);
|
||||||
@ -675,7 +676,7 @@ void renderShadowapSun(float angle) {
|
|||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
//ustawianie programu
|
//ustawianie programu
|
||||||
glUseProgram(programDepth);
|
glUseProgram(programDepth);
|
||||||
|
|
||||||
glm::mat4 p1 = glm::translate(glm::mat4(), -glm::vec3(-2.103f, 1.0699f, -2.3338f));
|
glm::mat4 p1 = glm::translate(glm::mat4(), -glm::vec3(-2.103f, 1.0699f, -2.3338f));
|
||||||
glm::mat4 p2 = glm::translate(glm::mat4(), glm::vec3(-2.103f, 1.0699f, -2.3338f));
|
glm::mat4 p2 = glm::translate(glm::mat4(), glm::vec3(-2.103f, 1.0699f, -2.3338f));
|
||||||
glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1;
|
glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1;
|
||||||
@ -710,8 +711,8 @@ void renderShadowapSun(float angle) {
|
|||||||
drawObjectDepth(models::books1Context, lightVP, glm::mat4());
|
drawObjectDepth(models::books1Context, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::books2Context, lightVP, glm::mat4());
|
drawObjectDepth(models::books2Context, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::cactusContext, lightVP, glm::mat4());
|
drawObjectDepth(models::cactusContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::fanContext, lightVP,glm::mat4());
|
drawObjectDepth(models::fanContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4()*rotate);
|
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4() * rotate);
|
||||||
drawObjectDepth(models::tableContext, lightVP, glm::mat4());
|
drawObjectDepth(models::tableContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::handleContext, lightVP, glm::mat4());
|
drawObjectDepth(models::handleContext, lightVP, glm::mat4());
|
||||||
drawObjectDepth(models::pillow1Context, lightVP, glm::mat4());
|
drawObjectDepth(models::pillow1Context, lightVP, glm::mat4());
|
||||||
@ -958,9 +959,6 @@ void bubbleMovement(int i) {
|
|||||||
else if (bubbleLocation[i].z < bubbleOriginalLocation[i].z - bubbleWobbling * bubbleWobblingDivider) {
|
else if (bubbleLocation[i].z < bubbleOriginalLocation[i].z - bubbleWobbling * bubbleWobblingDivider) {
|
||||||
bubbleZdir[i] = true;
|
bubbleZdir[i] = true;
|
||||||
}
|
}
|
||||||
bubbleZdir[i] = false;
|
|
||||||
bubbleXdir[i] = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (bubbleXdir[i]) {
|
if (bubbleXdir[i]) {
|
||||||
@ -977,18 +975,19 @@ void bubbleMovement(int i) {
|
|||||||
bubbleLocation[i].z -= bubbleWobbling;
|
bubbleLocation[i].z -= bubbleWobbling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y <= -10.0 ) {
|
if (y <= -10.0) {
|
||||||
bubbleLocation[i].y = 10.0;
|
bubbleLocation[i].y = 10.0;
|
||||||
}
|
}
|
||||||
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36) ) {
|
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36)) {
|
||||||
bubbleLocation[i].y = 10.0;
|
bubbleLocation[i].y = 10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bubbleLocation[i].y -= bubbleDown;
|
bubbleLocation[i].y -= bubbleDown;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void bubbleMovementInRoom(int i) {
|
void bubbleMovementInRoom(int i) {
|
||||||
|
|
||||||
float bubbleWobblingDivider = 100;
|
float bubbleWobblingDivider = 100;
|
||||||
@ -999,7 +998,7 @@ void bubbleMovementInRoom(int i) {
|
|||||||
|
|
||||||
|
|
||||||
float bubbleWobbling = 0.0005;
|
float bubbleWobbling = 0.0005;
|
||||||
float bubbleDown = 0.05;
|
float bubbleUp = 0.05;
|
||||||
|
|
||||||
//printf(xDir ? "true\n" : "false\n");
|
//printf(xDir ? "true\n" : "false\n");
|
||||||
//printf(zDir ? "true\n" : "false\n");
|
//printf(zDir ? "true\n" : "false\n");
|
||||||
@ -1018,40 +1017,35 @@ void bubbleMovementInRoom(int i) {
|
|||||||
bubbleZdirInRoom[i] = false;
|
bubbleZdirInRoom[i] = false;
|
||||||
}
|
}
|
||||||
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) {
|
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) {
|
||||||
bubbleZdir[i] = true;
|
bubbleZdirInRoom[i] = true;
|
||||||
}
|
}
|
||||||
bubbleZdirInRoom[i] = false;
|
|
||||||
bubbleXdirInRoom[i] = false;
|
|
||||||
|
|
||||||
if (bubbleXdirInRoom[i]) {
|
if (bubbleXdirInRoom[i]) {
|
||||||
bubbleLocation[i].x += bubbleWobbling;
|
bubbleLocationInRoom[i].x += bubbleWobbling;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bubbleLocationInRoom[i].x -= bubbleWobbling;
|
bubbleLocationInRoom[i].x -= bubbleWobbling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bubbleZdirInRoom[i]) {
|
if (bubbleZdirInRoom[i]) {
|
||||||
bubbleLocation[i].z += bubbleWobbling;
|
bubbleLocationInRoom[i].z += bubbleWobbling;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bubbleLocationInRoom[i].z -= bubbleWobbling;
|
bubbleLocationInRoom[i].z -= bubbleWobbling;
|
||||||
}
|
}
|
||||||
//if (y <= -10.0) {
|
|
||||||
// bubbleLocationInRoom[i].y = 10.0;
|
|
||||||
//}
|
|
||||||
//if (x > (-1.0 + 0.5) && x <= (-1.0 - 0.5) && z > (-1.2 + 0.5) && z <= (-1.2 - 0.5) && y > (1.0 + 2.36)) {
|
|
||||||
//bubbleLocationInRoom[i].y = 4.0;
|
|
||||||
|
|
||||||
//}
|
if (y >= (1.0 + 1.9)) {
|
||||||
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36)) {
|
bubbleLocationInRoom[i].y = -1;
|
||||||
if (x > (0 + 0.01) || x <= (0 - 0.01) || z > (0 + 0.01) || z <= (0 - 0.01) || y > 2 || y <= 0)
|
}
|
||||||
{
|
if (x <= (-1.0 + 2) && x > (-1.0 - 2) && z <= (-1.2 + 2.3) && z > (-1.2 - 2.3) && y <= (1.0 + 1.9)) {
|
||||||
bubbleLocationInRoom[i].y = 3;
|
int l = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bubbleLocationInRoom[i].y = -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bubbleLocationInRoom[i].y -= bubbleDown;
|
|
||||||
|
bubbleLocationInRoom[i].y += bubbleUp;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1066,8 +1060,8 @@ void bubbleManager() {
|
|||||||
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
|
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
|
||||||
modelMatrix = glm::scale(modelMatrix, scale);
|
modelMatrix = glm::scale(modelMatrix, scale);
|
||||||
//glUseProgram(programTex);
|
//glUseProgram(programTex);
|
||||||
drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
|
//drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
|
||||||
//drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
|
drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
|
||||||
// srand(time(NULL));
|
// srand(time(NULL));
|
||||||
|
|
||||||
float MAX_NUM = 20.0;
|
float MAX_NUM = 20.0;
|
||||||
@ -1085,22 +1079,24 @@ void bubbleManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bubbleManagerInRoom() {
|
void bubbleManagerInRoom() {
|
||||||
for (int j = 0;j < bubblenumber; j++) {
|
|
||||||
bubbleMovementInRoom(j);
|
|
||||||
|
|
||||||
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[j]);
|
|
||||||
|
for (int i = 0; i < bubblenumber; i++)
|
||||||
|
{
|
||||||
|
bubbleMovementInRoom(i);
|
||||||
|
|
||||||
|
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[i]);
|
||||||
// Scaling models
|
// Scaling models
|
||||||
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
|
glm::vec3 scale = glm::vec3(0.1, 0.1, 0.1);
|
||||||
modelMatrix = glm::scale(modelMatrix, scale);
|
modelMatrix = glm::scale(modelMatrix, scale);
|
||||||
//glUseProgram(programTex);
|
//glUseProgram(programTex);
|
||||||
drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
|
//drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
|
||||||
//drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
|
//drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
|
||||||
// srand(time(NULL));
|
drawBubble(modelMatrix);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void renderScene(GLFWwindow* window)
|
void renderScene(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
|
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
|
||||||
@ -1131,7 +1127,7 @@ void renderScene(GLFWwindow* window)
|
|||||||
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::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::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::ceilingContext, glm::mat4(), glm::vec3(1, 1, 1), 0.5, 0);
|
||||||
|
|
||||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
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));
|
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||||
@ -1147,7 +1143,7 @@ void renderScene(GLFWwindow* window)
|
|||||||
// glm::translate(cameraPos + 1.5 * cameraDir + cameraUp * -0.5f) * inveseCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
// glm::translate(cameraPos + 1.5 * cameraDir + cameraUp * -0.5f) * inveseCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
||||||
// glm::vec3(0.3, 0.3, 0.5)
|
// glm::vec3(0.3, 0.3, 0.5)
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
|
||||||
//spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
|
//spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
|
||||||
//spotlightConeDir = spaceshipDir;
|
//spotlightConeDir = spaceshipDir;
|
||||||
@ -1221,9 +1217,9 @@ void renderScene(GLFWwindow* window)
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, depthMap3);
|
glBindTexture(GL_TEXTURE_2D, depthMap3);
|
||||||
Core::DrawContext(models::testContext);*/
|
Core::DrawContext(models::testContext);*/
|
||||||
|
|
||||||
bubbleManager();
|
|
||||||
bubbleManagerInRoom();
|
bubbleManagerInRoom();
|
||||||
|
bubbleManager();
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
@ -1265,7 +1261,7 @@ void init(GLFWwindow* window)
|
|||||||
initDepthMap();
|
initDepthMap();
|
||||||
initDepthMap2();
|
initDepthMap2();
|
||||||
initDepthMap3();
|
initDepthMap3();
|
||||||
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP);
|
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC | SND_LOOP);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
|
program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
|
||||||
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
|
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
|
||||||
@ -1433,12 +1429,6 @@ void init(GLFWwindow* window)
|
|||||||
texture::spray_ao = Core::LoadTexture("textures/spray/ao.png");
|
texture::spray_ao = Core::LoadTexture("textures/spray/ao.png");
|
||||||
texture::spray_normal = Core::LoadTexture("textures/spray/normal.png");
|
texture::spray_normal = Core::LoadTexture("textures/spray/normal.png");
|
||||||
|
|
||||||
texture::lamp_albedo = Core::LoadTexture("textures/lamp/albedo.png");
|
|
||||||
texture::lamp_metallic = Core::LoadTexture("textures/lamp/metallic.png");
|
|
||||||
texture::lamp_roughness = Core::LoadTexture("textures/lamp/roughness.png");
|
|
||||||
texture::lamp_ao = Core::LoadTexture("textures/lamp/ao.png");
|
|
||||||
texture::lamp_normal = Core::LoadTexture("textures/lamp/normal.png");
|
|
||||||
|
|
||||||
|
|
||||||
texture::metal = Core::LoadTexture("textures/metal.png");
|
texture::metal = Core::LoadTexture("textures/metal.png");
|
||||||
loadModelToContext("models/bubble.obj", bubbleContext, false);
|
loadModelToContext("models/bubble.obj", bubbleContext, false);
|
||||||
@ -1513,8 +1503,10 @@ void init(GLFWwindow* window)
|
|||||||
|
|
||||||
loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, true);
|
loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, true);
|
||||||
//collisionSystem.calculateSceneBounding();
|
//collisionSystem.calculateSceneBounding();
|
||||||
|
|
||||||
skyboxTexture = loadSkybox(faces);
|
skyboxTexture = loadSkybox(faces);
|
||||||
|
bubbleTexture0 = loadSkybox(facesBubble);
|
||||||
|
bubbleTexture1 = Core::LoadTexture("textures/bubbleNoise.jpg");
|
||||||
//drawSkybox(models::cubeContext, transformation, skyboxTexture);
|
//drawSkybox(models::cubeContext, transformation, skyboxTexture);
|
||||||
/*glUseProgram(programSkybox);
|
/*glUseProgram(programSkybox);
|
||||||
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), skyboxTexture);
|
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), skyboxTexture);
|
||||||
@ -1567,35 +1559,24 @@ void processInput(GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) {
|
||||||
texture::screen = Core::LoadTexture("textures/visual.png");
|
texture::screen = Core::LoadTexture("textures/visual.png");
|
||||||
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP);
|
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC | SND_LOOP);
|
||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS) {
|
||||||
for (int i = 0; i < bubbleQuantity; i++)
|
for (int i = 0; i < bubblenumber; i++)
|
||||||
{
|
{
|
||||||
// srand(time(NULL));
|
// srand(time(NULL));
|
||||||
float MAX_NUM = 20.0;
|
float MAX_NUM = 20.0;
|
||||||
|
|
||||||
bubbleLocation[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
|
bubbleLocationInRoom[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
|
||||||
bubbleLocation[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
|
bubbleLocationInRoom[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
|
||||||
bubbleLocation[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
|
bubbleLocationInRoom[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
|
||||||
|
|
||||||
bubbleOriginalLocation[i] = bubbleLocation[i];
|
bubbleOriginalLocationInRoom[i] = bubbleLocationInRoom[i];
|
||||||
|
|
||||||
bubbleZdir[i] = true;
|
bubbleZdirInRoom[i] = true;
|
||||||
bubbleXdir[i] = false;
|
bubbleXdirInRoom[i] = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS) {
|
|
||||||
for (int j = 0; j < bubblenumber;j++) {
|
|
||||||
bubbleLocationInRoom[j].x = (float)rand() / (float)(RAND_MAX);
|
|
||||||
bubbleLocationInRoom[j].z = (float)rand() / (float)(RAND_MAX);
|
|
||||||
bubbleLocationInRoom[j].y = (int)rand() % (int)(3.0 - 2.5 + 1) + 2.5;
|
|
||||||
|
|
||||||
bubbleOriginalLocationInRoom[j] = bubbleLocationInRoom[j];
|
|
||||||
|
|
||||||
bubbleZdirInRoom[j] = true;
|
|
||||||
bubbleXdirInRoom[j] = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraDir = spaceshipDir;
|
cameraDir = spaceshipDir;
|
||||||
|
Loading…
Reference in New Issue
Block a user