monety #5
Binary file not shown.
BIN
.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch
Normal file
BIN
.vs/grk-cw/v17/ipch/AutoPCH/2bd9856fe7123c35/MAIN.ipch
Normal file
Binary file not shown.
Binary file not shown.
BIN
.vs/grk-cw/v17/ipch/AutoPCH/b9badb3a383f4bb/SHADER_LOADER.ipch
Normal file
BIN
.vs/grk-cw/v17/ipch/AutoPCH/b9badb3a383f4bb/SHADER_LOADER.ipch
Normal file
Binary file not shown.
BIN
.vs/grk-cw/v17/ipch/AutoPCH/d52e93c2264273a6/EX_7_1.ipch
Normal file
BIN
.vs/grk-cw/v17/ipch/AutoPCH/d52e93c2264273a6/EX_7_1.ipch
Normal file
Binary file not shown.
Binary file not shown.
@ -1,5 +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
|
||||||
|
(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(109,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(155,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(255,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(273,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||||
|
(kompilowanie pliku źródłowego „src/main.cpp”)
|
||||||
|
|
||||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
|
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.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”)
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1):
|
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1):
|
||||||
@ -16,4 +33,4 @@ D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(350,29): warning C
|
|||||||
|
|
||||||
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
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
|
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
|
||||||
grk-cw7.vcxproj -> D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe
|
grk-cw7.vcxproj -> C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<ProjectOutputs>
|
<ProjectOutputs>
|
||||||
<ProjectOutput>
|
<ProjectOutput>
|
||||||
<FullPath>D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe</FullPath>
|
<FullPath>C:\Users\maksg\Documents\Grafika_2024\Debug\projekt_grk.exe</FullPath>
|
||||||
</ProjectOutput>
|
</ProjectOutput>
|
||||||
</ProjectOutputs>
|
</ProjectOutputs>
|
||||||
<ContentFiles />
|
<ContentFiles />
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,10 +1,10 @@
|
|||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\Box.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\Camera.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\main.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\Render_Utils.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\Shader_Loader.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_DXT.c;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\SOIL.c;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\Texture.cpp;D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\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
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -41,6 +41,8 @@
|
|||||||
<None Include="shaders\shader_5_1.vert" />
|
<None Include="shaders\shader_5_1.vert" />
|
||||||
<None Include="shaders\shader_5_1_tex_copy.frag" />
|
<None Include="shaders\shader_5_1_tex_copy.frag" />
|
||||||
<None Include="shaders\shader_5_1_tex_copy.vert" />
|
<None Include="shaders\shader_5_1_tex_copy.vert" />
|
||||||
|
<None Include="shaders\shader_coin.frag" />
|
||||||
|
<None Include="shaders\shader_coin.vert" />
|
||||||
<None Include="shaders\shader_bloom.frag" />
|
<None Include="shaders\shader_bloom.frag" />
|
||||||
<None Include="shaders\shader_bloom.vert" />
|
<None Include="shaders\shader_bloom.vert" />
|
||||||
<None Include="shaders\shader_blur.frag" />
|
<None Include="shaders\shader_blur.frag" />
|
||||||
@ -56,7 +58,7 @@
|
|||||||
<ProjectGuid>{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}</ProjectGuid>
|
<ProjectGuid>{F2FC2E8F-CBA6-49D7-8B73-4BFBCB64D310}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>grk-cw7</RootNamespace>
|
<RootNamespace>grk-cw7</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>projekt_grk</ProjectName>
|
<ProjectName>projekt_grk</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
@ -115,6 +115,12 @@
|
|||||||
<None Include="shaders\shader_skybox.vert">
|
<None Include="shaders\shader_skybox.vert">
|
||||||
<Filter>Shader Files</Filter>
|
<Filter>Shader Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="shaders\shader_coin.frag">
|
||||||
|
<Filter>Shader Files</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="shaders\shader_coin.vert">
|
||||||
|
<Filter>Shader Files</Filter>
|
||||||
|
</None>
|
||||||
<None Include="shaders\shader_pbr.frag">
|
<None Include="shaders\shader_pbr.frag">
|
||||||
<Filter>Shader Files</Filter>
|
<Filter>Shader Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
@ -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>
|
3
projekt_grk/models/.vs/ProjectSettings.json
Normal file
3
projekt_grk/models/.vs/ProjectSettings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"CurrentProjectSetting": null
|
||||||
|
}
|
6
projekt_grk/models/.vs/VSWorkspaceState.json
Normal file
6
projekt_grk/models/.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
Binary file not shown.
BIN
projekt_grk/models/.vs/models/v17/.wsuo
Normal file
BIN
projekt_grk/models/.vs/models/v17/.wsuo
Normal file
Binary file not shown.
23
projekt_grk/models/.vs/models/v17/DocumentLayout.json
Normal file
23
projekt_grk/models/.vs/models/v17/DocumentLayout.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\models\\",
|
||||||
|
"Documents": [],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": [
|
||||||
|
{
|
||||||
|
"DockedWidth": 200,
|
||||||
|
"SelectedChildIndex": -1,
|
||||||
|
"Children": [
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
projekt_grk/models/.vs/slnx.sqlite
Normal file
BIN
projekt_grk/models/.vs/slnx.sqlite
Normal file
Binary file not shown.
2
projekt_grk/models/cylinder.mtl
Normal file
2
projekt_grk/models/cylinder.mtl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Blender 4.0.2 MTL File: 'None'
|
||||||
|
# www.blender.org
|
1611
projekt_grk/models/cylinder.obj
Normal file
1611
projekt_grk/models/cylinder.obj
Normal file
File diff suppressed because it is too large
Load Diff
2
projekt_grk/models/sphere.mtl
Normal file
2
projekt_grk/models/sphere.mtl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Blender 4.0.2 MTL File: 'None'
|
||||||
|
# www.blender.org
|
18
projekt_grk/shaders/shader_coin.frag
Normal file
18
projekt_grk/shaders/shader_coin.frag
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#version 430 core
|
||||||
|
|
||||||
|
float AMBIENT = 0.1;
|
||||||
|
|
||||||
|
uniform vec3 color;
|
||||||
|
uniform vec3 lightPos;
|
||||||
|
|
||||||
|
in vec3 vecNormal;
|
||||||
|
in vec3 worldPos;
|
||||||
|
|
||||||
|
out vec4 finalColor;
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec3 lightDir = normalize(lightPos-worldPos);
|
||||||
|
vec3 normal = normalize(vecNormal);
|
||||||
|
float diffuse=max(0,dot(normal,lightDir));
|
||||||
|
finalColor = vec4(color*min(1,AMBIENT+diffuse), 1.0);
|
||||||
|
}
|
17
projekt_grk/shaders/shader_coin.vert
Normal file
17
projekt_grk/shaders/shader_coin.vert
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#version 430 core
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 vertexPosition;
|
||||||
|
layout(location = 1) in vec3 vertexNormal;
|
||||||
|
|
||||||
|
uniform mat4 transformation;
|
||||||
|
uniform mat4 modelMatrix;
|
||||||
|
|
||||||
|
out vec3 vecNormal;
|
||||||
|
out vec3 worldPos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
|
||||||
|
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
|
||||||
|
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||||
|
}
|
@ -16,7 +16,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "SOIL/SOIL.h"
|
#include "SOIL/SOIL.h"
|
||||||
|
|
||||||
|
|
||||||
namespace texture {
|
namespace texture {
|
||||||
GLuint mercury;
|
GLuint mercury;
|
||||||
GLuint venus;
|
GLuint venus;
|
||||||
@ -54,6 +53,7 @@ GLuint program;
|
|||||||
GLuint programSun;
|
GLuint programSun;
|
||||||
GLuint programTex;
|
GLuint programTex;
|
||||||
GLuint programSkyBox;
|
GLuint programSkyBox;
|
||||||
|
GLuint programCoin;
|
||||||
GLuint programSpaceShip;
|
GLuint programSpaceShip;
|
||||||
GLuint programBlur;
|
GLuint programBlur;
|
||||||
GLuint programBloom;
|
GLuint programBloom;
|
||||||
@ -62,6 +62,7 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
||||||
@ -74,6 +75,23 @@ GLuint VAO,VBO;
|
|||||||
float aspectRatio = 1.f;
|
float aspectRatio = 1.f;
|
||||||
unsigned int textureID;
|
unsigned int textureID;
|
||||||
|
|
||||||
|
const int maxSize = 30;
|
||||||
|
int numberOfCollectedCoins = 0;
|
||||||
|
|
||||||
|
float xCordinatesOfCoin[maxSize] = {
|
||||||
|
5.3f, 10.0f, -4.7f, 9.2f, 3.5f, -7.5f, 1.8f, 2.5f, 11.8f, -10.2f,
|
||||||
|
-4.5f, 6.7f, -6.7f, 5.5f, -0.1f, -9.2f, -6.8f, -9.7f, -12.9f, 5.0f,
|
||||||
|
12.2f, -7.4f, 2.4f, 12.3f, -4.1f, -5.7f, -5.5f, -3.6f, -2.5f, -7.6f
|
||||||
|
};
|
||||||
|
float zCordinatesOfCoin[maxSize] = {
|
||||||
|
2.6f, 1.5f, 4.8f, 2.2f, -11.8f, 3.3f, 9.1f, -6.0f, -12.0f, 11.1f,
|
||||||
|
11.9f, 2.5f, 5.2f, 1.1f, -2.0f, -8.2f, -2.9f, -9.4f, 0.5f, -2.3f,
|
||||||
|
-1.0f, 1.0f, -4.2f, 7.3f, 10.0f, -12.6f, -5.9f, -2.7f, 12.8f, 2.3f
|
||||||
|
};
|
||||||
|
|
||||||
|
float xCordinatesOfCollectedCoin[maxSize] = {};
|
||||||
|
float zCordinatesOfCollectedCoin[maxSize] = {};
|
||||||
|
|
||||||
unsigned int hdrFBO;
|
unsigned int hdrFBO;
|
||||||
unsigned int colorBuffers[2];
|
unsigned int colorBuffers[2];
|
||||||
unsigned int pingpongFBO[2];
|
unsigned int pingpongFBO[2];
|
||||||
@ -144,7 +162,7 @@ void renderQuad()
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, quadVBO);
|
glBindBuffer(GL_ARRAY_BUFFER, quadVBO);
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);
|
||||||
// locations 7 i 8 aby nie by³o kolizii z shaderem statku
|
// locations 7 i 8 aby nie by<EFBFBD>o kolizii z shaderem statku
|
||||||
glEnableVertexAttribArray(7);
|
glEnableVertexAttribArray(7);
|
||||||
glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
|
glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
|
||||||
glEnableVertexAttribArray(8);
|
glEnableVertexAttribArray(8);
|
||||||
@ -235,6 +253,69 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
|
|||||||
Core::DrawContext(context);
|
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.3f));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkCoinCollection(glm::vec3 spaceshipPos, glm::vec3 coinPos) {
|
||||||
|
float collectionDistance = 0.8f;
|
||||||
|
|
||||||
|
float distance = glm::length(spaceshipPos - coinPos);
|
||||||
|
|
||||||
|
if (distance < collectionDistance) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderCoins() {
|
||||||
|
|
||||||
|
for (int i = 0;i < maxSize;i++) {
|
||||||
|
bool found = false;
|
||||||
|
if (checkCoinCollection(spaceshipPos, glm::vec3(xCordinatesOfCoin[i], 0.0f, zCordinatesOfCoin[i]))) {
|
||||||
|
for (int y = 0; y < numberOfCollectedCoins; y++) {
|
||||||
|
if (xCordinatesOfCollectedCoin[y] == xCordinatesOfCoin[i] &&
|
||||||
|
zCordinatesOfCollectedCoin[y] == zCordinatesOfCoin[i]) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
xCordinatesOfCollectedCoin[numberOfCollectedCoins] = xCordinatesOfCoin[i];
|
||||||
|
zCordinatesOfCollectedCoin[numberOfCollectedCoins] = zCordinatesOfCoin[i];
|
||||||
|
numberOfCollectedCoins++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for (int y = 0; y < numberOfCollectedCoins; y++) {
|
||||||
|
if (xCordinatesOfCollectedCoin[y] == xCordinatesOfCoin[i] &&
|
||||||
|
zCordinatesOfCollectedCoin[y] == zCordinatesOfCoin[i]) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
drawCylinder(cylinderContext, glm::translate(glm::vec3(xCordinatesOfCoin[i], 0.0f, zCordinatesOfCoin[i])), glm::vec3(1.0f, 1.0f, 0.0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID)
|
void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID)
|
||||||
{
|
{
|
||||||
@ -320,9 +401,9 @@ void drawSpaceShip(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint t
|
|||||||
}
|
}
|
||||||
|
|
||||||
void renderPlanet(float time, float orbitRadius, float orbitRotationSpeed, float selfRotationSpeed, float scale, GLuint planetTexture, GLuint normalTexture) {
|
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::mat4 planetTransform = glm::rotate(glm::mat4(1.0f), time * orbitRotationSpeed, glm::vec3(0, 1, 0)) // orbitowanie dooko<EFBFBD>a s<>o<EFBFBD>ca
|
||||||
* glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odleg³oœæ
|
* glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odleg<EFBFBD>o<EFBFBD><EFBFBD>
|
||||||
* glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrót planety wokó³ w³asnej osi
|
* glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obr<EFBFBD>t planety wok<6F> w<>asnej osi
|
||||||
* glm::scale(glm::vec3(scale)); //skalowanie planety
|
* glm::scale(glm::vec3(scale)); //skalowanie planety
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture);
|
drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture);
|
||||||
@ -376,7 +457,7 @@ void renderPlanets() {
|
|||||||
renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal);
|
renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal);
|
||||||
renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal);
|
renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal);
|
||||||
|
|
||||||
//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æ.
|
//earths moon, musi by<EFBFBD> inaczej renderowany bo on nie orbituje wok<6F> s<>o<EFBFBD>ca tylko ziemi. P<>niej to mo<6D>na jako<6B> lepiej rozwi<77>za<7A>.
|
||||||
drawObjectTexture(sphereContext,
|
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)),
|
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::moon,
|
||||||
@ -402,11 +483,14 @@ void renderScene(GLFWwindow* window)
|
|||||||
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
||||||
|
|
||||||
//sun
|
//sun
|
||||||
|
|
||||||
drawSun(sphereContext, glm::mat4(), texture::sun);
|
drawSun(sphereContext, glm::mat4(), texture::sun);
|
||||||
|
|
||||||
//rendering all the planets
|
|
||||||
|
|
||||||
renderPlanets();
|
renderPlanets();
|
||||||
|
|
||||||
|
renderCoins();
|
||||||
// obliczanie orientacji statku
|
// obliczanie orientacji statku
|
||||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||||
@ -464,6 +548,7 @@ void init(GLFWwindow* window)
|
|||||||
programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex_copy.vert", "shaders/shader_5_1_tex_copy.frag");
|
programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex_copy.vert", "shaders/shader_5_1_tex_copy.frag");
|
||||||
programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag");
|
programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag");
|
||||||
programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
programSkyBox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
||||||
|
programCoin = shaderLoader.CreateProgram("shaders/shader_coin.vert", "shaders/shader_coin.frag");
|
||||||
programSpaceShip = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag");
|
programSpaceShip = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag");
|
||||||
programBlur = shaderLoader.CreateProgram("shaders/shader_blur.vert", "shaders/shader_blur.frag");
|
programBlur = shaderLoader.CreateProgram("shaders/shader_blur.vert", "shaders/shader_blur.frag");
|
||||||
programBloom = shaderLoader.CreateProgram("shaders/shader_bloom.vert", "shaders/shader_bloom.frag");
|
programBloom = shaderLoader.CreateProgram("shaders/shader_bloom.vert", "shaders/shader_bloom.frag");
|
||||||
@ -472,6 +557,7 @@ void init(GLFWwindow* window)
|
|||||||
loadModelToContext("./models/sphere.obj", sphereContext);
|
loadModelToContext("./models/sphere.obj", sphereContext);
|
||||||
loadModelToContext("./models/new_spaceship.obj", shipContext);
|
loadModelToContext("./models/new_spaceship.obj", shipContext);
|
||||||
loadModelToContext("./models/cube.obj", cubeContext);
|
loadModelToContext("./models/cube.obj", cubeContext);
|
||||||
|
loadModelToContext("./models/cylinder.obj", cylinderContext);
|
||||||
|
|
||||||
texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg");
|
texture::mercury = Core::LoadTexture("textures/mercury/mercury.jpg");
|
||||||
texture::venus = Core::LoadTexture("textures/venus/venus.jpg");
|
texture::venus = Core::LoadTexture("textures/venus/venus.jpg");
|
||||||
|
Loading…
Reference in New Issue
Block a user