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.
@ -6,13 +6,17 @@
|
||||
"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_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_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}",
|
||||
@ -26,7 +30,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 3,
|
||||
"SelectedChildIndex": 4,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
@ -34,26 +38,39 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"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": "AQIAAAAAAAAAAAAAAAAAABEAAAAaAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAbAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||
"WhenOpened": "2024-02-26T19:01:49.259Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"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": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAA9AAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||
"WhenOpened": "2024-02-26T19:01:39.656Z",
|
||||
"EditorCaption": ""
|
||||
@ -66,14 +83,14 @@
|
||||
"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",
|
||||
"ViewState": "AQIAAIEAAAAAAAAAAAAowJkAAAAYAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-02-25T17:55:58.673Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 4,
|
||||
"Title": "main.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\maksg\\Documents\\Grafika_2024\\projekt_grk\\src\\main.cpp",
|
||||
"RelativeDocumentMoniker": "projekt_grk\\src\\main.cpp",
|
||||
@ -81,7 +98,8 @@
|
||||
"RelativeToolTip": "projekt_grk\\src\\main.cpp",
|
||||
"ViewState": "AQIAABcAAAAAAAAAAAAtwCYAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-02-26T20:07:44.538Z"
|
||||
"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.
@ -8,10 +8,13 @@ C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(1
|
||||
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
|
||||
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(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”)
|
||||
|
||||
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”
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,20 +1,12 @@
|
||||
#version 430 core
|
||||
|
||||
in vec3 FragPos;
|
||||
in vec3 Normal;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec3 color;
|
||||
|
||||
out vec4 FinalColor;
|
||||
|
||||
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);
|
||||
FinalColor = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,12 @@
|
||||
|
||||
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;
|
||||
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
||||
|
@ -133,28 +133,24 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
|
||||
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;
|
||||
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))
|
||||
* glm::scale(glm::vec3(0.5f));
|
||||
modelMatrix = modelMatrixForMultiplications;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -276,12 +272,10 @@ void renderScene(GLFWwindow* window)
|
||||
|
||||
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();
|
||||
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user