implementacja_obrotu_monety
This commit is contained in:
parent
c1ab946f11
commit
a865001f9f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,91 +1,109 @@
|
|||||||
{
|
{
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"WorkspaceRootPath": "C:\\Users\\maksg\\Documents\\Grafika_2024\\",
|
"WorkspaceRootPath": "C:\\Users\\maksg\\Documents\\Grafika_2024\\",
|
||||||
"Documents": [
|
"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}",
|
"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}"
|
"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}",
|
"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.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.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.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.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.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}",
|
"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\\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\\shaders\\shader_5_1_tex_copy.frag||{8B382828-6202-11D1-8870-0000F87579D2}"
|
||||||
}
|
},
|
||||||
],
|
{
|
||||||
"DocumentGroupContainers": [
|
"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}"
|
||||||
"Orientation": 0,
|
}
|
||||||
"VerticalTabListWidth": 256,
|
],
|
||||||
"DocumentGroups": [
|
"DocumentGroupContainers": [
|
||||||
{
|
{
|
||||||
"DockedWidth": 200,
|
"Orientation": 0,
|
||||||
"SelectedChildIndex": 3,
|
"VerticalTabListWidth": 256,
|
||||||
"Children": [
|
"DocumentGroups": [
|
||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"DockedWidth": 200,
|
||||||
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
"SelectedChildIndex": 4,
|
||||||
},
|
"Children": [
|
||||||
{
|
{
|
||||||
"$type": "Document",
|
"$type": "Bookmark",
|
||||||
"DocumentIndex": 1,
|
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
"Title": "shader_coin.frag",
|
},
|
||||||
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag",
|
{
|
||||||
"RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.frag",
|
"$type": "Document",
|
||||||
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag",
|
"DocumentIndex": 3,
|
||||||
"RelativeToolTip": "projekt_grk\\shaders\\shader_coin.frag",
|
"Title": "shader_5_1_tex_copy.frag",
|
||||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAaAAAA",
|
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_5_1_tex_copy.frag",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
"RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_5_1_tex_copy.frag",
|
||||||
"WhenOpened": "2024-02-26T19:01:49.259Z",
|
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_5_1_tex_copy.frag",
|
||||||
"EditorCaption": ""
|
"RelativeToolTip": "projekt_grk\\shaders\\shader_5_1_tex_copy.frag",
|
||||||
},
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||||
{
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||||
"$type": "Document",
|
"WhenOpened": "2024-02-28T08:58:43.519Z",
|
||||||
"DocumentIndex": 2,
|
"EditorCaption": ""
|
||||||
"Title": "shader_coin.vert",
|
},
|
||||||
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert",
|
{
|
||||||
"RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.vert",
|
"$type": "Document",
|
||||||
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert",
|
"DocumentIndex": 2,
|
||||||
"RelativeToolTip": "projekt_grk\\shaders\\shader_coin.vert",
|
"Title": "shader_coin.frag",
|
||||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
|
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
"RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.frag",
|
||||||
"WhenOpened": "2024-02-26T19:01:39.656Z",
|
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.frag",
|
||||||
"EditorCaption": ""
|
"RelativeToolTip": "projekt_grk\\shaders\\shader_coin.frag",
|
||||||
},
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAbAAAA",
|
||||||
{
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||||
"$type": "Document",
|
"WhenOpened": "2024-02-26T19:01:49.259Z",
|
||||||
"DocumentIndex": 0,
|
"EditorCaption": ""
|
||||||
"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",
|
"$type": "Document",
|
||||||
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp",
|
"DocumentIndex": 1,
|
||||||
"RelativeToolTip": "projekt_grk\\src\\ex_7_1.hpp",
|
"Title": "shader_coin.vert",
|
||||||
"ViewState": "AQIAAPwAAAAAAAAAAAAYwP8AAAAaAAAA",
|
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
"RelativeDocumentMoniker": "projekt_grk\\shaders\\shader_coin.vert",
|
||||||
"WhenOpened": "2024-02-25T17:55:58.673Z",
|
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\shaders\\shader_coin.vert",
|
||||||
"EditorCaption": ""
|
"RelativeToolTip": "projekt_grk\\shaders\\shader_coin.vert",
|
||||||
},
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAA9AAAA",
|
||||||
{
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||||
"$type": "Document",
|
"WhenOpened": "2024-02-26T19:01:39.656Z",
|
||||||
"DocumentIndex": 3,
|
"EditorCaption": ""
|
||||||
"Title": "main.cpp",
|
},
|
||||||
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp",
|
{
|
||||||
"RelativeDocumentMoniker": "projekt_grk\\src\\main.cpp",
|
"$type": "Document",
|
||||||
"ToolTip": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp",
|
"DocumentIndex": 0,
|
||||||
"RelativeToolTip": "projekt_grk\\src\\main.cpp",
|
"Title": "ex_7_1.hpp",
|
||||||
"ViewState": "AQIAABcAAAAAAAAAAAAtwCYAAAAAAAAA",
|
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\ex_7_1.hpp",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
"RelativeDocumentMoniker": "projekt_grk\\src\\ex_7_1.hpp",
|
||||||
"WhenOpened": "2024-02-26T20:07:44.538Z"
|
"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": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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.
|
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
|
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
|
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”)
|
(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):
|
C:\Users\maksg\Documents\Grafika_2024\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1):
|
||||||
zobacz poprzednią definicję „APIENTRY”
|
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"
|
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”)
|
(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
|
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”)
|
(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"
|
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”)
|
(kompilowanie pliku źródłowego „src/main.cpp”)
|
||||||
|
|
||||||
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
C:\Users\maksg\Documents\Grafika_2024\projekt_grk\src\ex_7_1.hpp(228,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
|
(kompilowanie pliku źródłowego „src/main.cpp”)
|
||||||
grk-cw7.vcxproj -> C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe
|
|
||||||
|
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
|
||||||
|
Binary file not shown.
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project>
|
<Project>
|
||||||
<ProjectOutputs>
|
<ProjectOutputs>
|
||||||
<ProjectOutput>
|
<ProjectOutput>
|
||||||
<FullPath>C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe</FullPath>
|
<FullPath>C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe</FullPath>
|
||||||
</ProjectOutput>
|
</ProjectOutput>
|
||||||
</ProjectOutputs>
|
</ProjectOutputs>
|
||||||
<ContentFiles />
|
<ContentFiles />
|
||||||
<SatelliteDlls />
|
<SatelliteDlls />
|
||||||
<NonRecipeFileRefs />
|
<NonRecipeFileRefs />
|
||||||
</Project>
|
</Project>
|
@ -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\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\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\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\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\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_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\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\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\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\Texture.cpp;C:\Users\maksg\Documents\Grafika_2024\projekt_grk\Debug\Texture.obj
|
||||||
|
@ -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
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
|
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
|
||||||
Debug|Win32|C:\Users\maksg\Documents\Grafika_2024\|
|
Debug|Win32|C:\Users\maksg\Documents\Grafika_2024\|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,4 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup />
|
<PropertyGroup>
|
||||||
|
<ShowAllFiles>false</ShowAllFiles>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,20 +1,12 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
|
||||||
in vec3 FragPos;
|
uniform vec3 color;
|
||||||
in vec3 Normal;
|
|
||||||
|
out vec4 FinalColor;
|
||||||
out vec4 FragColor;
|
|
||||||
|
void main()
|
||||||
uniform vec3 color;
|
{
|
||||||
|
|
||||||
void main()
|
FinalColor = vec4(color, 1.0);
|
||||||
{
|
}
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
|
||||||
layout(location = 0) in vec3 vertexPosition;
|
layout(location = 0) in vec3 vertexPosition;
|
||||||
layout(location = 1) in vec3 vertexNormal;
|
layout(location = 1) in vec3 vertexNormal;
|
||||||
layout(location = 2) in vec2 vertexTexCoord;
|
|
||||||
|
uniform mat4 transformation;
|
||||||
uniform mat4 transformation;
|
uniform mat4 modelMatrix;
|
||||||
uniform mat4 modelMatrix;
|
|
||||||
|
void main()
|
||||||
out vec3 FragPos;
|
{
|
||||||
out vec3 Normal;
|
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||||
|
}
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 rotatedPosition = modelMatrix * vec4(vertexPosition, 1.0);
|
|
||||||
gl_Position = transformation * rotatedPosition;
|
|
||||||
Normal = mat3(transpose(inverse(transformation))) * vertexNormal;
|
|
||||||
FragPos = rotatedPosition.xyz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,447 +1,441 @@
|
|||||||
#include "glew.h"
|
#include "glew.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include "glm.hpp"
|
#include "glm.hpp"
|
||||||
#include "ext.hpp"
|
#include "ext.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "Shader_Loader.h"
|
#include "Shader_Loader.h"
|
||||||
#include "Render_Utils.h"
|
#include "Render_Utils.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
|
|
||||||
#include "Box.cpp"
|
#include "Box.cpp"
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "SOIL/SOIL.h"
|
#include "SOIL/SOIL.h"
|
||||||
|
|
||||||
|
|
||||||
namespace texture {
|
namespace texture {
|
||||||
GLuint mercury;
|
GLuint mercury;
|
||||||
GLuint venus;
|
GLuint venus;
|
||||||
GLuint earth;
|
GLuint earth;
|
||||||
GLuint moon;
|
GLuint moon;
|
||||||
GLuint ship;
|
GLuint ship;
|
||||||
GLuint sun;
|
GLuint sun;
|
||||||
GLuint mars;
|
GLuint mars;
|
||||||
GLuint jupiter;
|
GLuint jupiter;
|
||||||
GLuint saturn;
|
GLuint saturn;
|
||||||
GLuint uranus;
|
GLuint uranus;
|
||||||
GLuint neptune;
|
GLuint neptune;
|
||||||
|
|
||||||
GLuint mercuryNormal;
|
GLuint mercuryNormal;
|
||||||
GLuint venusNormal;
|
GLuint venusNormal;
|
||||||
GLuint earthNormal;
|
GLuint earthNormal;
|
||||||
GLuint asteroidNormal;
|
GLuint asteroidNormal;
|
||||||
GLuint shipNormal;
|
GLuint shipNormal;
|
||||||
GLuint marsNormal;
|
GLuint marsNormal;
|
||||||
GLuint jupiterNormal;
|
GLuint jupiterNormal;
|
||||||
GLuint saturnNormal;
|
GLuint saturnNormal;
|
||||||
GLuint uranusNormal;
|
GLuint uranusNormal;
|
||||||
GLuint neptuneNormal;
|
GLuint neptuneNormal;
|
||||||
|
|
||||||
GLuint grid;
|
GLuint grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLuint program;
|
GLuint program;
|
||||||
GLuint programSun;
|
GLuint programSun;
|
||||||
GLuint programTex;
|
GLuint programTex;
|
||||||
GLuint programEarth;
|
GLuint programEarth;
|
||||||
GLuint programProcTex;
|
GLuint programProcTex;
|
||||||
GLuint programSkyBox;
|
GLuint programSkyBox;
|
||||||
GLuint programCoin;
|
GLuint programCoin;
|
||||||
Core::Shader_Loader shaderLoader;
|
Core::Shader_Loader shaderLoader;
|
||||||
|
|
||||||
Core::RenderContext shipContext;
|
Core::RenderContext shipContext;
|
||||||
Core::RenderContext sphereContext;
|
Core::RenderContext sphereContext;
|
||||||
Core::RenderContext cubeContext;
|
Core::RenderContext cubeContext;
|
||||||
Core::RenderContext cylinderContext;
|
Core::RenderContext cylinderContext;
|
||||||
|
|
||||||
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
||||||
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
|
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
|
||||||
|
|
||||||
glm::vec3 spaceshipPos = glm::vec3(-4.f, 0, 0);
|
glm::vec3 spaceshipPos = glm::vec3(-4.f, 0, 0);
|
||||||
glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f);
|
glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f);
|
||||||
GLuint VAO,VBO;
|
GLuint VAO,VBO;
|
||||||
|
|
||||||
float aspectRatio = 1.f;
|
float aspectRatio = 1.f;
|
||||||
unsigned int textureID;
|
unsigned int textureID;
|
||||||
|
|
||||||
|
|
||||||
glm::mat4 createCameraMatrix()
|
glm::mat4 createCameraMatrix()
|
||||||
{
|
{
|
||||||
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f)));
|
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::vec3 cameraUp = glm::normalize(glm::cross(cameraSide,cameraDir));
|
||||||
glm::mat4 cameraRotrationMatrix = glm::mat4({
|
glm::mat4 cameraRotrationMatrix = glm::mat4({
|
||||||
cameraSide.x,cameraSide.y,cameraSide.z,0,
|
cameraSide.x,cameraSide.y,cameraSide.z,0,
|
||||||
cameraUp.x,cameraUp.y,cameraUp.z ,0,
|
cameraUp.x,cameraUp.y,cameraUp.z ,0,
|
||||||
-cameraDir.x,-cameraDir.y,-cameraDir.z,0,
|
-cameraDir.x,-cameraDir.y,-cameraDir.z,0,
|
||||||
0.,0.,0.,1.,
|
0.,0.,0.,1.,
|
||||||
});
|
});
|
||||||
cameraRotrationMatrix = glm::transpose(cameraRotrationMatrix);
|
cameraRotrationMatrix = glm::transpose(cameraRotrationMatrix);
|
||||||
glm::mat4 cameraMatrix = cameraRotrationMatrix * glm::translate(-cameraPos);
|
glm::mat4 cameraMatrix = cameraRotrationMatrix * glm::translate(-cameraPos);
|
||||||
|
|
||||||
return cameraMatrix;
|
return cameraMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 createPerspectiveMatrix()
|
glm::mat4 createPerspectiveMatrix()
|
||||||
{
|
{
|
||||||
|
|
||||||
glm::mat4 perspectiveMatrix;
|
glm::mat4 perspectiveMatrix;
|
||||||
float n = 0.05;
|
float n = 0.05;
|
||||||
float f = 20.;
|
float f = 20.;
|
||||||
float a1 = glm::min(aspectRatio, 1.f);
|
float a1 = glm::min(aspectRatio, 1.f);
|
||||||
float a2 = glm::min(1 / aspectRatio, 1.f);
|
float a2 = glm::min(1 / aspectRatio, 1.f);
|
||||||
perspectiveMatrix = glm::mat4({
|
perspectiveMatrix = glm::mat4({
|
||||||
1,0.,0.,0.,
|
1,0.,0.,0.,
|
||||||
0.,aspectRatio,0.,0.,
|
0.,aspectRatio,0.,0.,
|
||||||
0.,0.,(f+n) / (n - f),2*f * n / (n - f),
|
0.,0.,(f+n) / (n - f),2*f * n / (n - f),
|
||||||
0.,0.,-1.,0.,
|
0.,0.,-1.,0.,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
perspectiveMatrix=glm::transpose(perspectiveMatrix);
|
perspectiveMatrix=glm::transpose(perspectiveMatrix);
|
||||||
|
|
||||||
return perspectiveMatrix;
|
return perspectiveMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) {
|
void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) {
|
||||||
GLuint prog = program;
|
GLuint prog = program;
|
||||||
glUseProgram(prog);
|
glUseProgram(prog);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z);
|
glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z);
|
||||||
glUniform3f(glGetUniformLocation(prog, "lightPos"), 0,0,0);
|
glUniform3f(glGetUniformLocation(prog, "lightPos"), 0,0,0);
|
||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalMapId) {
|
void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalMapId) {
|
||||||
GLuint prog = programTex;
|
GLuint prog = programTex;
|
||||||
glUseProgram(prog);
|
glUseProgram(prog);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0);
|
glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0);
|
||||||
Core::SetActiveTexture(textureID, "colorTexture", prog, 0);
|
Core::SetActiveTexture(textureID, "colorTexture", prog, 0);
|
||||||
Core::SetActiveTexture(normalMapId, "normalSampler", prog, 1);
|
Core::SetActiveTexture(normalMapId, "normalSampler", prog, 1);
|
||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
|
|
||||||
}
|
}
|
||||||
void drawCylinder(Core::RenderContext& context, glm::mat4 modelMatrix, float height, float radius, glm::vec3 color) {
|
void drawCylinder(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color) {
|
||||||
GLuint prog = programCoin;
|
GLuint prog = programCoin;
|
||||||
glUseProgram(prog);
|
glUseProgram(prog);
|
||||||
|
float time = glfwGetTime();
|
||||||
// Rotate the modelMatrix to make the cylinder vertically oriented
|
|
||||||
|
glm::mat4 modelMatrixForMultiplications = modelMatrix * glm::rotate(glm::mat4(1.0f), time * 1.0f, glm::vec3(0, 1, 0))
|
||||||
modelMatrix = glm::rotate(modelMatrix, glm::radians(-90.0f), glm::vec3(1, 0, 0)); // Rotate around x-axis
|
* glm::scale(glm::vec3(0.5f));
|
||||||
modelMatrix = glm::scale(modelMatrix, glm::vec3(radius, height, radius)); // Scale
|
modelMatrix = modelMatrixForMultiplications;
|
||||||
|
|
||||||
// Calculate model-view-projection matrix
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
// Set transformation matrices in the shader
|
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&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);
|
||||||
// Set color and light position in the shader
|
|
||||||
glUniform3f(glGetUniformLocation(prog, "color"), color.x, color.y, color.z);
|
Core::DrawContext(context);
|
||||||
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);
|
||||||
void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID)
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
{
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
GLuint prog = programSun;
|
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
glUseProgram(prog);
|
glUniform1f(glGetUniformLocation(prog, "exposition"), 1.f);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
Core::SetActiveTexture(textureID, "sunTexture", prog, 0);
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
Core::DrawContext(context);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
}
|
||||||
glUniform1f(glGetUniformLocation(prog, "exposition"), 1.f);
|
|
||||||
Core::SetActiveTexture(textureID, "sunTexture", prog, 0);
|
void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
|
||||||
Core::DrawContext(context);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
glUseProgram(programSkyBox);
|
||||||
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
glDisable(GL_DEPTH_TEST);
|
GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation");
|
||||||
glUseProgram(programSkyBox);
|
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transformation));
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
GLint modelLoc = glGetUniformLocation(programSkyBox, "modelMatrix");
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(modelMatrix));
|
||||||
GLint transformLoc = glGetUniformLocation(programSkyBox, "transformation");
|
glUniform3f(glGetUniformLocation(programSkyBox, "lightPos"), 0, 0, 0);
|
||||||
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transformation));
|
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||||
GLint modelLoc = glGetUniformLocation(programSkyBox, "modelMatrix");
|
Core::DrawContext(context);
|
||||||
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(modelMatrix));
|
glEnable(GL_DEPTH_TEST);
|
||||||
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 dooko³a s³oñca
|
||||||
|
* glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odleg³oœæ
|
||||||
|
* glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrót planety wokó³ w³asnej osi
|
||||||
void renderPlanet(float time, float orbitRadius, float orbitRotationSpeed, float selfRotationSpeed, float scale, GLuint planetTexture, GLuint normalTexture) {
|
* glm::scale(glm::vec3(scale)); //skalowanie planety
|
||||||
glm::mat4 planetTransform = glm::rotate(glm::mat4(1.0f), time * orbitRotationSpeed, glm::vec3(0, 1, 0)) // orbitowanie dooko³a s³oñca
|
|
||||||
* glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odleg³oœæ
|
drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture);
|
||||||
* glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrót planety wokó³ w³asnej osi
|
}
|
||||||
* glm::scale(glm::vec3(scale)); //skalowanie planety
|
|
||||||
|
void renderPlanets() {
|
||||||
drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture);
|
float time = glfwGetTime();
|
||||||
}
|
|
||||||
|
float mercuryOrbitRadius = 1.3f;
|
||||||
void renderPlanets() {
|
float venusOrbitRadius = 2.0f;
|
||||||
float time = glfwGetTime();
|
float earthOrbitRadius = 5.0f;
|
||||||
|
float moonOrbitRadius = 0.8f;
|
||||||
float mercuryOrbitRadius = 1.3f;
|
float marsOrbitRadius = 8.0f;
|
||||||
float venusOrbitRadius = 2.0f;
|
float jupiterOrbitRadius = 10.0f;
|
||||||
float earthOrbitRadius = 5.0f;
|
float saturnOrbitRadius = 11.0f;
|
||||||
float moonOrbitRadius = 0.8f;
|
float uranusOrbitRadius = 12.5f;
|
||||||
float marsOrbitRadius = 8.0f;
|
float neptuneOrbitRadius = 13.0f;
|
||||||
float jupiterOrbitRadius = 10.0f;
|
|
||||||
float saturnOrbitRadius = 11.0f;
|
// im mniejsze tym szybciej
|
||||||
float uranusOrbitRadius = 12.5f;
|
float mercuryRotationSpeed = 1.0f / 10;
|
||||||
float neptuneOrbitRadius = 13.0f;
|
float venusRotationSpeed = 1.0f / 7;
|
||||||
|
float earthRotationSpeed = 1.0f / 6;
|
||||||
// im mniejsze tym szybciej
|
float moonRotationSpeed = 1.0f / 2;
|
||||||
float mercuryRotationSpeed = 1.0f / 10;
|
float marsRotationSpeed = 1.0f / 5;
|
||||||
float venusRotationSpeed = 1.0f / 7;
|
float jupiterRotationSpeed = 1.0f / 8.5;
|
||||||
float earthRotationSpeed = 1.0f / 6;
|
float saturnRotationSpeed = 1.0f / 5;
|
||||||
float moonRotationSpeed = 1.0f / 2;
|
float uranusRotationSpeed = 1.0f / 9;
|
||||||
float marsRotationSpeed = 1.0f / 5;
|
float neptuneRotationSpeed = 1.0f / 10;
|
||||||
float jupiterRotationSpeed = 1.0f / 8.5;
|
|
||||||
float saturnRotationSpeed = 1.0f / 5;
|
float mercurySelfRotationSpeed = 1.0f;
|
||||||
float uranusRotationSpeed = 1.0f / 9;
|
float venusSelfRotationSpeed = 1.0f;
|
||||||
float neptuneRotationSpeed = 1.0f / 10;
|
float earthSelfRotationSpeed = 1.0f;
|
||||||
|
float moonSelfRotationSpeed = 1.0f / 2;
|
||||||
float mercurySelfRotationSpeed = 1.0f;
|
float marsSelfRotationSpeed = 1.0f;
|
||||||
float venusSelfRotationSpeed = 1.0f;
|
float jupiterSelfRotationSpeed = 1.0f;
|
||||||
float earthSelfRotationSpeed = 1.0f;
|
float saturnSelfRotationSpeed = 1.0f;
|
||||||
float moonSelfRotationSpeed = 1.0f / 2;
|
float uranusSelfRotationSpeed = 1.0f / 2;
|
||||||
float marsSelfRotationSpeed = 1.0f;
|
float neptuneSelfRotationSpeed = 1.0f;
|
||||||
float jupiterSelfRotationSpeed = 1.0f;
|
|
||||||
float saturnSelfRotationSpeed = 1.0f;
|
float mercuryScale = 0.11f;
|
||||||
float uranusSelfRotationSpeed = 1.0f / 2;
|
float venusScale = 0.14f;
|
||||||
float neptuneSelfRotationSpeed = 1.0f;
|
float earthScale = 0.3f;
|
||||||
|
float moonScale = 0.055f;
|
||||||
float mercuryScale = 0.11f;
|
float marsScale = 0.2f;
|
||||||
float venusScale = 0.14f;
|
float jupiterScale = 0.7f;
|
||||||
float earthScale = 0.3f;
|
float saturnScale = 0.5f;
|
||||||
float moonScale = 0.055f;
|
float uranusScale = 0.3f;
|
||||||
float marsScale = 0.2f;
|
float neptuneScale = 0.32f;
|
||||||
float jupiterScale = 0.7f;
|
|
||||||
float saturnScale = 0.5f;
|
renderPlanet(time, mercuryOrbitRadius, mercuryRotationSpeed, mercurySelfRotationSpeed, mercuryScale, texture::mercury, texture::mercuryNormal);
|
||||||
float uranusScale = 0.3f;
|
renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal);
|
||||||
float neptuneScale = 0.32f;
|
renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal);
|
||||||
|
|
||||||
renderPlanet(time, mercuryOrbitRadius, mercuryRotationSpeed, mercurySelfRotationSpeed, mercuryScale, texture::mercury, texture::mercuryNormal);
|
//earths moon, musi byæ inaczej renderowany bo on nie orbituje wokó³ s³oñca tylko ziemi. PóŸniej to mo¿na jakoœ lepiej rozwi¹zaæ.
|
||||||
renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal);
|
drawObjectTexture(sphereContext,
|
||||||
renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal);
|
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,
|
||||||
//earths moon, musi byæ inaczej renderowany bo on nie orbituje wokó³ s³oñca tylko ziemi. PóŸniej to mo¿na jakoœ lepiej rozwi¹zaæ.
|
texture::asteroidNormal);
|
||||||
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)),
|
renderPlanet(time, marsOrbitRadius, marsRotationSpeed, marsSelfRotationSpeed, marsScale, texture::mars, texture::marsNormal);
|
||||||
texture::moon,
|
renderPlanet(time, jupiterOrbitRadius, jupiterRotationSpeed, jupiterSelfRotationSpeed, jupiterScale, texture::jupiter, texture::jupiterNormal);
|
||||||
texture::asteroidNormal);
|
renderPlanet(time, saturnOrbitRadius, saturnRotationSpeed, saturnSelfRotationSpeed, saturnScale, texture::saturn, texture::saturnNormal);
|
||||||
|
renderPlanet(time, uranusOrbitRadius, uranusRotationSpeed, uranusSelfRotationSpeed, uranusScale, texture::uranus, texture::uranusNormal);
|
||||||
renderPlanet(time, marsOrbitRadius, marsRotationSpeed, marsSelfRotationSpeed, marsScale, texture::mars, texture::marsNormal);
|
renderPlanet(time, neptuneOrbitRadius, neptuneRotationSpeed, neptuneSelfRotationSpeed, neptuneScale, texture::neptune, texture::neptuneNormal);
|
||||||
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);
|
||||||
void renderScene(GLFWwindow* window)
|
|
||||||
{
|
|
||||||
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
//skybox
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
||||||
|
|
||||||
|
//sun
|
||||||
//skybox
|
|
||||||
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
drawSun(sphereContext, glm::mat4(), texture::sun);
|
||||||
|
|
||||||
//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));
|
||||||
float cylinderHeight = 1.0f;
|
|
||||||
float cylinderRadius = 1.0f;
|
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
drawCylinder(cylinderContext, glm::translate(glm::vec3(5.0f, 0.0f, 0.0f)), cylinderHeight, cylinderRadius, glm::vec3(1.0f, 1.0f, 0.0f));
|
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||||
|
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
|
||||||
renderPlanets();
|
spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0,
|
||||||
|
spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0,
|
||||||
|
-spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0,
|
||||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
0.,0.,0.,1.,
|
||||||
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
});
|
||||||
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
|
|
||||||
spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0,
|
//spaceship drawing
|
||||||
spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0,
|
drawObjectTexture(shipContext,
|
||||||
-spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0,
|
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
||||||
0.,0.,0.,1.,
|
texture::ship, texture::shipNormal
|
||||||
});
|
);
|
||||||
|
|
||||||
//spaceship drawing
|
glUseProgram(0);
|
||||||
drawObjectTexture(shipContext,
|
glfwSwapBuffers(window);
|
||||||
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
|
}
|
||||||
texture::ship, texture::shipNormal
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||||
);
|
{
|
||||||
|
aspectRatio = width / float(height);
|
||||||
glUseProgram(0);
|
glViewport(0, 0, width, height);
|
||||||
glfwSwapBuffers(window);
|
}
|
||||||
}
|
void loadModelToContext(std::string path, Core::RenderContext& context)
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
{
|
||||||
{
|
Assimp::Importer import;
|
||||||
aspectRatio = width / float(height);
|
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace);
|
||||||
glViewport(0, 0, width, height);
|
|
||||||
}
|
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
|
||||||
void loadModelToContext(std::string path, Core::RenderContext& context)
|
{
|
||||||
{
|
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
|
||||||
Assimp::Importer import;
|
return;
|
||||||
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace);
|
}
|
||||||
|
context.initFromAssimpMesh(scene->mMeshes[0]);
|
||||||
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
|
}
|
||||||
{
|
|
||||||
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
|
void init(GLFWwindow* window)
|
||||||
return;
|
{
|
||||||
}
|
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||||
context.initFromAssimpMesh(scene->mMeshes[0]);
|
|
||||||
}
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag");
|
||||||
void init(GLFWwindow* window)
|
//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");
|
||||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
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");
|
||||||
glEnable(GL_DEPTH_TEST);
|
programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag");
|
||||||
program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag");
|
programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
||||||
//programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag");
|
programCoin = shaderLoader.CreateProgram("shaders/shader_coin.vert", "shaders/shader_coin.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");
|
loadModelToContext("./models/sphere.obj", sphereContext);
|
||||||
programProcTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag");
|
loadModelToContext("./models/spaceship.obj", shipContext);
|
||||||
programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag");
|
loadModelToContext("./models/cube.obj", cubeContext);
|
||||||
programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
loadModelToContext("./models/cylinder.obj", cylinderContext);
|
||||||
programCoin = shaderLoader.CreateProgram("shaders/shader_coin.vert", "shaders/shader_coin.frag");
|
|
||||||
|
texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg");
|
||||||
loadModelToContext("./models/sphere.obj", sphereContext);
|
texture::venus = Core::LoadTexture("textures/venus/venus.jpg");
|
||||||
loadModelToContext("./models/spaceship.obj", shipContext);
|
texture::earth = Core::LoadTexture("textures/earth/earth.png");
|
||||||
loadModelToContext("./models/cube.obj", cubeContext);
|
texture::ship = Core::LoadTexture("textures/spaceship/spaceship.jpg");
|
||||||
loadModelToContext("./models/cylinder.obj", cylinderContext);
|
texture::moon = Core::LoadTexture("textures/earths_moon/moon.jpg");
|
||||||
|
texture::sun = Core::LoadTexture("textures/sun/sun.jpg");
|
||||||
texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg");
|
texture::mars = Core::LoadTexture("textures/mars/mars.jpg");
|
||||||
texture::venus = Core::LoadTexture("textures/venus/venus.jpg");
|
texture::jupiter = Core::LoadTexture("textures/jupiter/jupiter.jpg");
|
||||||
texture::earth = Core::LoadTexture("textures/earth/earth.png");
|
texture::saturn = Core::LoadTexture("textures/saturn/saturn.jpg");
|
||||||
texture::ship = Core::LoadTexture("textures/spaceship/spaceship.jpg");
|
texture::uranus = Core::LoadTexture("textures/uranus/uranus.jpg");
|
||||||
texture::moon = Core::LoadTexture("textures/earths_moon/moon.jpg");
|
texture::neptune = Core::LoadTexture("textures/neptune/neptune.jpg");
|
||||||
texture::sun = Core::LoadTexture("textures/sun/sun.jpg");
|
|
||||||
texture::mars = Core::LoadTexture("textures/mars/mars.jpg");
|
texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png");
|
||||||
texture::jupiter = Core::LoadTexture("textures/jupiter/jupiter.jpg");
|
texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png");
|
||||||
texture::saturn = Core::LoadTexture("textures/saturn/saturn.jpg");
|
texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png");
|
||||||
texture::uranus = Core::LoadTexture("textures/uranus/uranus.jpg");
|
texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg");
|
||||||
texture::neptune = Core::LoadTexture("textures/neptune/neptune.jpg");
|
texture::asteroidNormal = Core::LoadTexture("textures/earths_moon/moon_normal.jpg");
|
||||||
|
texture::marsNormal = Core::LoadTexture("textures/mars/mars_normal.jpg");
|
||||||
texture::mercuryNormal = Core::LoadTexture("textures/mercury/mercury_normal.png");
|
texture::jupiterNormal = Core::LoadTexture("textures/jupiter/jupiter_normal.png");
|
||||||
texture::venusNormal = Core::LoadTexture("textures/venus/venus_normal.png");
|
texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png");
|
||||||
texture::earthNormal = Core::LoadTexture("textures/earth/earth_normal.png");
|
texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png");
|
||||||
texture::shipNormal = Core::LoadTexture("textures/spaceship/spaceship_normal.jpg");
|
texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png");
|
||||||
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");
|
//tutaj skybox start
|
||||||
texture::saturnNormal = Core::LoadTexture("textures/saturn/saturn_normal.png");
|
glGenTextures(1, &textureID);
|
||||||
texture::uranusNormal = Core::LoadTexture("textures/uranus/uranus_normal.png");
|
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||||
texture::neptuneNormal = Core::LoadTexture("textures/neptune/neptune_normal.png");
|
|
||||||
|
std::vector<std::string> filepaths = {
|
||||||
|
"textures/skybox/right.png",
|
||||||
//tutaj skybox start
|
"textures/skybox/left.png",
|
||||||
glGenTextures(1, &textureID);
|
"textures/skybox/top.png",
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
"textures/skybox/bottaom.png",
|
||||||
|
"textures/skybox/back.png",
|
||||||
std::vector<std::string> filepaths = {
|
"textures/skybox/front.png"
|
||||||
"textures/skybox/right.png",
|
};
|
||||||
"textures/skybox/left.png",
|
|
||||||
"textures/skybox/top.png",
|
|
||||||
"textures/skybox/bottaom.png",
|
int w, h;
|
||||||
"textures/skybox/back.png",
|
unsigned char* data;
|
||||||
"textures/skybox/front.png"
|
for (unsigned int i = 0; i < 6; i++)
|
||||||
};
|
{
|
||||||
|
data = SOIL_load_image(filepaths[i].c_str(), &w, &h, 0, SOIL_LOAD_RGBA);
|
||||||
|
glTexImage2D(
|
||||||
int w, h;
|
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
|
||||||
unsigned char* data;
|
0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data
|
||||||
for (unsigned int i = 0; i < 6; i++)
|
);
|
||||||
{
|
}
|
||||||
data = SOIL_load_image(filepaths[i].c_str(), &w, &h, 0, SOIL_LOAD_RGBA);
|
|
||||||
glTexImage2D(
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data
|
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
|
||||||
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);
|
void shutdown(GLFWwindow* window)
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
{
|
||||||
//skybox end
|
shaderLoader.DeleteProgram(program);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
//obsluga wejscia
|
||||||
void shutdown(GLFWwindow* window)
|
void processInput(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
shaderLoader.DeleteProgram(program);
|
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;
|
||||||
//obsluga wejscia
|
float moveSpeed = 0.0025f;
|
||||||
void processInput(GLFWwindow* window)
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
||||||
{
|
glfwSetWindowShouldClose(window, true);
|
||||||
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);
|
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||||
float angleSpeed = 0.005f;
|
spaceshipPos += spaceshipDir * moveSpeed;
|
||||||
float moveSpeed = 0.0025f;
|
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
spaceshipPos -= spaceshipDir * moveSpeed;
|
||||||
glfwSetWindowShouldClose(window, true);
|
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
|
||||||
}
|
spaceshipPos += spaceshipSide * moveSpeed;
|
||||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
|
||||||
spaceshipPos += spaceshipDir * moveSpeed;
|
spaceshipPos -= spaceshipSide * moveSpeed;
|
||||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
||||||
spaceshipPos -= spaceshipDir * moveSpeed;
|
spaceshipPos += spaceshipUp * moveSpeed;
|
||||||
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)
|
||||||
spaceshipPos += spaceshipSide * moveSpeed;
|
spaceshipPos -= spaceshipUp * moveSpeed;
|
||||||
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
|
||||||
spaceshipPos -= spaceshipSide * moveSpeed;
|
spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0));
|
||||||
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
|
||||||
spaceshipPos += spaceshipUp * moveSpeed;
|
spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0));
|
||||||
if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)
|
|
||||||
spaceshipPos -= spaceshipUp * moveSpeed;
|
cameraPos = spaceshipPos - 1.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.5f;
|
||||||
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
|
cameraDir = spaceshipDir;
|
||||||
spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0));
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
|
//cameraDir = glm::normalize(-cameraPos);
|
||||||
spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0));
|
|
||||||
|
}
|
||||||
cameraPos = spaceshipPos - 1.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.5f;
|
|
||||||
cameraDir = spaceshipDir;
|
// funkcja jest glowna petla
|
||||||
|
void renderLoop(GLFWwindow* window) {
|
||||||
//cameraDir = glm::normalize(-cameraPos);
|
while (!glfwWindowShouldClose(window))
|
||||||
|
{
|
||||||
}
|
processInput(window);
|
||||||
|
|
||||||
// funkcja jest glowna petla
|
renderScene(window);
|
||||||
void renderLoop(GLFWwindow* window) {
|
glfwPollEvents();
|
||||||
while (!glfwWindowShouldClose(window))
|
}
|
||||||
{
|
}
|
||||||
processInput(window);
|
|
||||||
|
|
||||||
renderScene(window);
|
|
||||||
glfwPollEvents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user