Compare commits
No commits in common. "master" and "Bubble" have entirely different histories.
10
Readme.md
@ -1,10 +0,0 @@
|
||||
|
||||
# GRK Projekt
|
||||
|
||||
Water Causics / Particle Generator
|
||||
|
||||
Link do dokumentacji: https://uam-my.sharepoint.com/:w:/g/personal/julsad3_st_amu_edu_pl/Ea8GEqOLJMNLhxW9BBwQ2A0B0lOoyEtLEa4DNLNZkBfnqA?e=OCneeL&fbclid=IwAR3MKk2vUPXqkQhl-CC7CG04piLw_8zdY-GLTpl52MsLz2IEemNN9tcxXl4
|
||||
|
||||
Link do pobrania modeli: https://drive.google.com/drive/folders/1H9mCPv32GYCW7wTFX0St0C-mWTQPUpZ-?usp=sharing
|
||||
|
||||
Modele należy umieścić w cw 9/models.
|
@ -1,83 +1,38 @@
|
||||
main.cpp
|
||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
|
||||
C:\Users\sjule\source\repos\GRK_Project\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : see previous definition of 'APIENTRY'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(87,16): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(88,14): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(90,17): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(91,15): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: 'return': conversion from 'int' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: 'return': conversion from 'int' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(337,30): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(375,17): warning C4101: 'data': unreferenced local variable
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(400,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(429,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(642,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(650,73): warning C4244: 'argument': conversion from 'int' to 'GLfloat', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(650,66): warning C4244: 'argument': conversion from 'int' to 'GLfloat', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(662,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(680,98): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(108,30): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(122,17): warning C4101: 'data': unreferenced local variable
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(147,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(176,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(235,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(243,73): warning C4244: 'argument': conversion from 'int' to 'GLfloat', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(243,66): warning C4244: 'argument': conversion from 'int' to 'GLfloat', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(258,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(274,98): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(683,68): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(277,68): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(728,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(742,99): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(337,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(346,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(745,69): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(391,2): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(438,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(790,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(804,99): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(807,69): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(931,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(932,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(933,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(936,31): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(937,25): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(991,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(992,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(993,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(996,31): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(997,23): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1099,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1122,87): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1122,223): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1151,73): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1155,81): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1156,93): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1157,83): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1158,83): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1254,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1592,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(1594,21): warning C4305: '+=': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(517,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||
C:\Users\sjule\source\repos\GRK_Project\cw 9\src\ex_9_1.hpp(519,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\sjule\source\repos\GRK_Project\Debug\grk-cw9.exe
|
||||
|
@ -2,7 +2,7 @@
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\jedrz\Desktop\projekt final\GRK_Project\Release\grk-cw9.exe</FullPath>
|
||||
<FullPath>C:\Users\jedrz\Desktop\grk\Release\grk-cw9.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
|
@ -1,86 +1,50 @@
|
||||
main.cpp
|
||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY”
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\Collision_System.cpp(87,16): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\Collision_System.cpp(88,14): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\Collision_System.cpp(90,17): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\Collision_System.cpp(91,15): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\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\projekt final\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\projekt final\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\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(342,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(372,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(397,38): warning C4305: "=": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(426,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(644,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(657,73): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(657,66): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(669,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(687,98): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY”
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(96,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(110,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(135,38): warning C4305: "=": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(164,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(224,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(240,98): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(690,68): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(243,68): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(735,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(749,99): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(303,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(311,108): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(752,69): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(319,87): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(797,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(811,99): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(319,223): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(322,59): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(814,69): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(323,37): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(355,2): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(403,108): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(938,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(939,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(940,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(943,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(944,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\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\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(999,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1000,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1003,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1004,23): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\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\projekt final\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\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1133,85): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1159,73): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1163,81): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1164,93): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1165,83): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1166,83): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1264,108): warning C4305: "argument": obcięcie z "double" do "T"
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1610,21): warning C4305: "-=": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\projekt final\GRK_Project\cw 9\src\ex_9_1.hpp(1612,21): warning C4305: "+=": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(479,21): warning C4305: "-=": obcięcie z "double" do "float"
|
||||
C:\Users\jedrz\Desktop\grk\cw 9\src\ex_9_1.hpp(481,21): warning C4305: "+=": obcięcie z "double" do "float"
|
||||
Trwa generowanie kodu
|
||||
99 of 727 functions (13.6%) were compiled, the rest were copied from previous compilation.
|
||||
0 functions were new in current compilation
|
||||
24 functions had inline decision re-evaluated but remain unchanged
|
||||
65 of 605 functions (10.7%) were compiled, the rest were copied from previous compilation.
|
||||
18 functions were new in current compilation
|
||||
18 functions had inline decision re-evaluated but remain unchanged
|
||||
Zakończono generowanie kodu
|
||||
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\projekt final\GRK_Project\Release\grk-cw9.exe
|
||||
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\grk\Release\grk-cw9.exe
|
||||
|
@ -1,2 +1,2 @@
|
||||
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
|
||||
Release|Win32|C:\Users\jedrz\Desktop\projekt final\GRK_Project\|
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
|
||||
Release|Win32|C:\Users\jedrz\Desktop\grk\|
|
||||
|
@ -13,7 +13,6 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Box.cpp" />
|
||||
<ClCompile Include="src\Camera.cpp" />
|
||||
<ClCompile Include="src\Collision_System.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\Render_Utils.cpp" />
|
||||
<ClCompile Include="src\Shader_Loader.cpp" />
|
||||
@ -50,12 +49,6 @@
|
||||
<None Include="shaders\shader_shadowap_sun.vert" />
|
||||
<None Include="shaders\shader_skybox.frag" />
|
||||
<None Include="shaders\shader_skybox.vert" />
|
||||
<None Include="shaders\shader_tex.frag" />
|
||||
<None Include="shaders\shader_tex.vert" />
|
||||
<None Include="shaders\shader_tex_pbr.frag" />
|
||||
<None Include="shaders\shader_tex_pbr.vert" />
|
||||
<None Include="shaders\shader_tex_pbr_arm.frag" />
|
||||
<None Include="shaders\shader_tex_pbr_arm.vert" />
|
||||
<None Include="shaders\shader_water.frag" />
|
||||
<None Include="shaders\shader_water.vert" />
|
||||
<None Include="shaders\test.frag" />
|
||||
|
@ -54,9 +54,6 @@
|
||||
<ClCompile Include="src\TriangleSoup.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Collision_System.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\objload.h">
|
||||
@ -136,24 +133,6 @@
|
||||
<None Include="shaders\shader_water.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex.frag">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex_pbr.frag">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex_pbr.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex_pbr_arm.frag">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_tex_pbr_arm.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_bubble.frag">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
|
@ -1,13 +0,0 @@
|
||||
#version 410 core
|
||||
|
||||
uniform vec3 objectColor;
|
||||
uniform vec3 lightDir;
|
||||
|
||||
in vec3 interpNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 normal = normalize(interpNormal);
|
||||
float diffuse = 0.4;
|
||||
gl_FragColor = vec4(objectColor * diffuse, 1.0);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0) in vec3 vertexPosition;
|
||||
layout(location = 1) in vec3 vertexNormal;
|
||||
layout(location = 2) in vec2 vertexTexCoord;
|
||||
|
||||
uniform mat4 modelViewProjectionMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
|
||||
out vec3 interpNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0);
|
||||
interpNormal = (modelMatrix * vec4(vertexNormal, 0.0)).xyz;
|
||||
}
|
@ -1,17 +1,15 @@
|
||||
#version 430 core
|
||||
|
||||
float AMBIENT = 0.5;
|
||||
float AMBIENT = 0.03;
|
||||
float PI = 3.14;
|
||||
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D depthMap2;
|
||||
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
uniform vec3 color;
|
||||
|
||||
uniform vec3 sunDir;
|
||||
uniform vec3 sunDir2;
|
||||
uniform vec3 sunColor;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
@ -40,7 +38,6 @@ in vec3 sunDirTS;
|
||||
|
||||
in vec3 test;
|
||||
in vec4 sunSpacePos;
|
||||
in vec4 sunSpacePos2;
|
||||
|
||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||
float a = roughness*roughness;
|
||||
@ -115,16 +112,6 @@ float calculateShadow() {
|
||||
}
|
||||
}
|
||||
|
||||
float calculateShadow2() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
return (0.5*(diff)/abs(diff))+0.5;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -155,8 +142,6 @@ void main()
|
||||
//sun
|
||||
ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir);
|
||||
|
||||
//sun2
|
||||
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
|
||||
|
||||
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
|
||||
//outColor = vec4(roughness,metallic,0,1);
|
||||
|
@ -9,7 +9,6 @@ layout(location = 4) in vec3 vertexBitangent;
|
||||
uniform mat4 transformation;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 LightVP;
|
||||
uniform mat4 LightVP2;
|
||||
|
||||
out vec3 vecNormal;
|
||||
out vec3 worldPos;
|
||||
@ -24,7 +23,6 @@ out vec3 lightDirTS;
|
||||
out vec3 spotlightDirTS;
|
||||
out vec3 sunDirTS;
|
||||
out vec4 sunSpacePos;
|
||||
out vec4 sunSpacePos2;
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -44,5 +42,4 @@ void main()
|
||||
spotlightDirTS = TBN*SL;
|
||||
sunDirTS = TBN*sunDir;
|
||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
#version 430 core
|
||||
uniform vec3 iResolution;
|
||||
//uniform vec3 cameraPos;
|
||||
//uniform vec3 cameraDir;
|
||||
uniform mat3 camMat;
|
||||
uniform sampler2D iChannel1;
|
||||
uniform samplerCube iChannel0;
|
||||
uniform float time;
|
||||
@ -233,6 +236,7 @@ void main()
|
||||
// camera movement
|
||||
//vec3 ro, ta;
|
||||
//doCamera( ro, ta, iTime, m );
|
||||
//mat3 camMat = calcLookAtMatrix( cameraPos, cameraDir, 0.0 );
|
||||
|
||||
float dh = (0.666 / iResolution.y);
|
||||
const float rads = TWO_PI / float(AA_SAMPLES);
|
||||
@ -248,8 +252,8 @@ void main()
|
||||
|
||||
for (int samp = 0; samp < AA_SAMPLES; samp++) {
|
||||
vec2 dxy = dh * vec2(cos(float(samp) * rads), sin(float(samp) * rads));
|
||||
vec3 rd = normalize(vec3(p.xy + dxy, 0.2)); // 1.5 is the lens length
|
||||
vec3 pos = vec3(-bubblePosition.z, -bubblePosition.y, bubblePosition.x);
|
||||
vec3 rd = normalize(camMat * vec3(p.xy + dxy, 1.5)); // 1.5 is the lens length
|
||||
vec3 pos = bubblePosition.xyz;
|
||||
bool hit = false;
|
||||
for (int j = 0; j < ITERATIONS; j++) {
|
||||
float t = DIST_SCALE * sdf(pos);
|
||||
|
@ -14,6 +14,6 @@ void main()
|
||||
{
|
||||
bubblePosition = transformation * vec4(vertexPosition, 1.0);
|
||||
//vec3 bubbling = sdf(bubblePosition2.xyz);
|
||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||
gl_Position = bubblePosition;
|
||||
//gl_Position = vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
@ -1,168 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
float AMBIENT = 0.5;
|
||||
float PI = 3.14;
|
||||
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D depthMap2;
|
||||
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
uniform sampler2D colorTexture;
|
||||
|
||||
uniform vec3 sunDir;
|
||||
uniform vec3 sunDir2;
|
||||
uniform vec3 sunColor;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 lightColor;
|
||||
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 spotlightColor;
|
||||
uniform vec3 spotlightConeDir;
|
||||
uniform vec3 spotlightPhi;
|
||||
|
||||
uniform float metallic;
|
||||
uniform float roughness;
|
||||
|
||||
|
||||
uniform float exposition;
|
||||
|
||||
in vec3 vecNormal;
|
||||
in vec3 worldPos;
|
||||
in vec2 vecTex;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
|
||||
in vec3 viewDirTS;
|
||||
in vec3 lightDirTS;
|
||||
in vec3 spotlightDirTS;
|
||||
in vec3 sunDirTS;
|
||||
|
||||
in vec4 sunSpacePos;
|
||||
in vec4 sunSpacePos2;
|
||||
|
||||
vec3 color;
|
||||
|
||||
|
||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||
float a = roughness*roughness;
|
||||
float a2 = a*a;
|
||||
float NdotH = max(dot(normal, H), 0.0);
|
||||
float NdotH2 = NdotH*NdotH;
|
||||
|
||||
float num = a2;
|
||||
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
||||
denom = PI * denom * denom;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySchlickGGX(float NdotV, float roughness){
|
||||
float r = (roughness + 1.0);
|
||||
float k = (r*r) / 8.0;
|
||||
|
||||
float num = NdotV;
|
||||
float denom = NdotV * (1.0 - k) + k;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySmith(vec3 normal, vec3 V, vec3 lightDir, float roughness){
|
||||
float NdotV = max(dot(normal, V), 0.0);
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
||||
|
||||
return ggx1 * ggx2;
|
||||
}
|
||||
vec3 fresnelSchlick(float cosTheta, vec3 F0){
|
||||
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
||||
}
|
||||
|
||||
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
|
||||
float diffuse=max(0,dot(normal,lightDir));
|
||||
|
||||
//vec3 V = normalize(cameraPos-worldPos);
|
||||
vec3 F0 = vec3(0.04);
|
||||
F0 = mix(F0, color, metallic);
|
||||
|
||||
vec3 H = normalize(V + lightDir);
|
||||
|
||||
// cook-torrance brdf
|
||||
float NDF = DistributionGGX(normal, H, roughness);
|
||||
float G = GeometrySmith(normal, V, lightDir, roughness);
|
||||
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
|
||||
|
||||
vec3 kS = F;
|
||||
vec3 kD = vec3(1.0) - kS;
|
||||
kD *= 1.0 - metallic;
|
||||
|
||||
vec3 numerator = NDF * G * F;
|
||||
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
|
||||
vec3 specular = numerator / denominator;
|
||||
|
||||
// add to outgoing radiance Lo
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
return (kD * color / PI + specular) * radiance * NdotL;
|
||||
}
|
||||
|
||||
float calculateShadow() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
return (0.5*(diff)/abs(diff))+0.5;
|
||||
}
|
||||
|
||||
float calculateShadow2() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
return (0.5*(diff)/abs(diff))+0.5;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
color = texture(colorTexture, vecTex).xyz;
|
||||
|
||||
//vec3 normal = vec3(0,0,1);
|
||||
vec3 normal = normalize(vecNormal);
|
||||
|
||||
//vec3 viewDir = normalize(viewDirTS);
|
||||
vec3 viewDir = normalize(cameraPos-worldPos);
|
||||
|
||||
//vec3 lightDir = normalize(lightDirTS);
|
||||
vec3 lightDir = normalize(lightPos-worldPos);
|
||||
|
||||
|
||||
|
||||
vec3 ambient = AMBIENT*color;
|
||||
vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2);
|
||||
vec3 ilumination;
|
||||
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor,normal,viewDir);
|
||||
|
||||
//flashlight
|
||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||
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);
|
||||
|
||||
//sun
|
||||
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||
ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir);
|
||||
|
||||
//sun2
|
||||
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
|
||||
|
||||
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
layout(location = 0) in vec3 vertexPosition;
|
||||
layout(location = 1) in vec3 vertexNormal;
|
||||
layout(location = 2) in vec2 vertexTexCoord;
|
||||
layout(location = 3) in vec3 vertexTangent;
|
||||
layout(location = 4) in vec3 vertexBitangent;
|
||||
|
||||
uniform mat4 transformation;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 LightVP;
|
||||
uniform mat4 LightVP2;
|
||||
|
||||
out vec3 vecNormal;
|
||||
out vec3 worldPos;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 cameraPos;
|
||||
uniform vec3 sunDir;
|
||||
|
||||
out vec3 viewDirTS;
|
||||
out vec3 lightDirTS;
|
||||
out vec3 spotlightDirTS;
|
||||
out vec3 sunDirTS;
|
||||
out vec2 vecTex;
|
||||
out vec4 sunSpacePos;
|
||||
out vec4 sunSpacePos2;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vecTex = vertexTexCoord;
|
||||
vecTex.y = 1.0 - vecTex.y;
|
||||
|
||||
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
|
||||
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
|
||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||
|
||||
vec3 w_tangent = normalize(mat3(modelMatrix)*vertexTangent);
|
||||
vec3 w_bitangent = normalize(mat3(modelMatrix)*vertexBitangent);
|
||||
mat3 TBN = transpose(mat3(w_tangent, w_bitangent, vecNormal));
|
||||
|
||||
vec3 V = normalize(cameraPos-worldPos);
|
||||
viewDirTS = TBN*V;
|
||||
vec3 L = normalize(lightPos-worldPos);
|
||||
lightDirTS = TBN*L;
|
||||
vec3 SL = normalize(spotlightPos-worldPos);
|
||||
spotlightDirTS = TBN*SL;
|
||||
sunDirTS = TBN*sunDir;
|
||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
float AMBIENT = 0.5;
|
||||
float PI = 3.14;
|
||||
|
||||
|
||||
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D depthMap2;
|
||||
uniform sampler2D depthMap3;
|
||||
uniform sampler2D colorTexture;
|
||||
uniform sampler2D metallicTexture;
|
||||
uniform sampler2D roughnessTexture;
|
||||
uniform sampler2D aoTexture;
|
||||
uniform sampler2D normalSampler;
|
||||
|
||||
uniform vec3 sunDir;
|
||||
uniform vec3 sunDir2;
|
||||
uniform vec3 lampDir;
|
||||
uniform vec3 sunColor;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 lightColor;
|
||||
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 spotlightColor;
|
||||
uniform vec3 spotlightConeDir;
|
||||
uniform vec3 spotlightPhi;
|
||||
|
||||
|
||||
|
||||
uniform float exposition;
|
||||
|
||||
in vec3 vecNormal;
|
||||
in vec3 worldPos;
|
||||
in vec2 vecTex;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
|
||||
in vec3 viewDirTS;
|
||||
in vec3 lightDirTS;
|
||||
in vec3 spotlightDirTS;
|
||||
in vec3 sunDirTS;
|
||||
|
||||
vec3 color;
|
||||
float metallic;
|
||||
float roughness;
|
||||
|
||||
in vec4 sunSpacePos;
|
||||
in vec4 sunSpacePos2;
|
||||
in vec4 lampSpacePos;
|
||||
|
||||
|
||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||
float a = roughness*roughness;
|
||||
float a2 = a*a;
|
||||
float NdotH = max(dot(normal, H), 0.0);
|
||||
float NdotH2 = NdotH*NdotH;
|
||||
|
||||
float num = a2;
|
||||
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
||||
denom = PI * denom * denom;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySchlickGGX(float NdotV, float roughness){
|
||||
float r = (roughness + 1.0);
|
||||
float k = (r*r) / 8.0;
|
||||
|
||||
float num = NdotV;
|
||||
float denom = NdotV * (1.0 - k) + k;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySmith(vec3 normal, vec3 V, vec3 lightDir, float roughness){
|
||||
float NdotV = max(dot(normal, V), 0.0);
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
||||
|
||||
return ggx1 * ggx2;
|
||||
}
|
||||
vec3 fresnelSchlick(float cosTheta, vec3 F0){
|
||||
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
||||
}
|
||||
|
||||
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
|
||||
float diffuse=max(0,dot(normal,lightDir));
|
||||
|
||||
//vec3 V = normalize(cameraPos-worldPos);
|
||||
vec3 F0 = vec3(0.04);
|
||||
F0 = mix(F0, color, metallic);
|
||||
|
||||
vec3 H = normalize(V + lightDir);
|
||||
|
||||
// cook-torrance brdf
|
||||
float NDF = DistributionGGX(normal, H, roughness);
|
||||
float G = GeometrySmith(normal, V, lightDir, roughness);
|
||||
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
|
||||
|
||||
vec3 kS = F;
|
||||
vec3 kD = vec3(1.0) - kS;
|
||||
kD *= 1.0 - metallic;
|
||||
|
||||
vec3 numerator = NDF * G * F;
|
||||
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
|
||||
vec3 specular = numerator / denominator;
|
||||
|
||||
// add to outgoing radiance Lo
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
return (kD * color / PI + specular) * radiance * NdotL;
|
||||
}
|
||||
|
||||
float calculateShadow() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
return (0.5*(diff)/abs(diff))+0.5;
|
||||
}
|
||||
|
||||
float calculateShadow2() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
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;
|
||||
metallic = texture2D(metallicTexture, vecTex).r;
|
||||
roughness = texture2D(roughnessTexture, vecTex).r;
|
||||
|
||||
//vec3 normal = vec3(0,0,1);
|
||||
//vec3 normal = normalize(vecNormal);
|
||||
vec3 normal = normalize((texture2D(normalSampler, vecTex).xyz) * 2 - 1);
|
||||
//normal = normalize(normal * 2.0 - 1.0);
|
||||
|
||||
vec3 viewDir = normalize(viewDirTS);
|
||||
//vec3 viewDir = normalize(cameraPos-worldPos);
|
||||
|
||||
vec3 lightDir = normalize(lightDirTS);
|
||||
//vec3 lightDir = normalize(lightPos-worldPos);
|
||||
|
||||
vec3 ao = texture2D(aoTexture, vecTex).xyz;
|
||||
vec3 ambient = AMBIENT*ao*color;
|
||||
vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2);
|
||||
vec3 ilumination;
|
||||
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor,normal,viewDir);
|
||||
|
||||
|
||||
|
||||
//flashlight
|
||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||
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);
|
||||
|
||||
//sun
|
||||
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||
ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir);
|
||||
//outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
|
||||
|
||||
//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);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
layout(location = 0) in vec3 vertexPosition;
|
||||
layout(location = 1) in vec3 vertexNormal;
|
||||
layout(location = 2) in vec2 vertexTexCoord;
|
||||
layout(location = 3) in vec3 vertexTangent;
|
||||
layout(location = 4) in vec3 vertexBitangent;
|
||||
|
||||
uniform mat4 transformation;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 LightVP;
|
||||
uniform mat4 LightVP2;
|
||||
uniform mat4 LightVP3;
|
||||
|
||||
out vec3 vecNormal;
|
||||
out vec3 worldPos;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 cameraPos;
|
||||
uniform vec3 sunDir;
|
||||
|
||||
out vec3 viewDirTS;
|
||||
out vec3 lightDirTS;
|
||||
out vec3 spotlightDirTS;
|
||||
out vec3 sunDirTS;
|
||||
out vec2 vecTex;
|
||||
out vec4 sunSpacePos;
|
||||
out vec4 sunSpacePos2;
|
||||
out vec4 lampSpacePos;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vecTex = vec2(0, 1) + vertexTexCoord * vec2(1, -1);
|
||||
|
||||
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
|
||||
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
|
||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||
|
||||
vec3 w_tangent = normalize(mat3(modelMatrix)*vertexTangent);
|
||||
vec3 w_bitangent = normalize(mat3(modelMatrix)*vertexBitangent);
|
||||
mat3 TBN = transpose(mat3(w_tangent, w_bitangent, vecNormal));
|
||||
|
||||
vec3 V = normalize(cameraPos-worldPos);
|
||||
viewDirTS = TBN*V;
|
||||
vec3 L = normalize(lightPos-worldPos);
|
||||
lightDirTS = TBN*L;
|
||||
vec3 SL = normalize(spotlightPos-worldPos);
|
||||
spotlightDirTS = TBN*SL;
|
||||
sunDirTS = TBN*sunDir;
|
||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
float AMBIENT = 0.5;
|
||||
float PI = 3.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;
|
||||
uniform vec3 lightColor;
|
||||
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 spotlightColor;
|
||||
uniform vec3 spotlightConeDir;
|
||||
uniform vec3 spotlightPhi;
|
||||
|
||||
|
||||
|
||||
uniform float exposition;
|
||||
|
||||
in vec3 vecNormal;
|
||||
in vec3 worldPos;
|
||||
in vec2 vecTex;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
|
||||
in vec3 viewDirTS;
|
||||
in vec3 lightDirTS;
|
||||
in vec3 spotlightDirTS;
|
||||
in vec3 sunDirTS;
|
||||
|
||||
vec3 color;
|
||||
float metallic;
|
||||
float roughness;
|
||||
|
||||
in vec4 sunSpacePos;
|
||||
in vec4 sunSpacePos2;
|
||||
in vec4 lampSpacePos;
|
||||
|
||||
float DistributionGGX(vec3 normal, vec3 H, float roughness){
|
||||
float a = roughness*roughness;
|
||||
float a2 = a*a;
|
||||
float NdotH = max(dot(normal, H), 0.0);
|
||||
float NdotH2 = NdotH*NdotH;
|
||||
|
||||
float num = a2;
|
||||
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
||||
denom = PI * denom * denom;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySchlickGGX(float NdotV, float roughness){
|
||||
float r = (roughness + 1.0);
|
||||
float k = (r*r) / 8.0;
|
||||
|
||||
float num = NdotV;
|
||||
float denom = NdotV * (1.0 - k) + k;
|
||||
|
||||
return num / denom;
|
||||
}
|
||||
float GeometrySmith(vec3 normal, vec3 V, vec3 lightDir, float roughness){
|
||||
float NdotV = max(dot(normal, V), 0.0);
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
||||
|
||||
return ggx1 * ggx2;
|
||||
}
|
||||
vec3 fresnelSchlick(float cosTheta, vec3 F0){
|
||||
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
||||
}
|
||||
|
||||
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
|
||||
float diffuse=max(0,dot(normal,lightDir));
|
||||
|
||||
//vec3 V = normalize(cameraPos-worldPos);
|
||||
vec3 F0 = vec3(0.04);
|
||||
F0 = mix(F0, color, metallic);
|
||||
|
||||
vec3 H = normalize(V + lightDir);
|
||||
|
||||
// cook-torrance brdf
|
||||
float NDF = DistributionGGX(normal, H, roughness);
|
||||
float G = GeometrySmith(normal, V, lightDir, roughness);
|
||||
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
|
||||
|
||||
vec3 kS = F;
|
||||
vec3 kD = vec3(1.0) - kS;
|
||||
kD *= 1.0 - metallic;
|
||||
|
||||
vec3 numerator = NDF * G * F;
|
||||
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
|
||||
vec3 specular = numerator / denominator;
|
||||
|
||||
// add to outgoing radiance Lo
|
||||
float NdotL = max(dot(normal, lightDir), 0.0);
|
||||
return (kD * color / PI + specular) * radiance * NdotL;
|
||||
}
|
||||
|
||||
float calculateShadow() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
return (0.5*(diff)/abs(diff))+0.5;
|
||||
}
|
||||
|
||||
|
||||
float calculateShadow2() {
|
||||
|
||||
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5;
|
||||
|
||||
float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x;
|
||||
|
||||
float diff = (0.001+closestDepth) - sunSpacePosNormalized.z;
|
||||
|
||||
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;
|
||||
metallic = texture2D(armTexture, vecTex).y;
|
||||
roughness = texture2D(armTexture, vecTex).z;
|
||||
|
||||
//vec3 normal = vec3(0,0,1);
|
||||
//vec3 normal = normalize(vecNormal);
|
||||
vec3 normal = normalize((texture2D(normalSampler, vecTex).xyz) * 2 - 1);
|
||||
//normal = normalize(normal * 2.0 - 1.0);
|
||||
|
||||
vec3 viewDir = normalize(viewDirTS);
|
||||
//vec3 viewDir = normalize(cameraPos-worldPos);
|
||||
|
||||
vec3 lightDir = normalize(lightDirTS);
|
||||
//vec3 lightDir = normalize(lightPos-worldPos);
|
||||
|
||||
float ao = texture2D(armTexture, vecTex).x;
|
||||
vec3 ambient = AMBIENT*ao*color;
|
||||
vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2);
|
||||
vec3 ilumination;
|
||||
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor,normal,viewDir);
|
||||
|
||||
|
||||
|
||||
//flashlight
|
||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||
//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);
|
||||
|
||||
//sun
|
||||
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||
ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir);
|
||||
|
||||
//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);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
layout(location = 0) in vec3 vertexPosition;
|
||||
layout(location = 1) in vec3 vertexNormal;
|
||||
layout(location = 2) in vec2 vertexTexCoord;
|
||||
layout(location = 3) in vec3 vertexTangent;
|
||||
layout(location = 4) in vec3 vertexBitangent;
|
||||
|
||||
uniform mat4 transformation;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 LightVP;
|
||||
uniform mat4 LightVP2;
|
||||
uniform mat4 LightVP3;
|
||||
|
||||
out vec3 vecNormal;
|
||||
out vec3 worldPos;
|
||||
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 cameraPos;
|
||||
uniform vec3 sunDir;
|
||||
|
||||
out vec3 viewDirTS;
|
||||
out vec3 lightDirTS;
|
||||
out vec3 spotlightDirTS;
|
||||
out vec3 sunDirTS;
|
||||
out vec2 vecTex;
|
||||
out vec4 sunSpacePos;
|
||||
out vec4 sunSpacePos2;
|
||||
out vec4 lampSpacePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
vecTex = vec2(0, 1) + vertexTexCoord * vec2(1, -1);
|
||||
|
||||
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
|
||||
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
|
||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||
|
||||
vec3 w_tangent = normalize(mat3(modelMatrix)*vertexTangent);
|
||||
vec3 w_bitangent = normalize(mat3(modelMatrix)*vertexBitangent);
|
||||
mat3 TBN = transpose(mat3(w_tangent, w_bitangent, vecNormal));
|
||||
|
||||
vec3 V = normalize(cameraPos-worldPos);
|
||||
viewDirTS = TBN*V;
|
||||
vec3 L = normalize(lightPos-worldPos);
|
||||
lightDirTS = TBN*L;
|
||||
vec3 SL = normalize(spotlightPos-worldPos);
|
||||
spotlightDirTS = TBN*SL;
|
||||
sunDirTS = TBN*sunDir;
|
||||
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
|
||||
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
|
||||
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
|
||||
}
|
@ -207,7 +207,7 @@ void main () {
|
||||
//vec4 light = vec4(1.0, 10.0, 0.0, 0.1);
|
||||
vec4 light = vec4(lightPos, 1);
|
||||
//light = light*rotMat;
|
||||
vec3 colorBlue = vec3(0.0,0.1,0.2);
|
||||
vec3 colorBlue = vec3(0.0,0.1,0.3);
|
||||
vec3 colorLightBlue = vec3(0.0, 0.04, 0.2);
|
||||
vec3 colorWhite = vec3(0.9, 0.9, 0.9);
|
||||
|
||||
|
@ -1,117 +0,0 @@
|
||||
#include "glew.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "glm.hpp"
|
||||
#include "ext.hpp"
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "freeglut.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
#define matrixSize 1000
|
||||
|
||||
struct Bounding {
|
||||
float minX, maxX, minZ, maxZ;
|
||||
};
|
||||
|
||||
class CollisionSystem {
|
||||
public:
|
||||
bool matrix[matrixSize][matrixSize];
|
||||
float toAddX, toAddZ, toMultiplyX, toMultiplyZ;
|
||||
|
||||
struct Bounding sceneBounding;
|
||||
std::vector<Bounding> meshesBoundings;
|
||||
|
||||
CollisionSystem() {
|
||||
for (int i = 0; i < matrixSize; i++) {
|
||||
for (int j = 0; j < matrixSize; j++) {
|
||||
matrix[i][j] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addMeshToMatrix(aiMesh* mesh) {
|
||||
aiVector3D firstPosition = mesh->mVertices[0];
|
||||
|
||||
float meshMinX = firstPosition.x;
|
||||
float meshMaxX = firstPosition.x;
|
||||
float meshMinZ = firstPosition.z;
|
||||
float meshMaxZ = firstPosition.z;
|
||||
|
||||
for (unsigned int i = 1; i < mesh->mNumVertices; i++)
|
||||
{
|
||||
aiVector3D vertex = mesh->mVertices[i];
|
||||
|
||||
if (vertex.x < meshMinX) meshMinX = vertex.x;
|
||||
if (vertex.z < meshMinZ) meshMinZ = vertex.z;
|
||||
|
||||
if (vertex.x > meshMaxX) meshMaxX = vertex.x;
|
||||
if (vertex.z > meshMaxZ) meshMaxZ = vertex.z;
|
||||
}
|
||||
|
||||
Bounding meshBounding = {
|
||||
meshMinX,
|
||||
meshMaxX,
|
||||
meshMinZ,
|
||||
meshMaxZ
|
||||
};
|
||||
|
||||
meshesBoundings.push_back(meshBounding);
|
||||
}
|
||||
|
||||
void calculateSceneBounding() {
|
||||
for (Bounding meshBounding : meshesBoundings) {
|
||||
if (meshBounding.minX < sceneBounding.minX) {
|
||||
sceneBounding.minX = meshBounding.minX;
|
||||
}
|
||||
if (meshBounding.maxX > sceneBounding.maxX) {
|
||||
sceneBounding.maxX = meshBounding.maxX;
|
||||
}
|
||||
if (meshBounding.minZ < sceneBounding.minZ) {
|
||||
sceneBounding.minZ = meshBounding.minZ;
|
||||
}
|
||||
if (meshBounding.maxZ > sceneBounding.maxZ) {
|
||||
sceneBounding.maxZ = meshBounding.maxZ;
|
||||
}
|
||||
}
|
||||
|
||||
toAddX = -sceneBounding.minX;
|
||||
toAddZ = -sceneBounding.minZ;
|
||||
toMultiplyX = (1 / (sceneBounding.maxX + toAddX)) * matrixSize;
|
||||
toMultiplyZ = (1 / (sceneBounding.maxZ + toAddZ)) * matrixSize;
|
||||
|
||||
for (Bounding meshBounding : meshesBoundings) {
|
||||
int i_start = getRelativeZ(meshBounding.minZ);
|
||||
int i_end = getRelativeZ(meshBounding.maxZ);
|
||||
for (int i = i_start; i <= i_end; i++) {
|
||||
int j_start = getRelativeX(meshBounding.minX);
|
||||
int j_end = getRelativeX(meshBounding.maxX);
|
||||
for (int j = j_start; j <= j_end; j++) {
|
||||
matrix[i][j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool canMove(glm::vec3 pos) {
|
||||
int z = getRelativeZ(pos.z);
|
||||
int x = getRelativeX(pos.x);
|
||||
|
||||
if (z < 0 || z >= matrixSize || x < 0 || x >= matrixSize) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !(matrix[z][x]);
|
||||
}
|
||||
|
||||
float getRelativeX(float x) {
|
||||
return (int)((x + toAddX) * toMultiplyX);
|
||||
}
|
||||
|
||||
float getRelativeZ(float z) {
|
||||
return (int)((z + toAddZ) * toMultiplyZ);
|
||||
}
|
||||
};
|
@ -8,6 +8,8 @@
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
|
||||
|
||||
void Core::RenderContext::initFromAssimpMesh(aiMesh* mesh) {
|
||||
vertexArray = 0;
|
||||
vertexBuffer = 0;
|
||||
@ -18,19 +20,15 @@ void Core::RenderContext::initFromAssimpMesh(aiMesh* mesh) {
|
||||
//tex coord must be converted to 2d vecs
|
||||
for (unsigned int i = 0; i < mesh->mNumVertices; i++)
|
||||
{
|
||||
float x, y;
|
||||
if (mesh->mTextureCoords[0] != nullptr) {
|
||||
x = mesh->mTextureCoords[0][i].x;
|
||||
y = mesh->mTextureCoords[0][i].y;
|
||||
} else {
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
textureCoord.push_back(mesh->mTextureCoords[0][i].x);
|
||||
textureCoord.push_back(mesh->mTextureCoords[0][i].y);
|
||||
}
|
||||
else {
|
||||
textureCoord.push_back(0.0f);
|
||||
textureCoord.push_back(0.0f);
|
||||
}
|
||||
|
||||
textureCoord.push_back(x);
|
||||
textureCoord.push_back(y);
|
||||
}
|
||||
|
||||
if (mesh->mTextureCoords[0] == nullptr) {
|
||||
std::cout << "no uv coords\n";
|
||||
}
|
||||
|
1313
cw 9/src/ex_9_1.hpp
@ -5,7 +5,6 @@
|
||||
#include "ext.hpp"
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <windows.h>
|
||||
|
||||
#include "ex_9_1.hpp"
|
||||
|
||||
@ -24,7 +23,7 @@ int main(int argc, char** argv)
|
||||
#endif
|
||||
|
||||
// tworzenie okna za pomoca glfw
|
||||
GLFWwindow* window = glfwCreateWindow(1000, 1000, "FirstWindow", NULL, NULL);
|
||||
GLFWwindow* window = glfwCreateWindow(500, 500, "FirstWindow", NULL, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
std::cout << "Failed to create GLFW window" << std::endl;
|
||||
@ -35,7 +34,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// ladowanie OpenGL za pomoca glew
|
||||
glewInit();
|
||||
glViewport(0, 0, 1000, 1000);
|
||||
glViewport(0, 0, 500, 500);
|
||||
|
||||
init(window);
|
||||
|
||||
|
Before Width: | Height: | Size: 8.3 MiB |
Before Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 4.2 MiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 8.3 MiB |
Before Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 4.6 MiB |
Before Width: | Height: | Size: 6.1 MiB |
Before Width: | Height: | Size: 2.5 MiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 4.8 MiB |
Before Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 473 KiB |
Before Width: | Height: | Size: 244 KiB |
Before Width: | Height: | Size: 620 KiB |
Before Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 169 KiB |
Before Width: | Height: | Size: 9.5 MiB |
Before Width: | Height: | Size: 6.1 MiB |
Before Width: | Height: | Size: 8.0 MiB |
Before Width: | Height: | Size: 5.6 MiB |
Before Width: | Height: | Size: 366 KiB |
Before Width: | Height: | Size: 105 KiB |