diff --git a/.vs/grk-cw/FileContentIndex/2716a2bb-8731-4646-8476-d49257aaa85d.vsidx b/.vs/grk-cw/FileContentIndex/2716a2bb-8731-4646-8476-d49257aaa85d.vsidx deleted file mode 100644 index ad1efad..0000000 Binary files a/.vs/grk-cw/FileContentIndex/2716a2bb-8731-4646-8476-d49257aaa85d.vsidx and /dev/null differ diff --git a/.vs/grk-cw/FileContentIndex/347e6127-9e4d-4d15-95fb-7440a9f26baf.vsidx b/.vs/grk-cw/FileContentIndex/347e6127-9e4d-4d15-95fb-7440a9f26baf.vsidx new file mode 100644 index 0000000..48444e2 Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/347e6127-9e4d-4d15-95fb-7440a9f26baf.vsidx differ diff --git a/.vs/grk-cw/FileContentIndex/52b0af7d-e6d4-4bd0-ac09-72ea4878c474.vsidx b/.vs/grk-cw/FileContentIndex/52b0af7d-e6d4-4bd0-ac09-72ea4878c474.vsidx deleted file mode 100644 index 45e827b..0000000 Binary files a/.vs/grk-cw/FileContentIndex/52b0af7d-e6d4-4bd0-ac09-72ea4878c474.vsidx and /dev/null differ diff --git a/.vs/grk-cw/FileContentIndex/93223637-7779-4a0e-8cbe-f39515671d74.vsidx b/.vs/grk-cw/FileContentIndex/93223637-7779-4a0e-8cbe-f39515671d74.vsidx deleted file mode 100644 index b65a1b8..0000000 Binary files a/.vs/grk-cw/FileContentIndex/93223637-7779-4a0e-8cbe-f39515671d74.vsidx and /dev/null differ diff --git a/.vs/grk-cw/FileContentIndex/e2d72067-f587-43ac-8186-6d504fbc6175.vsidx b/.vs/grk-cw/FileContentIndex/e2d72067-f587-43ac-8186-6d504fbc6175.vsidx new file mode 100644 index 0000000..3995665 Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/e2d72067-f587-43ac-8186-6d504fbc6175.vsidx differ diff --git a/.vs/grk-cw/FileContentIndex/eb492d9d-eb4c-438c-8889-ad0b467d1cd2.vsidx b/.vs/grk-cw/FileContentIndex/eb492d9d-eb4c-438c-8889-ad0b467d1cd2.vsidx new file mode 100644 index 0000000..358508c Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/eb492d9d-eb4c-438c-8889-ad0b467d1cd2.vsidx differ diff --git a/.vs/grk-cw/v17/.suo b/.vs/grk-cw/v17/.suo index 6959399..919a963 100644 Binary files a/.vs/grk-cw/v17/.suo and b/.vs/grk-cw/v17/.suo differ diff --git a/.vs/grk-cw/v17/Browse.VC.db b/.vs/grk-cw/v17/Browse.VC.db index 124e716..009dc7d 100644 Binary files a/.vs/grk-cw/v17/Browse.VC.db and b/.vs/grk-cw/v17/Browse.VC.db differ diff --git a/.vs/grk-cw/v17/DocumentLayout.json b/.vs/grk-cw/v17/DocumentLayout.json index c494898..bfd20dd 100644 --- a/.vs/grk-cw/v17/DocumentLayout.json +++ b/.vs/grk-cw/v17/DocumentLayout.json @@ -1,91 +1,109 @@ -{ - "Version": 1, - "WorkspaceRootPath": "C:\\Users\\maksg\\Documents\\Grafika_2024\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\src\\ex_7_1.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag||{8B382828-6202-11D1-8870-0000F87579D2}", - "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\shaders\\shader_coin.frag||{8B382828-6202-11D1-8870-0000F87579D2}" - }, - { - "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert||{8B382828-6202-11D1-8870-0000F87579D2}", - "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\shaders\\shader_coin.vert||{8B382828-6202-11D1-8870-0000F87579D2}" - }, - { - "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - } - ], - "DocumentGroupContainers": [ - { - "Orientation": 0, - "VerticalTabListWidth": 256, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 3, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, - { - "$type": "Document", - "DocumentIndex": 1, - "Title": "shader_coin.frag", - "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag", - "RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.frag", - "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag", - "RelativeToolTip": "projekt_grk\\shaders\\shader_coin.frag", - "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAaAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", - "WhenOpened": "2024-02-26T19:01:49.259Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 2, - "Title": "shader_coin.vert", - "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert", - "RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.vert", - "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert", - "RelativeToolTip": "projekt_grk\\shaders\\shader_coin.vert", - "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", - "WhenOpened": "2024-02-26T19:01:39.656Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "ex_7_1.hpp", - "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp", - "RelativeDocumentMoniker": "projekt_grk\\src\\ex_7_1.hpp", - "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp", - "RelativeToolTip": "projekt_grk\\src\\ex_7_1.hpp", - "ViewState": "AQIAAPwAAAAAAAAAAAAYwP8AAAAaAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2024-02-25T17:55:58.673Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "main.cpp", - "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp", - "RelativeDocumentMoniker": "projekt_grk\\src\\main.cpp", - "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp", - "RelativeToolTip": "projekt_grk\\src\\main.cpp", - "ViewState": "AQIAABcAAAAAAAAAAAAtwCYAAAAAAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-02-26T20:07:44.538Z" - } - ] - } - ] - } - ] +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\maksg\\Documents\\Grafika_2024\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\src\\ex_7_1.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert||{8B382828-6202-11D1-8870-0000F87579D2}", + "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\shaders\\shader_coin.vert||{8B382828-6202-11D1-8870-0000F87579D2}" + }, + { + "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag||{8B382828-6202-11D1-8870-0000F87579D2}", + "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\shaders\\shader_coin.frag||{8B382828-6202-11D1-8870-0000F87579D2}" + }, + { + "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_5_1_tex_copy.frag||{8B382828-6202-11D1-8870-0000F87579D2}", + "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\shaders\\shader_5_1_tex_copy.frag||{8B382828-6202-11D1-8870-0000F87579D2}" + }, + { + "AbsoluteMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}|projekt_grk\\grk-cw7.vcxproj|solutionrelative:projekt_grk\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 4, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "shader_5_1_tex_copy.frag", + "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_5_1_tex_copy.frag", + "RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_5_1_tex_copy.frag", + "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_5_1_tex_copy.frag", + "RelativeToolTip": "projekt_grk\\shaders\\shader_5_1_tex_copy.frag", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", + "WhenOpened": "2024-02-28T08:58:43.519Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "shader_coin.frag", + "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag", + "RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.frag", + "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag", + "RelativeToolTip": "projekt_grk\\shaders\\shader_coin.frag", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAbAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", + "WhenOpened": "2024-02-26T19:01:49.259Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "shader_coin.vert", + "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert", + "RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.vert", + "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert", + "RelativeToolTip": "projekt_grk\\shaders\\shader_coin.vert", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAA9AAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", + "WhenOpened": "2024-02-26T19:01:39.656Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "ex_7_1.hpp", + "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp", + "RelativeDocumentMoniker": "projekt_grk\\src\\ex_7_1.hpp", + "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp", + "RelativeToolTip": "projekt_grk\\src\\ex_7_1.hpp", + "ViewState": "AQIAAIEAAAAAAAAAAAAowJkAAAAYAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-02-25T17:55:58.673Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "main.cpp", + "DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp", + "RelativeDocumentMoniker": "projekt_grk\\src\\main.cpp", + "ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp", + "RelativeToolTip": "projekt_grk\\src\\main.cpp", + "ViewState": "AQIAABcAAAAAAAAAAAAtwCYAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-02-26T20:07:44.538Z", + "EditorCaption": "" + } + ] + } + ] + } + ] } \ No newline at end of file diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch index 119c63b..ad34c85 100644 Binary files a/.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch and b/.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/6b591a07d8db8856/VCTMP1532_952483.EX_7_1.00000000.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/6b591a07d8db8856/VCTMP1532_952483.EX_7_1.00000000.ipch new file mode 100644 index 0000000..517199d Binary files /dev/null and b/.vs/grk-cw/v17/ipch/AutoPCH/6b591a07d8db8856/VCTMP1532_952483.EX_7_1.00000000.ipch differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/f3254805e0628220/VCTMP12612_184611.EX_7_1.00000000.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/f3254805e0628220/VCTMP12612_184611.EX_7_1.00000000.ipch new file mode 100644 index 0000000..5fd02c8 Binary files /dev/null and b/.vs/grk-cw/v17/ipch/AutoPCH/f3254805e0628220/VCTMP12612_184611.EX_7_1.00000000.ipch differ diff --git a/Debug/projekt_grk.exe b/Debug/projekt_grk.exe index 6eba963..9f9381c 100644 Binary files a/Debug/projekt_grk.exe and b/Debug/projekt_grk.exe differ diff --git a/Debug/projekt_grk.pdb b/Debug/projekt_grk.pdb index 81c8729..f1f12fc 100644 Binary files a/Debug/projekt_grk.pdb and b/Debug/projekt_grk.pdb differ diff --git a/projekt_grk/Debug/grk-cw7.log b/projekt_grk/Debug/grk-cw7.log index 1fca036..ed502f0 100644 --- a/projekt_grk/Debug/grk-cw7.log +++ b/projekt_grk/Debug/grk-cw7.log @@ -1,19 +1,22 @@ -C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj, grk-cw6.vcxproj, grk-cw7.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji. - main.cpp -C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra - (kompilowanie pliku źródłowego „src/main.cpp”) - C:\Users\maksg\Documents\Grafika_2024\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): - zobacz poprzednią definicję „APIENTRY” - -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(93,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" - (kompilowanie pliku źródłowego „src/main.cpp”) - -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(205,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych - (kompilowanie pliku źródłowego „src/main.cpp”) - -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(223,29): warning C4305: "inicjowanie": obcięcie z "double" do "float" - (kompilowanie pliku źródłowego „src/main.cpp”) - -Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO” -LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka - grk-cw7.vcxproj -> C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe +C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj, grk-cw6.vcxproj, grk-cw7.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji. + main.cpp +C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra + (kompilowanie pliku źródłowego „src/main.cpp”) + C:\Users\maksg\Documents\Grafika_2024\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): + zobacz poprzednią definicję „APIENTRY” + +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(93,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" + (kompilowanie pliku źródłowego „src/main.cpp”) + +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(139,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych + (kompilowanie pliku źródłowego „src/main.cpp”) + +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(210,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych + (kompilowanie pliku źródłowego „src/main.cpp”) + +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(228,29): warning C4305: "inicjowanie": obcięcie z "double" do "float" + (kompilowanie pliku źródłowego „src/main.cpp”) + +Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO” +LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka + grk-cw7.vcxproj -> C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe diff --git a/projekt_grk/Debug/main.obj b/projekt_grk/Debug/main.obj index d1efb27..795ec70 100644 Binary files a/projekt_grk/Debug/main.obj and b/projekt_grk/Debug/main.obj differ diff --git a/projekt_grk/Debug/projekt_grk.exe.recipe b/projekt_grk/Debug/projekt_grk.exe.recipe index 6cd0ef8..77ccf4c 100644 --- a/projekt_grk/Debug/projekt_grk.exe.recipe +++ b/projekt_grk/Debug/projekt_grk.exe.recipe @@ -1,11 +1,11 @@ - - - - - C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe - - - - - + + + + + C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe + + + + + \ No newline at end of file diff --git a/projekt_grk/Debug/projekt_grk.tlog/Cl.items.tlog b/projekt_grk/Debug/projekt_grk.tlog/Cl.items.tlog index 26ef988..1539627 100644 --- a/projekt_grk/Debug/projekt_grk.tlog/Cl.items.tlog +++ b/projekt_grk/Debug/projekt_grk.tlog/Cl.items.tlog @@ -1,10 +1,10 @@ -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Box.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Box.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Camera.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Camera.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\main.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\main.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Render_Utils.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Render_Utils.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Shader_Loader.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Shader_Loader.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\image_DXT.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\image_DXT.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\image_helper.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\image_helper.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\SOIL.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\SOIL.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\stb_image_aug.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\stb_image_aug.obj -C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Texture.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Texture.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Box.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Box.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Camera.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Camera.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\main.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\main.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Render_Utils.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Render_Utils.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Shader_Loader.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Shader_Loader.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\image_DXT.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\image_DXT.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\image_helper.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\image_helper.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\SOIL.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\SOIL.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\SOIL\stb_image_aug.c;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\stb_image_aug.obj +C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\Texture.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Texture.obj diff --git a/projekt_grk/Debug/projekt_grk.tlog/link.secondary.1.tlog b/projekt_grk/Debug/projekt_grk.tlog/link.secondary.1.tlog index 5d1ab4c..f220db3 100644 --- a/projekt_grk/Debug/projekt_grk.tlog/link.secondary.1.tlog +++ b/projekt_grk/Debug/projekt_grk.tlog/link.secondary.1.tlog @@ -1 +1 @@ -^C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\BOX.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\CAMERA.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\IMAGE_DXT.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\IMAGE_HELPER.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\MAIN.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\RENDER_UTILS.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\SHADER_LOADER.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\SOIL.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\STB_IMAGE_AUG.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\TEXTURE.OBJ +^C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\BOX.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\CAMERA.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\IMAGE_DXT.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\IMAGE_HELPER.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\MAIN.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\RENDER_UTILS.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\SHADER_LOADER.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\SOIL.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\STB_IMAGE_AUG.OBJ|C:\USERS\MAKSG\DOCUMENTS\GRAFIKA_2024\PROJEKT_GRK\DEBUG\TEXTURE.OBJ diff --git a/projekt_grk/Debug/projekt_grk.tlog/projekt_grk.lastbuildstate b/projekt_grk/Debug/projekt_grk.tlog/projekt_grk.lastbuildstate index c9ed8de..199c765 100644 --- a/projekt_grk/Debug/projekt_grk.tlog/projekt_grk.lastbuildstate +++ b/projekt_grk/Debug/projekt_grk.tlog/projekt_grk.lastbuildstate @@ -1,2 +1,2 @@ -PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0: -Debug|Win32|C:\Users\maksg\Documents\Grafika_2024\| +PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0: +Debug|Win32|C:\Users\maksg\Documents\Grafika_2024\| diff --git a/projekt_grk/Debug/vc143.idb b/projekt_grk/Debug/vc143.idb index 9683c16..11582fb 100644 Binary files a/projekt_grk/Debug/vc143.idb and b/projekt_grk/Debug/vc143.idb differ diff --git a/projekt_grk/Debug/vc143.pdb b/projekt_grk/Debug/vc143.pdb index 3a4b001..c2409bf 100644 Binary files a/projekt_grk/Debug/vc143.pdb and b/projekt_grk/Debug/vc143.pdb differ diff --git a/projekt_grk/grk-cw7.vcxproj.user b/projekt_grk/grk-cw7.vcxproj.user index 88a5509..dc63f8a 100644 --- a/projekt_grk/grk-cw7.vcxproj.user +++ b/projekt_grk/grk-cw7.vcxproj.user @@ -1,4 +1,6 @@ - - - + + + + false + \ No newline at end of file diff --git a/projekt_grk/shaders/shader_coin.frag b/projekt_grk/shaders/shader_coin.frag index cc8c617..8e229a5 100644 --- a/projekt_grk/shaders/shader_coin.frag +++ b/projekt_grk/shaders/shader_coin.frag @@ -1,20 +1,12 @@ -#version 430 core - -in vec3 FragPos; -in vec3 Normal; - -out vec4 FragColor; - -uniform vec3 color; - -void main() -{ - vec3 lightColor = vec3(1.0, 1.0, 1.0); - vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0)); - - float diff = max(dot(normalize(Normal), lightDir), 0.0); - vec3 diffuse = diff * lightColor; - - FragColor = vec4(color * diffuse, 1.0); -} - +#version 430 core + +uniform vec3 color; + +out vec4 FinalColor; + +void main() +{ + + FinalColor = vec4(color, 1.0); +} + diff --git a/projekt_grk/shaders/shader_coin.vert b/projekt_grk/shaders/shader_coin.vert index 5cb152f..6a00ed6 100644 --- a/projekt_grk/shaders/shader_coin.vert +++ b/projekt_grk/shaders/shader_coin.vert @@ -1,20 +1,13 @@ -#version 430 core - -layout(location = 0) in vec3 vertexPosition; -layout(location = 1) in vec3 vertexNormal; -layout(location = 2) in vec2 vertexTexCoord; - -uniform mat4 transformation; -uniform mat4 modelMatrix; - -out vec3 FragPos; -out vec3 Normal; - -void main() -{ - vec4 rotatedPosition = modelMatrix * vec4(vertexPosition, 1.0); - gl_Position = transformation * rotatedPosition; - Normal = mat3(transpose(inverse(transformation))) * vertexNormal; - FragPos = rotatedPosition.xyz; -} - +#version 430 core + +layout(location = 0) in vec3 vertexPosition; +layout(location = 1) in vec3 vertexNormal; + +uniform mat4 transformation; +uniform mat4 modelMatrix; + +void main() +{ + gl_Position = transformation * vec4(vertexPosition, 1.0); +} + diff --git a/projekt_grk/src/ex_7_1.hpp b/projekt_grk/src/ex_7_1.hpp index e87dfda..dc78646 100644 --- a/projekt_grk/src/ex_7_1.hpp +++ b/projekt_grk/src/ex_7_1.hpp @@ -1,447 +1,441 @@ -#include "glew.h" -#include -#include "glm.hpp" -#include "ext.hpp" -#include -#include - -#include "Shader_Loader.h" -#include "Render_Utils.h" -#include "Texture.h" - -#include "Box.cpp" -#include -#include -#include -#include -#include "SOIL/SOIL.h" - - -namespace texture { - GLuint mercury; - GLuint venus; - GLuint earth; - GLuint moon; - GLuint ship; - GLuint sun; - GLuint mars; - GLuint jupiter; - GLuint saturn; - GLuint uranus; - GLuint neptune; - - GLuint mercuryNormal; - GLuint venusNormal; - GLuint earthNormal; - GLuint asteroidNormal; - GLuint shipNormal; - GLuint marsNormal; - GLuint jupiterNormal; - GLuint saturnNormal; - GLuint uranusNormal; - GLuint neptuneNormal; - - GLuint grid; -} - - -GLuint program; -GLuint programSun; -GLuint programTex; -GLuint programEarth; -GLuint programProcTex; -GLuint programSkyBox; -GLuint programCoin; -Core::Shader_Loader shaderLoader; - -Core::RenderContext shipContext; -Core::RenderContext sphereContext; -Core::RenderContext cubeContext; -Core::RenderContext cylinderContext; - -glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0); -glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f); - -glm::vec3 spaceshipPos = glm::vec3(-4.f, 0, 0); -glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f); -GLuint VAO,VBO; - -float aspectRatio = 1.f; -unsigned int textureID; - - -glm::mat4 createCameraMatrix() -{ - glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f))); - glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide,cameraDir)); - glm::mat4 cameraRotrationMatrix = glm::mat4({ - cameraSide.x,cameraSide.y,cameraSide.z,0, - cameraUp.x,cameraUp.y,cameraUp.z ,0, - -cameraDir.x,-cameraDir.y,-cameraDir.z,0, - 0.,0.,0.,1., - }); - cameraRotrationMatrix = glm::transpose(cameraRotrationMatrix); - glm::mat4 cameraMatrix = cameraRotrationMatrix * glm::translate(-cameraPos); - - return cameraMatrix; -} - -glm::mat4 createPerspectiveMatrix() -{ - - glm::mat4 perspectiveMatrix; - float n = 0.05; - float f = 20.; - float a1 = glm::min(aspectRatio, 1.f); - float a2 = glm::min(1 / aspectRatio, 1.f); - perspectiveMatrix = glm::mat4({ - 1,0.,0.,0., - 0.,aspectRatio,0.,0., - 0.,0.,(f+n) / (n - f),2*f * n / (n - f), - 0.,0.,-1.,0., - }); - - - perspectiveMatrix=glm::transpose(perspectiveMatrix); - - return perspectiveMatrix; -} - -void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) { - GLuint prog = program; - glUseProgram(prog); - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); - glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z); - glUniform3f(glGetUniformLocation(prog, "lightPos"), 0,0,0); - Core::DrawContext(context); - -} - -void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalMapId) { - GLuint prog = programTex; - glUseProgram(prog); - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); - glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0); - Core::SetActiveTexture(textureID, "colorTexture", prog, 0); - Core::SetActiveTexture(normalMapId, "normalSampler", prog, 1); - Core::DrawContext(context); - -} -void drawCylinder(Core::RenderContext& context, glm::mat4 modelMatrix, float height, float radius, glm::vec3 color) { - GLuint prog = programCoin; - glUseProgram(prog); - - // Rotate the modelMatrix to make the cylinder vertically oriented - - modelMatrix = glm::rotate(modelMatrix, glm::radians(-90.0f), glm::vec3(1, 0, 0)); // Rotate around x-axis - modelMatrix = glm::scale(modelMatrix, glm::vec3(radius, height, radius)); // Scale - - // Calculate model-view-projection matrix - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - - // Set transformation matrices in the shader - glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); - - // Set color and light position in the shader - glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z); - glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0); - - // Draw the cylinder - Core::DrawContext(context); -} - - - - - - -void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID) -{ - GLuint prog = programSun; - glUseProgram(prog); - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniform1f(glGetUniformLocation(prog, "exposition"), 1.f); - Core::SetActiveTexture(textureID, "sunTexture", prog, 0); - Core::DrawContext(context); -} - -void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) { - glDisable(GL_DEPTH_TEST); - glUseProgram(programSkyBox); - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation"); - glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transformation)); - GLint modelLoc = glGetUniformLocation(programSkyBox, "modelMatrix"); - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(modelMatrix)); - glUniform3f(glGetUniformLocation(programSkyBox, "lightPos"), 0, 0, 0); - glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); - Core::DrawContext(context); - glEnable(GL_DEPTH_TEST); - -} - - -void renderPlanet(float time, float orbitRadius, float orbitRotationSpeed, float selfRotationSpeed, float scale, GLuint planetTexture, GLuint normalTexture) { - glm::mat4 planetTransform = glm::rotate(glm::mat4(1.0f), time * orbitRotationSpeed, glm::vec3(0, 1, 0)) // orbitowanie dookoa soca - * glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odlego - * glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrt planety wok wasnej osi - * glm::scale(glm::vec3(scale)); //skalowanie planety - - drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture); -} - -void renderPlanets() { - float time = glfwGetTime(); - - float mercuryOrbitRadius = 1.3f; - float venusOrbitRadius = 2.0f; - float earthOrbitRadius = 5.0f; - float moonOrbitRadius = 0.8f; - float marsOrbitRadius = 8.0f; - float jupiterOrbitRadius = 10.0f; - float saturnOrbitRadius = 11.0f; - float uranusOrbitRadius = 12.5f; - float neptuneOrbitRadius = 13.0f; - - // im mniejsze tym szybciej - float mercuryRotationSpeed = 1.0f / 10; - float venusRotationSpeed = 1.0f / 7; - float earthRotationSpeed = 1.0f / 6; - float moonRotationSpeed = 1.0f / 2; - float marsRotationSpeed = 1.0f / 5; - float jupiterRotationSpeed = 1.0f / 8.5; - float saturnRotationSpeed = 1.0f / 5; - float uranusRotationSpeed = 1.0f / 9; - float neptuneRotationSpeed = 1.0f / 10; - - float mercurySelfRotationSpeed = 1.0f; - float venusSelfRotationSpeed = 1.0f; - float earthSelfRotationSpeed = 1.0f; - float moonSelfRotationSpeed = 1.0f / 2; - float marsSelfRotationSpeed = 1.0f; - float jupiterSelfRotationSpeed = 1.0f; - float saturnSelfRotationSpeed = 1.0f; - float uranusSelfRotationSpeed = 1.0f / 2; - float neptuneSelfRotationSpeed = 1.0f; - - float mercuryScale = 0.11f; - float venusScale = 0.14f; - float earthScale = 0.3f; - float moonScale = 0.055f; - float marsScale = 0.2f; - float jupiterScale = 0.7f; - float saturnScale = 0.5f; - float uranusScale = 0.3f; - float neptuneScale = 0.32f; - - renderPlanet(time, mercuryOrbitRadius, mercuryRotationSpeed, mercurySelfRotationSpeed, mercuryScale, texture::mercury, texture::mercuryNormal); - renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal); - renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal); - - //earths moon, musi by inaczej renderowany bo on nie orbituje wok soca tylko ziemi. Pniej to mona jako lepiej rozwiza. - drawObjectTexture(sphereContext, - glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::eulerAngleY(time * moonRotationSpeed) * glm::translate(glm::vec3(moonOrbitRadius, 0, 0)) * glm::scale(glm::vec3(moonScale)), - texture::moon, - texture::asteroidNormal); - - renderPlanet(time, marsOrbitRadius, marsRotationSpeed, marsSelfRotationSpeed, marsScale, texture::mars, texture::marsNormal); - renderPlanet(time, jupiterOrbitRadius, jupiterRotationSpeed, jupiterSelfRotationSpeed, jupiterScale, texture::jupiter, texture::jupiterNormal); - renderPlanet(time, saturnOrbitRadius, saturnRotationSpeed, saturnSelfRotationSpeed, saturnScale, texture::saturn, texture::saturnNormal); - renderPlanet(time, uranusOrbitRadius, uranusRotationSpeed, uranusSelfRotationSpeed, uranusScale, texture::uranus, texture::uranusNormal); - renderPlanet(time, neptuneOrbitRadius, neptuneRotationSpeed, neptuneSelfRotationSpeed, neptuneScale, texture::neptune, texture::neptuneNormal); - -} - -void renderScene(GLFWwindow* window) -{ - glClearColor(0.0f, 0.3f, 0.3f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - - //skybox - drawObjectSkyBox(cubeContext, glm::translate(cameraPos)); - - //sun - - drawSun(sphereContext, glm::mat4(), texture::sun); - - float cylinderHeight = 1.0f; - float cylinderRadius = 1.0f; - drawCylinder(cylinderContext, glm::translate(glm::vec3(5.0f, 0.0f, 0.0f)), cylinderHeight, cylinderRadius, glm::vec3(1.0f, 1.0f, 0.0f)); - - renderPlanets(); - - - 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::mat4 specshipCameraRotrationMatrix = glm::mat4({ - spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0, - spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0, - -spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0, - 0.,0.,0.,1., - }); - - //spaceship drawing - drawObjectTexture(shipContext, - glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi()), - texture::ship, texture::shipNormal - ); - - glUseProgram(0); - glfwSwapBuffers(window); -} -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - aspectRatio = width / float(height); - glViewport(0, 0, width, height); -} -void loadModelToContext(std::string path, Core::RenderContext& context) -{ - Assimp::Importer import; - const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace); - - if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) - { - std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl; - return; - } - context.initFromAssimpMesh(scene->mMeshes[0]); -} - -void init(GLFWwindow* window) -{ - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); - - glEnable(GL_DEPTH_TEST); - program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag"); - //programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); - programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex_copy.vert", "shaders/shader_5_1_tex_copy.frag"); - programEarth = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); - programProcTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); - programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag"); - programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag"); - programCoin = shaderLoader.CreateProgram("shaders/shader_coin.vert", "shaders/shader_coin.frag"); - - loadModelToContext("./models/sphere.obj", sphereContext); - loadModelToContext("./models/spaceship.obj", shipContext); - loadModelToContext("./models/cube.obj", cubeContext); - loadModelToContext("./models/cylinder.obj", cylinderContext); - - texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg"); - texture::venus = Core::LoadTexture("textures/venus/venus.jpg"); - texture::earth = Core::LoadTexture("textures/earth/earth.png"); - texture::ship = Core::LoadTexture("textures/spaceship/spaceship.jpg"); - texture::moon = Core::LoadTexture("textures/earths_moon/moon.jpg"); - texture::sun = Core::LoadTexture("textures/sun/sun.jpg"); - texture::mars = Core::LoadTexture("textures/mars/mars.jpg"); - texture::jupiter = Core::LoadTexture("textures/jupiter/jupiter.jpg"); - texture::saturn = Core::LoadTexture("textures/saturn/saturn.jpg"); - texture::uranus = Core::LoadTexture("textures/uranus/uranus.jpg"); - texture::neptune = Core::LoadTexture("textures/neptune/neptune.jpg"); - - texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png"); - texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png"); - texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png"); - texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg"); - texture::asteroidNormal = Core::LoadTexture("textures/earths_moon/moon_normal.jpg"); - texture::marsNormal = Core::LoadTexture("textures/mars/mars_normal.jpg"); - texture::jupiterNormal = Core::LoadTexture("textures/jupiter/jupiter_normal.png"); - texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png"); - texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png"); - texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png"); - - - //tutaj skybox start - glGenTextures(1, &textureID); - glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); - - std::vector filepaths = { - "textures/skybox/right.png", - "textures/skybox/left.png", - "textures/skybox/top.png", - "textures/skybox/bottaom.png", - "textures/skybox/back.png", - "textures/skybox/front.png" - }; - - - int w, h; - unsigned char* data; - for (unsigned int i = 0; i < 6; i++) - { - data = SOIL_load_image(filepaths[i].c_str(), &w, &h, 0, SOIL_LOAD_RGBA); - glTexImage2D( - GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, - 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data - ); - } - - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - //skybox end - -} - -void shutdown(GLFWwindow* window) -{ - shaderLoader.DeleteProgram(program); -} - -//obsluga wejscia -void processInput(GLFWwindow* window) -{ - glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f))); - glm::vec3 spaceshipUp = glm::vec3(0.f, 1.f, 0.f); - float angleSpeed = 0.005f; - float moveSpeed = 0.0025f; - if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { - glfwSetWindowShouldClose(window, true); - } - if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) - spaceshipPos += spaceshipDir * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) - spaceshipPos -= spaceshipDir * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS) - spaceshipPos += spaceshipSide * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS) - spaceshipPos -= spaceshipSide * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) - spaceshipPos += spaceshipUp * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) - spaceshipPos -= spaceshipUp * moveSpeed; - if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) - spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0)); - if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) - spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0)); - - cameraPos = spaceshipPos - 1.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.5f; - cameraDir = spaceshipDir; - - //cameraDir = glm::normalize(-cameraPos); - -} - -// funkcja jest glowna petla -void renderLoop(GLFWwindow* window) { - while (!glfwWindowShouldClose(window)) - { - processInput(window); - - renderScene(window); - glfwPollEvents(); - } -} +#include "glew.h" +#include +#include "glm.hpp" +#include "ext.hpp" +#include +#include + +#include "Shader_Loader.h" +#include "Render_Utils.h" +#include "Texture.h" + +#include "Box.cpp" +#include +#include +#include +#include +#include "SOIL/SOIL.h" + + +namespace texture { + GLuint mercury; + GLuint venus; + GLuint earth; + GLuint moon; + GLuint ship; + GLuint sun; + GLuint mars; + GLuint jupiter; + GLuint saturn; + GLuint uranus; + GLuint neptune; + + GLuint mercuryNormal; + GLuint venusNormal; + GLuint earthNormal; + GLuint asteroidNormal; + GLuint shipNormal; + GLuint marsNormal; + GLuint jupiterNormal; + GLuint saturnNormal; + GLuint uranusNormal; + GLuint neptuneNormal; + + GLuint grid; +} + + +GLuint program; +GLuint programSun; +GLuint programTex; +GLuint programEarth; +GLuint programProcTex; +GLuint programSkyBox; +GLuint programCoin; +Core::Shader_Loader shaderLoader; + +Core::RenderContext shipContext; +Core::RenderContext sphereContext; +Core::RenderContext cubeContext; +Core::RenderContext cylinderContext; + +glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0); +glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f); + +glm::vec3 spaceshipPos = glm::vec3(-4.f, 0, 0); +glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f); +GLuint VAO,VBO; + +float aspectRatio = 1.f; +unsigned int textureID; + + +glm::mat4 createCameraMatrix() +{ + glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f))); + glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide,cameraDir)); + glm::mat4 cameraRotrationMatrix = glm::mat4({ + cameraSide.x,cameraSide.y,cameraSide.z,0, + cameraUp.x,cameraUp.y,cameraUp.z ,0, + -cameraDir.x,-cameraDir.y,-cameraDir.z,0, + 0.,0.,0.,1., + }); + cameraRotrationMatrix = glm::transpose(cameraRotrationMatrix); + glm::mat4 cameraMatrix = cameraRotrationMatrix * glm::translate(-cameraPos); + + return cameraMatrix; +} + +glm::mat4 createPerspectiveMatrix() +{ + + glm::mat4 perspectiveMatrix; + float n = 0.05; + float f = 20.; + float a1 = glm::min(aspectRatio, 1.f); + float a2 = glm::min(1 / aspectRatio, 1.f); + perspectiveMatrix = glm::mat4({ + 1,0.,0.,0., + 0.,aspectRatio,0.,0., + 0.,0.,(f+n) / (n - f),2*f * n / (n - f), + 0.,0.,-1.,0., + }); + + + perspectiveMatrix=glm::transpose(perspectiveMatrix); + + return perspectiveMatrix; +} + +void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) { + GLuint prog = program; + glUseProgram(prog); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); + glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z); + glUniform3f(glGetUniformLocation(prog, "lightPos"), 0,0,0); + Core::DrawContext(context); + +} + +void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalMapId) { + GLuint prog = programTex; + glUseProgram(prog); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); + glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0); + Core::SetActiveTexture(textureID, "colorTexture", prog, 0); + Core::SetActiveTexture(normalMapId, "normalSampler", prog, 1); + Core::DrawContext(context); + +} +void drawCylinder(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) { + GLuint prog = programCoin; + glUseProgram(prog); + float time = glfwGetTime(); + + glm::mat4 modelMatrixForMultiplications = modelMatrix * glm::rotate(glm::mat4(1.0f), time * 1.0f, glm::vec3(0, 1, 0)) + * glm::scale(glm::vec3(0.5f)); + modelMatrix = modelMatrixForMultiplications; + + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + + glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); + + glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z); + glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0); + + Core::DrawContext(context); +} + + + + + + +void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID) +{ + GLuint prog = programSun; + glUseProgram(prog); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniform1f(glGetUniformLocation(prog, "exposition"), 1.f); + Core::SetActiveTexture(textureID, "sunTexture", prog, 0); + Core::DrawContext(context); +} + +void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) { + glDisable(GL_DEPTH_TEST); + glUseProgram(programSkyBox); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation"); + glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transformation)); + GLint modelLoc = glGetUniformLocation(programSkyBox, "modelMatrix"); + glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(modelMatrix)); + glUniform3f(glGetUniformLocation(programSkyBox, "lightPos"), 0, 0, 0); + glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); + Core::DrawContext(context); + glEnable(GL_DEPTH_TEST); + +} + + +void renderPlanet(float time, float orbitRadius, float orbitRotationSpeed, float selfRotationSpeed, float scale, GLuint planetTexture, GLuint normalTexture) { + glm::mat4 planetTransform = glm::rotate(glm::mat4(1.0f), time * orbitRotationSpeed, glm::vec3(0, 1, 0)) // orbitowanie dookoa soca + * glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odlego + * glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrt planety wok wasnej osi + * glm::scale(glm::vec3(scale)); //skalowanie planety + + drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture); +} + +void renderPlanets() { + float time = glfwGetTime(); + + float mercuryOrbitRadius = 1.3f; + float venusOrbitRadius = 2.0f; + float earthOrbitRadius = 5.0f; + float moonOrbitRadius = 0.8f; + float marsOrbitRadius = 8.0f; + float jupiterOrbitRadius = 10.0f; + float saturnOrbitRadius = 11.0f; + float uranusOrbitRadius = 12.5f; + float neptuneOrbitRadius = 13.0f; + + // im mniejsze tym szybciej + float mercuryRotationSpeed = 1.0f / 10; + float venusRotationSpeed = 1.0f / 7; + float earthRotationSpeed = 1.0f / 6; + float moonRotationSpeed = 1.0f / 2; + float marsRotationSpeed = 1.0f / 5; + float jupiterRotationSpeed = 1.0f / 8.5; + float saturnRotationSpeed = 1.0f / 5; + float uranusRotationSpeed = 1.0f / 9; + float neptuneRotationSpeed = 1.0f / 10; + + float mercurySelfRotationSpeed = 1.0f; + float venusSelfRotationSpeed = 1.0f; + float earthSelfRotationSpeed = 1.0f; + float moonSelfRotationSpeed = 1.0f / 2; + float marsSelfRotationSpeed = 1.0f; + float jupiterSelfRotationSpeed = 1.0f; + float saturnSelfRotationSpeed = 1.0f; + float uranusSelfRotationSpeed = 1.0f / 2; + float neptuneSelfRotationSpeed = 1.0f; + + float mercuryScale = 0.11f; + float venusScale = 0.14f; + float earthScale = 0.3f; + float moonScale = 0.055f; + float marsScale = 0.2f; + float jupiterScale = 0.7f; + float saturnScale = 0.5f; + float uranusScale = 0.3f; + float neptuneScale = 0.32f; + + renderPlanet(time, mercuryOrbitRadius, mercuryRotationSpeed, mercurySelfRotationSpeed, mercuryScale, texture::mercury, texture::mercuryNormal); + renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal); + renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal); + + //earths moon, musi by inaczej renderowany bo on nie orbituje wok soca tylko ziemi. Pniej to mona jako lepiej rozwiza. + drawObjectTexture(sphereContext, + glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::eulerAngleY(time * moonRotationSpeed) * glm::translate(glm::vec3(moonOrbitRadius, 0, 0)) * glm::scale(glm::vec3(moonScale)), + texture::moon, + texture::asteroidNormal); + + renderPlanet(time, marsOrbitRadius, marsRotationSpeed, marsSelfRotationSpeed, marsScale, texture::mars, texture::marsNormal); + renderPlanet(time, jupiterOrbitRadius, jupiterRotationSpeed, jupiterSelfRotationSpeed, jupiterScale, texture::jupiter, texture::jupiterNormal); + renderPlanet(time, saturnOrbitRadius, saturnRotationSpeed, saturnSelfRotationSpeed, saturnScale, texture::saturn, texture::saturnNormal); + renderPlanet(time, uranusOrbitRadius, uranusRotationSpeed, uranusSelfRotationSpeed, uranusScale, texture::uranus, texture::uranusNormal); + renderPlanet(time, neptuneOrbitRadius, neptuneRotationSpeed, neptuneSelfRotationSpeed, neptuneScale, texture::neptune, texture::neptuneNormal); + +} + +void renderScene(GLFWwindow* window) +{ + glClearColor(0.0f, 0.3f, 0.3f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + + //skybox + drawObjectSkyBox(cubeContext, glm::translate(cameraPos)); + + //sun + + drawSun(sphereContext, glm::mat4(), texture::sun); + + + + renderPlanets(); + drawCylinder(cylinderContext, glm::translate(glm::vec3(5.0f, 0.0f, 0.0f)), glm::vec3(1.0f, 1.0f, 0.0f)); + + 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::mat4 specshipCameraRotrationMatrix = glm::mat4({ + spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0, + spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0, + -spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0, + 0.,0.,0.,1., + }); + + //spaceship drawing + drawObjectTexture(shipContext, + glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi()), + texture::ship, texture::shipNormal + ); + + glUseProgram(0); + glfwSwapBuffers(window); +} +void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + aspectRatio = width / float(height); + glViewport(0, 0, width, height); +} +void loadModelToContext(std::string path, Core::RenderContext& context) +{ + Assimp::Importer import; + const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace); + + if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) + { + std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl; + return; + } + context.initFromAssimpMesh(scene->mMeshes[0]); +} + +void init(GLFWwindow* window) +{ + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); + + glEnable(GL_DEPTH_TEST); + program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag"); + //programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); + programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex_copy.vert", "shaders/shader_5_1_tex_copy.frag"); + programEarth = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); + programProcTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); + programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag"); + programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag"); + programCoin = shaderLoader.CreateProgram("shaders/shader_coin.vert", "shaders/shader_coin.frag"); + + loadModelToContext("./models/sphere.obj", sphereContext); + loadModelToContext("./models/spaceship.obj", shipContext); + loadModelToContext("./models/cube.obj", cubeContext); + loadModelToContext("./models/cylinder.obj", cylinderContext); + + texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg"); + texture::venus = Core::LoadTexture("textures/venus/venus.jpg"); + texture::earth = Core::LoadTexture("textures/earth/earth.png"); + texture::ship = Core::LoadTexture("textures/spaceship/spaceship.jpg"); + texture::moon = Core::LoadTexture("textures/earths_moon/moon.jpg"); + texture::sun = Core::LoadTexture("textures/sun/sun.jpg"); + texture::mars = Core::LoadTexture("textures/mars/mars.jpg"); + texture::jupiter = Core::LoadTexture("textures/jupiter/jupiter.jpg"); + texture::saturn = Core::LoadTexture("textures/saturn/saturn.jpg"); + texture::uranus = Core::LoadTexture("textures/uranus/uranus.jpg"); + texture::neptune = Core::LoadTexture("textures/neptune/neptune.jpg"); + + texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png"); + texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png"); + texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png"); + texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg"); + texture::asteroidNormal = Core::LoadTexture("textures/earths_moon/moon_normal.jpg"); + texture::marsNormal = Core::LoadTexture("textures/mars/mars_normal.jpg"); + texture::jupiterNormal = Core::LoadTexture("textures/jupiter/jupiter_normal.png"); + texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png"); + texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png"); + texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png"); + + + //tutaj skybox start + glGenTextures(1, &textureID); + glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); + + std::vector filepaths = { + "textures/skybox/right.png", + "textures/skybox/left.png", + "textures/skybox/top.png", + "textures/skybox/bottaom.png", + "textures/skybox/back.png", + "textures/skybox/front.png" + }; + + + int w, h; + unsigned char* data; + for (unsigned int i = 0; i < 6; i++) + { + data = SOIL_load_image(filepaths[i].c_str(), &w, &h, 0, SOIL_LOAD_RGBA); + glTexImage2D( + GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, + 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data + ); + } + + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + //skybox end + +} + +void shutdown(GLFWwindow* window) +{ + shaderLoader.DeleteProgram(program); +} + +//obsluga wejscia +void processInput(GLFWwindow* window) +{ + glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f))); + glm::vec3 spaceshipUp = glm::vec3(0.f, 1.f, 0.f); + float angleSpeed = 0.005f; + float moveSpeed = 0.0025f; + if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { + glfwSetWindowShouldClose(window, true); + } + if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) + spaceshipPos += spaceshipDir * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) + spaceshipPos -= spaceshipDir * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS) + spaceshipPos += spaceshipSide * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS) + spaceshipPos -= spaceshipSide * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) + spaceshipPos += spaceshipUp * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) + spaceshipPos -= spaceshipUp * moveSpeed; + if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) + spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0)); + if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) + spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0)); + + cameraPos = spaceshipPos - 1.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.5f; + cameraDir = spaceshipDir; + + //cameraDir = glm::normalize(-cameraPos); + +} + +// funkcja jest glowna petla +void renderLoop(GLFWwindow* window) { + while (!glfwWindowShouldClose(window)) + { + processInput(window); + + renderScene(window); + glfwPollEvents(); + } +}