diff --git a/cw 2/Debug/Box.obj b/cw 2/Debug/Box.obj deleted file mode 100644 index bcf32f2..0000000 Binary files a/cw 2/Debug/Box.obj and /dev/null differ diff --git a/cw 2/Debug/Camera.obj b/cw 2/Debug/Camera.obj deleted file mode 100644 index 49e0ed1..0000000 Binary files a/cw 2/Debug/Camera.obj and /dev/null differ diff --git a/cw 2/Debug/Render_Utils.obj b/cw 2/Debug/Render_Utils.obj deleted file mode 100644 index cae1ef3..0000000 Binary files a/cw 2/Debug/Render_Utils.obj and /dev/null differ diff --git a/cw 2/Debug/Shader_Loader.obj b/cw 2/Debug/Shader_Loader.obj deleted file mode 100644 index 6c4e877..0000000 Binary files a/cw 2/Debug/Shader_Loader.obj and /dev/null differ diff --git a/cw 2/Debug/grk-cw2.exe.recipe b/cw 2/Debug/grk-cw2.exe.recipe deleted file mode 100644 index 9746211..0000000 --- a/cw 2/Debug/grk-cw2.exe.recipe +++ /dev/null @@ -1,11 +0,0 @@ - - - - - C:\Users\Adam\Desktop\graf\grafika\Debug\grk-cw2.exe - - - - - - \ No newline at end of file diff --git a/cw 2/Debug/grk-cw2.vcxproj.FileListAbsolute.txt b/cw 2/Debug/grk-cw2.vcxproj.FileListAbsolute.txt deleted file mode 100644 index e69de29..0000000 diff --git a/cw 2/Debug/main_2_1a.obj b/cw 2/Debug/main_2_1a.obj deleted file mode 100644 index 47cdf25..0000000 Binary files a/cw 2/Debug/main_2_1a.obj and /dev/null differ diff --git a/cw 2/Debug/vc142.idb b/cw 2/Debug/vc142.idb deleted file mode 100644 index 943e65f..0000000 Binary files a/cw 2/Debug/vc142.idb and /dev/null differ diff --git a/cw 2/assimp-vc141-mt.dll b/cw 2/assimp-vc141-mt.dll deleted file mode 100644 index 86f52a0..0000000 Binary files a/cw 2/assimp-vc141-mt.dll and /dev/null differ diff --git a/cw 2/assimp-vc141-mtd.dll b/cw 2/assimp-vc141-mtd.dll deleted file mode 100644 index 2e5fd66..0000000 Binary files a/cw 2/assimp-vc141-mtd.dll and /dev/null differ diff --git a/cw 2/freeglut.dll b/cw 2/freeglut.dll deleted file mode 100644 index c768c15..0000000 Binary files a/cw 2/freeglut.dll and /dev/null differ diff --git a/cw 2/glew32.dll b/cw 2/glew32.dll deleted file mode 100644 index 8a49a3b..0000000 Binary files a/cw 2/glew32.dll and /dev/null differ diff --git a/cw 2/grk-cw2.vcxproj b/cw 2/grk-cw2.vcxproj deleted file mode 100644 index a1964ab..0000000 --- a/cw 2/grk-cw2.vcxproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - - - - - - - - - - - - - - - - - - - {B4031E08-6274-4FFD-B41C-F8EA29E977FB} - Win32Proj - grk-cw9 - 10.0 - grk-cw2 - - - - Application - true - Unicode - v142 - - - Application - false - true - Unicode - v142 - - - - - - - - - - - - - false - $(SolutionDir)dependencies\freeglut\lib;$(SolutionDir)dependencies\glew-2.0.0\lib\Release\Win32;$(SolutionDir)dependencies\assimp;$(LibraryPath) - $(SolutionDir)dependencies\freeglut\include\GL;$(SolutionDir)dependencies\glew-2.0.0\include\GL;$(SolutionDir)dependencies\glm;$(SolutionDir)dependencies\assimp\include;$(IncludePath) - $(ExecutablePath) - - - false - $(SolutionDir)dependencies\freeglut\include\GL;$(SolutionDir)dependencies\glew-2.0.0\include\GL;$(SolutionDir)dependencies\glm;$(SolutionDir)dependencies\assimp\include;$(IncludePath) - $(SolutionDir)dependencies\freeglut\lib;$(SolutionDir)dependencies\glew-2.0.0\lib\Release\Win32;$(SolutionDir)dependencies\assimp\Release;$(LibraryPath) - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDebug - $(SolutionDir)dependencies\physx-4.1\include;$(SolutionDir)dependencies\physx-4.1\source\common\include;$(SolutionDir)dependencies\physx-4.1\source\common\src;$(SolutionDir)dependencies\physx-4.1\source\physx\src;$(SolutionDir)dependencies\physx-4.1\source\physx\src\device;$(SolutionDir)dependencies\physx-4.1\source\physx\src\buffering;$(SolutionDir)dependencies\physx-4.1\source\physxgpu\include;$(SolutionDir)dependencies\physx-4.1\source\geomutils\include;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\contact;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\common;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\convex;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\distance;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\sweep;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\gjk;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\intersection;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\mesh;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\hf;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\pcm;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\ccd;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\api\include;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\software\include;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\common\include\pipeline;$(SolutionDir)dependencies\physx-4.1\source\lowlevelaabb\include;$(SolutionDir)dependencies\physx-4.1\source\lowleveldynamics\include;$(SolutionDir)dependencies\physx-4.1\source\simulationcontroller\include;$(SolutionDir)dependencies\physx-4.1\source\simulationcontroller\src;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src\mesh;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src\convex;$(SolutionDir)dependencies\physx-4.1\source\scenequery\include;$(SolutionDir)dependencies\physx-4.1\source\physxmetadata\core\include;$(SolutionDir)dependencies\physx-4.1\source\immediatemode\include;$(SolutionDir)dependencies\physx-4.1\source\pvd\include;$(SolutionDir)dependencies\physx-4.1\source\foundation\include;%(AdditionalIncludeDirectories) - - - Console - true - $(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXExtensions_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysX_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXPvdSDK_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXVehicle_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXCharacterKinematic_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXCooking_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXCommon_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\SnippetUtils_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\SnippetRender_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\debug\PhysXFoundation_32.lib;opengl32.lib;freeglut.lib;glew32.lib;zlibd.lib;assimp-vc141-mtd.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - $(SolutionDir)dependencies\physx-4.1\include;$(SolutionDir)dependencies\physx-4.1\source\common\include;$(SolutionDir)dependencies\physx-4.1\source\common\src;$(SolutionDir)dependencies\physx-4.1\source\physx\src;$(SolutionDir)dependencies\physx-4.1\source\physx\src\device;$(SolutionDir)dependencies\physx-4.1\source\physx\src\buffering;$(SolutionDir)dependencies\physx-4.1\source\physxgpu\include;$(SolutionDir)dependencies\physx-4.1\source\geomutils\include;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\contact;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\common;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\convex;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\distance;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\sweep;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\gjk;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\intersection;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\mesh;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\hf;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\pcm;$(SolutionDir)dependencies\physx-4.1\source\geomutils\src\ccd;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\api\include;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\software\include;$(SolutionDir)dependencies\physx-4.1\source\lowlevel\common\include\pipeline;$(SolutionDir)dependencies\physx-4.1\source\lowlevelaabb\include;$(SolutionDir)dependencies\physx-4.1\source\lowleveldynamics\include;$(SolutionDir)dependencies\physx-4.1\source\simulationcontroller\include;$(SolutionDir)dependencies\physx-4.1\source\simulationcontroller\src;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src\mesh;$(SolutionDir)dependencies\physx-4.1\source\physxcooking\src\convex;$(SolutionDir)dependencies\physx-4.1\source\scenequery\include;$(SolutionDir)dependencies\physx-4.1\source\physxmetadata\core\include;$(SolutionDir)dependencies\physx-4.1\source\immediatemode\include;$(SolutionDir)dependencies\physx-4.1\source\pvd\include;$(SolutionDir)dependencies\physx-4.1\source\foundation\include;%(AdditionalIncludeDirectories) - - - Console - true - true - true - $(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXExtensions_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysX_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXPvdSDK_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXVehicle_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXCharacterKinematic_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXCooking_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXCommon_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\SnippetUtils_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\SnippetRender_static_32.lib;$(SolutionDir)dependencies\physx-4.1\lib\win.x86_32.vc141.mt\release\PhysXFoundation_32.lib;opengl32.lib;freeglut.lib;glew32.lib;zlib.lib;assimp-vc141-mt.lib;%(AdditionalDependencies) - - - - - - \ No newline at end of file diff --git a/cw 2/grk-cw2.vcxproj.filters b/cw 2/grk-cw2.vcxproj.filters deleted file mode 100644 index 71b74d9..0000000 --- a/cw 2/grk-cw2.vcxproj.filters +++ /dev/null @@ -1,62 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {0a247bb8-2e8e-4a90-b0ef-17415b0941ba} - - - - - Shader Files - - - Shader Files - - - Shader Files - - - Shader Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/cw 2/render.py b/cw 2/render.py deleted file mode 100644 index 8cc2be2..0000000 --- a/cw 2/render.py +++ /dev/null @@ -1,7 +0,0 @@ - -import os -rootdir = './' -for filename in os.listdir(rootdir): - if filename.endswith(".md"): - name = filename[:-3] - os.system(f'pandoc -s -o {name}.html {name}.md --css style.css') \ No newline at end of file diff --git a/cw 2/shaders/shader_2_1.frag b/cw 2/shaders/shader_2_1.frag deleted file mode 100644 index f057696..0000000 --- a/cw 2/shaders/shader_2_1.frag +++ /dev/null @@ -1,8 +0,0 @@ -#version 430 core - -in vec4 color; - -void main() -{ - gl_FragColor = color; -} diff --git a/cw 2/shaders/shader_2_1.vert b/cw 2/shaders/shader_2_1.vert deleted file mode 100644 index 380464c..0000000 --- a/cw 2/shaders/shader_2_1.vert +++ /dev/null @@ -1,14 +0,0 @@ -#version 430 core - -layout(location = 0) in vec4 vertexPosition; -layout(location = 1) in vec4 vertexColor; - -uniform mat4 transformation; - -out vec4 color; - -void main() -{ - color = vertexColor; - gl_Position = transformation * vertexPosition; -} diff --git a/cw 2/shaders/shader_2_1b.frag b/cw 2/shaders/shader_2_1b.frag deleted file mode 100644 index 29feeba..0000000 --- a/cw 2/shaders/shader_2_1b.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 430 core -out vec4 fragColor; - -in float hue; - -vec3 hsv2rgb(vec3 c) -{ - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main() -{ - fragColor = vec4(hsv2rgb(vec3(hue,1,1)), 1.0); -} diff --git a/cw 2/shaders/shader_2_1b.vert b/cw 2/shaders/shader_2_1b.vert deleted file mode 100644 index 489707e..0000000 --- a/cw 2/shaders/shader_2_1b.vert +++ /dev/null @@ -1,11 +0,0 @@ -#version 430 core - -layout(location = 0) in vec4 vertexPosition; -layout(location = 1) in float vertexHue; - -out float hue; -void main() -{ - hue = vertexHue; - gl_Position = vertexPosition; -} diff --git a/cw 2/shaders/shader_2_2.frag b/cw 2/shaders/shader_2_2.frag deleted file mode 100644 index a271953..0000000 --- a/cw 2/shaders/shader_2_2.frag +++ /dev/null @@ -1,6 +0,0 @@ -#version 430 core - -void main() -{ - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); -} diff --git a/cw 2/shaders/shader_2_2.vert b/cw 2/shaders/shader_2_2.vert deleted file mode 100644 index 82f2c15..0000000 --- a/cw 2/shaders/shader_2_2.vert +++ /dev/null @@ -1,12 +0,0 @@ -#version 430 core - -layout(location = 0) in vec3 vertexPosition; -layout(location = 1) in vec2 vertexTexCoord; -layout(location = 2) in vec3 vertexNormal; - -uniform mat4 transformation; - -void main() -{ - gl_Position = transformation * vec4(vertexPosition, 1.0); -} diff --git a/cw 2/shaders/shader_2_3.frag b/cw 2/shaders/shader_2_3.frag deleted file mode 100644 index a271953..0000000 --- a/cw 2/shaders/shader_2_3.frag +++ /dev/null @@ -1,6 +0,0 @@ -#version 430 core - -void main() -{ - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); -} diff --git a/cw 2/shaders/shader_2_3.vert b/cw 2/shaders/shader_2_3.vert deleted file mode 100644 index e234390..0000000 --- a/cw 2/shaders/shader_2_3.vert +++ /dev/null @@ -1,13 +0,0 @@ -#version 430 core - -layout(location = 0) in vec3 vertexPosition; -layout(location = 1) in vec2 vertexTexCoord; -layout(location = 2) in vec3 vertexNormal; - -uniform mat4 transformation; -uniform mat4 model; - -void main() -{ - gl_Position = transformation * model * vec4(vertexPosition, 1.0); -} diff --git a/cw 2/src/Box.cpp b/cw 2/src/Box.cpp deleted file mode 100644 index 76ef601..0000000 --- a/cw 2/src/Box.cpp +++ /dev/null @@ -1,104 +0,0 @@ - - -// dane 36 wierzcholkow i kolorow opisujace model pudelka -const float boxPositions[] = { - 0.25f, 0.25f, 0.75f, 1.0f, - 0.25f, -0.25f, 0.75f, 1.0f, - -0.25f, 0.25f, 0.75f, 1.0f, - - 0.25f, -0.25f, 0.75f, 1.0f, - -0.25f, -0.25f, 0.75f, 1.0f, - -0.25f, 0.25f, 0.75f, 1.0f, - - 0.25f, 0.25f, -0.75f, 1.0f, - -0.25f, 0.25f, -0.75f, 1.0f, - 0.25f, -0.25f, -0.75f, 1.0f, - - 0.25f, -0.25f, -0.75f, 1.0f, - -0.25f, 0.25f, -0.75f, 1.0f, - -0.25f, -0.25f, -0.75f, 1.0f, - - -0.25f, 0.25f, 0.75f, 1.0f, - -0.25f, -0.25f, 0.75f, 1.0f, - -0.25f, -0.25f, -0.75f, 1.0f, - - -0.25f, 0.25f, 0.75f, 1.0f, - -0.25f, -0.25f, -0.75f, 1.0f, - -0.25f, 0.25f, -0.75f, 1.0f, - - 0.25f, 0.25f, 0.75f, 1.0f, - 0.25f, -0.25f, -0.75f, 1.0f, - 0.25f, -0.25f, 0.75f, 1.0f, - - 0.25f, 0.25f, 0.75f, 1.0f, - 0.25f, 0.25f, -0.75f, 1.0f, - 0.25f, -0.25f, -0.75f, 1.0f, - - 0.25f, 0.25f, -0.75f, 1.0f, - 0.25f, 0.25f, 0.75f, 1.0f, - -0.25f, 0.25f, 0.75f, 1.0f, - - 0.25f, 0.25f, -0.75f, 1.0f, - -0.25f, 0.25f, 0.75f, 1.0f, - -0.25f, 0.25f, -0.75f, 1.0f, - - 0.25f, -0.25f, -0.75f, 1.0f, - -0.25f, -0.25f, 0.75f, 1.0f, - 0.25f, -0.25f, 0.75f, 1.0f, - - 0.25f, -0.25f, -0.75f, 1.0f, - -0.25f, -0.25f, -0.75f, 1.0f, - -0.25f, -0.25f, 0.75f, 1.0f, -}; - - -const float boxColors[] = { - 0.0f, 0.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 1.0f, 1.0f, - - 0.0f, 0.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 1.0f, 1.0f, - - 0.8f, 0.8f, 0.8f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - - 0.8f, 0.8f, 0.8f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - 0.8f, 0.8f, 0.8f, 1.0f, - - 0.0f, 1.0f, 0.0f, 1.0f, - 0.0f, 1.0f, 0.0f, 1.0f, - 0.0f, 1.0f, 0.0f, 1.0f, - - 0.0f, 1.0f, 0.0f, 1.0f, - 0.0f, 1.0f, 0.0f, 1.0f, - 0.0f, 1.0f, 0.0f, 1.0f, - - 0.5f, 0.5f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.0f, 1.0f, - - 0.5f, 0.5f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.0f, 1.0f, - 0.5f, 0.5f, 0.0f, 1.0f, - - 1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 1.0f, - - 1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 1.0f, - - 0.0f, 1.0f, 1.0f, 1.0f, - 0.0f, 1.0f, 1.0f, 1.0f, - 0.0f, 1.0f, 1.0f, 1.0f, - - 0.0f, 1.0f, 1.0f, 1.0f, - 0.0f, 1.0f, 1.0f, 1.0f, - 0.0f, 1.0f, 1.0f, 1.0f, - -}; \ No newline at end of file diff --git a/cw 2/src/Camera.cpp b/cw 2/src/Camera.cpp deleted file mode 100644 index d0d5939..0000000 --- a/cw 2/src/Camera.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Camera.h" - -glm::mat4 Core::createPerspectiveMatrix(float zNear, float zFar) -{ - const float frustumScale = 1.0f; - glm::mat4 perspective; - perspective[0][0] = frustumScale; - perspective[1][1] = frustumScale; - perspective[2][2] = (zFar + zNear) / (zNear - zFar); - perspective[3][2] = (2 * zFar * zNear) / (zNear - zFar); - perspective[2][3] = -1; - perspective[3][3] = 0; - - return perspective; -} - -glm::mat4 Core::createViewMatrix( glm::vec3 position, glm::vec3 forward, glm::vec3 up ) -{ - glm::vec3 side = glm::cross(forward, up); - - // Trzeba pamietac o minusie przy ustawianiu osi Z kamery. - // Wynika to z tego, ze standardowa macierz perspektywiczna zaklada, ze "z przodu" jest ujemna (a nie dodatnia) czesc osi Z. - glm::mat4 cameraRotation; - cameraRotation[0][0] = side.x; cameraRotation[1][0] = side.y; cameraRotation[2][0] = side.z; - cameraRotation[0][1] = up.x; cameraRotation[1][1] = up.y; cameraRotation[2][1] = up.z; - cameraRotation[0][2] = -forward.x; cameraRotation[1][2] = -forward.y; cameraRotation[2][2] = -forward.z; - - glm::mat4 cameraTranslation; - cameraTranslation[3] = glm::vec4(-position, 1.0f); - - return cameraRotation * cameraTranslation; -} diff --git a/cw 2/src/Camera.h b/cw 2/src/Camera.h deleted file mode 100644 index 688040b..0000000 --- a/cw 2/src/Camera.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "glm.hpp" - -namespace Core -{ - glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 100.0f); - - // position - pozycja kamery - // forward - wektor "do przodu" kamery (jednostkowy) - // up - wektor "w gore" kamery (jednostkowy) - // up i forward musza byc ortogonalne! - glm::mat4 createViewMatrix(glm::vec3 position, glm::vec3 forward, glm::vec3 up); -} \ No newline at end of file diff --git a/cw 2/src/Render_Utils.cpp b/cw 2/src/Render_Utils.cpp deleted file mode 100644 index 2453407..0000000 --- a/cw 2/src/Render_Utils.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Render_Utils.h" - -#include - -#include "glew.h" -#include "freeglut.h" - - -void Core::DrawContext(Core::RenderContext& context) -{ - - glBindVertexArray(context.vertexArray); - glDrawElements( - GL_TRIANGLES, // mode - context.size, // count - GL_UNSIGNED_SHORT, // type - (void*)0 // element array buffer offset - ); - glBindVertexArray(0); -} - diff --git a/cw 2/src/Render_Utils.h b/cw 2/src/Render_Utils.h deleted file mode 100644 index fba16a7..0000000 --- a/cw 2/src/Render_Utils.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once -#include "glm.hpp" -#include "glew.h" -//#include "objload.h" -#include -#include -#include -#include -#include - -#define BUFFER_OFFSET(i) ((void*)(i)) - -namespace Core -{ - struct RenderContext { - GLuint vertexArray; - GLuint vertexBuffer; - GLuint vertexIndexBuffer; - unsigned int size = 0; - - void initFromAiMesh(aiMesh* mesh) { - vertexArray = 0; - vertexBuffer = 0; - vertexIndexBuffer = 0; - - - std::vector textureCoord; - std::vector indices; - //tex coord must be converted to 2d vecs - for (unsigned int i = 0; i < mesh->mNumVertices; i++) - { - if (mesh->mTextureCoords[0] != nullptr) { - textureCoord.push_back(mesh->mTextureCoords[0][i].x); - textureCoord.push_back(mesh->mTextureCoords[0][i].y); - } - else { - textureCoord.push_back(0.0f); - textureCoord.push_back(0.0f); - } - } - if (mesh->mTextureCoords[0] == nullptr) { - std::cout << "no uv coords\n"; - } - for (unsigned int i = 0; i < mesh->mNumFaces; i++) - { - aiFace face = mesh->mFaces[i]; - // retrieve all indices of the face and store them in the indices vector - for (unsigned int j = 0; j < face.mNumIndices; j++) - indices.push_back(face.mIndices[j]); - } - - unsigned int vertexDataBufferSize = sizeof(float) * mesh->mNumVertices * 3; - unsigned int vertexNormalBufferSize = sizeof(float) * mesh->mNumVertices * 3; - unsigned int vertexTexBufferSize = sizeof(float) * mesh->mNumVertices * 2; - - } - - ~RenderContext() { - glDeleteBuffers(1, &vertexBuffer); - glDeleteBuffers(1, &vertexIndexBuffer); - glDeleteVertexArrays(1, &vertexArray); - } - - }; - - void DrawContext(RenderContext& context); -} - diff --git a/cw 2/src/Shader_Loader.cpp b/cw 2/src/Shader_Loader.cpp deleted file mode 100644 index 6e118e9..0000000 --- a/cw 2/src/Shader_Loader.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "Shader_Loader.h" -#include -#include -#include - -using namespace Core; - -Shader_Loader::Shader_Loader(void){} -Shader_Loader::~Shader_Loader(void){} - -std::string Shader_Loader::ReadShader(char *filename) -{ - - std::string shaderCode; - std::ifstream file(filename, std::ios::in); - - if (!file.good()) - { - std::cout << "Can't read file " << filename << std::endl; - std::terminate(); - } - - file.seekg(0, std::ios::end); - shaderCode.resize((unsigned int)file.tellg()); - file.seekg(0, std::ios::beg); - file.read(&shaderCode[0], shaderCode.size()); - file.close(); - return shaderCode; -} - -GLuint Shader_Loader::CreateShader(GLenum shaderType, std::string - source, char* shaderName) -{ - - int compile_result = 0; - - GLuint shader = glCreateShader(shaderType); - const char *shader_code_ptr = source.c_str(); - const int shader_code_size = source.size(); - - glShaderSource(shader, 1, &shader_code_ptr, &shader_code_size); - glCompileShader(shader); - glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_result); - - //sprawdz bledy - if (compile_result == GL_FALSE) - { - - int info_log_length = 0; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_log_length); - std::vector shader_log(info_log_length); - glGetShaderInfoLog(shader, info_log_length, NULL, &shader_log[0]); - std::cout << "ERROR compiling shader: " << shaderName << std::endl << &shader_log[0] << std::endl; - return 0; - } - - return shader; -} - -GLuint Shader_Loader::CreateProgram(char* vertexShaderFilename, - char* fragmentShaderFilename) -{ - - //wczytaj shadery - std::string vertex_shader_code = ReadShader(vertexShaderFilename); - std::string fragment_shader_code = ReadShader(fragmentShaderFilename); - - GLuint vertex_shader = CreateShader(GL_VERTEX_SHADER, vertex_shader_code, "vertex shader"); - GLuint fragment_shader = CreateShader(GL_FRAGMENT_SHADER, fragment_shader_code, "fragment shader"); - - int link_result = 0; - //stworz shader - GLuint program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - - glLinkProgram(program); - glGetProgramiv(program, GL_LINK_STATUS, &link_result); - //sprawdz bledy w linkerze - if (link_result == GL_FALSE) - { - - int info_log_length = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &info_log_length); - std::vector program_log(info_log_length); - glGetProgramInfoLog(program, info_log_length, NULL, &program_log[0]); - std::cout << "Shader Loader : LINK ERROR" << std::endl << &program_log[0] << std::endl; - return 0; - } - - glDetachShader(program, vertex_shader); - glDetachShader(program, fragment_shader); - glDeleteShader(vertex_shader); - glDeleteShader(fragment_shader); - - return program; -} - -void Shader_Loader::DeleteProgram( GLuint program ) -{ - glDeleteProgram(program); -} diff --git a/cw 2/src/Shader_Loader.h b/cw 2/src/Shader_Loader.h deleted file mode 100644 index 1fb9757..0000000 --- a/cw 2/src/Shader_Loader.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "glew.h" -#include "freeglut.h" -#include - -namespace Core -{ - - class Shader_Loader - { - private: - - std::string ReadShader(char *filename); - GLuint CreateShader(GLenum shaderType, - std::string source, - char* shaderName); - - public: - - Shader_Loader(void); - ~Shader_Loader(void); - GLuint CreateProgram(char* VertexShaderFilename, - char* FragmentShaderFilename); - - void DeleteProgram(GLuint program); - - }; -} \ No newline at end of file diff --git a/cw 2/src/main_2_1a.cpp b/cw 2/src/main_2_1a.cpp deleted file mode 100644 index f08ba1f..0000000 --- a/cw 2/src/main_2_1a.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "glew.h" -#include "freeglut.h" -#include "glm.hpp" -#include "ext.hpp" -#include -#include - -#include "Shader_Loader.h" -#include "Render_Utils.h" - -#include "Box.cpp" - -GLuint program; -Core::Shader_Loader shaderLoader; - -unsigned int VAO; - -void renderScene() -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glClearColor(0.0f, 0.3f, 0.3f, 1.0f); - - // ZADANIE: W zalaczonym wyzej pliku Box.cpp znajduja sie tablice pozycji i kolorow wierzcholkow prostopadloscianu. Przesun go o wektor (0.5, 0.5, -0.2) i wyswietl go. - // - // Do shadera uzytego w tym zadaniu nalezy przeslac nie tylko pozycje, ale rowniez kolory wierzcholkow. - // W funkcji init należy przesłać pozycje i kolory do GPU - - glUseProgram(program); - - // Powiąż stworzone VAO za pomocą funkcji glBindVertexArray - // wykorzystaj glDrawArrays do narysowania prostopadłościanu - - glm::mat4 transformation; - glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation); - - - glUseProgram(0); - glutSwapBuffers(); -} - -void init() -{ - glEnable(GL_DEPTH_TEST); - program = shaderLoader.CreateProgram("shaders/shader_2_1.vert", "shaders/shader_2_1.frag"); - // Dokładny opis działania funkcji z poniższych punktów można znaleźć na slajdach z wykładu, w dokumentacji https://www.khronos.org/registry/OpenGL-Refpages/gl4/ funkcje są opisane także na stronach https://learnopengl.com/Getting-started/Hello-Triangle oraz https://open.gl/drawing - // Zainicjalizuj VertexArrayObject (VAO) i zapisz w nim atrybuty prostopadłościanu - // I Stwórz VAO - // 1. Stwórz nowy VAO za pomocą glGenVertexArrays i przypisz jego adres do zmiennej globalnej - - // 2. Powiąż stworzone VAO za pomocą funkcji glBindVertexArray - - // II Zainicjalizuj VBO - // 3. Stwórz VertexBufferObject do przechowywania pozycji wierzchołków za pomocą funkcji glGenBuffers - - // 4. Powiąż stworzone VBO za pomocą funkcji glBindBuffer(GLenum target, GLuint ) - - // 5. Zaalokuj w GPU miejsce na tablice wierzchołków i kolorów za pomocą glBufferData pamiętaj, żeby zaalokować dość miejsca dla punktów i kolorów - - // III Prześlij dane do karty graficznej - // A) Prześlij pozycję wierzchołków do karty graficznej - // 6. Aktywuj atrybut powiązany z pozycją wierchołków za pomocą glEnableVertexAttribArray(GLuint index). Indeks jest zapisany w shaderze wierzchołków w 3. lini. Można odpytać shader o indeks za pomocą funkcji glGetAttribLocation(GL uint program, const GLchar *name) - - // 7. Przekaż dane za pomocą glBufferSubData - - // 8. Zdefiniuj jak OpenGL powinien interpretować dane za pomocą glVertexAttribPointer - - // B) powtórz punkty 6-8 by przesłać wartości odpowiadające za kolor - - - // 9. Uwolnij VAO za pomocą funkcji glBindVertexArray(0) - -} - -void shutdown() -{ - shaderLoader.DeleteProgram(program); -} - -void idle() -{ - glutPostRedisplay(); -} - -int main(int argc, char ** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); - glutInitWindowPosition(200, 200); - glutInitWindowSize(600, 600); - glutCreateWindow("OpenGL Pierwszy Program"); - glewInit(); - - init(); - glutDisplayFunc(renderScene); - glutIdleFunc(idle); - - glutMainLoop(); - - shutdown(); - - return 0; -} diff --git a/cw 2/src/main_2_1b.cpp b/cw 2/src/main_2_1b.cpp deleted file mode 100644 index 0fc1c23..0000000 --- a/cw 2/src/main_2_1b.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "glew.h" -#include "freeglut.h" -#include "glm.hpp" -#include "ext.hpp" -#include -#include - -#include "Shader_Loader.h" -#include "Render_Utils.h" - -#include "Box.cpp" -float points[] = { -0.0f,1.0f,0.f,1.f, -0.7818314824680298f,0.6234898018587336f,0.f,1.f, -0.9749279121818236f,-0.22252093395631434f,0.f,1.f, -0.43388373911755823f,-0.900968867902419f,0.f,1.f, --0.433883739117558f,-0.9009688679024191f,0.f,1.f, --0.9749279121818236f,-0.2225209339563146f,0.f,1.f, --0.7818314824680299f,0.6234898018587334f,0.f,1.f, -}; -float hues[] = { - 0.0, 0.7142857142857143, 0.42857142857142855, 0.14285714285714285, 0.8571428571428571, 0.5714285714285714, 0.2857142857142857 -}; - -GLuint program; -Core::Shader_Loader shaderLoader; - -unsigned int VAO; - -void renderScene() -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glClearColor(0.0f, 0.3f, 0.3f, 1.0f); - - // ZADANIE: Powyżej w tablicy points znajdują się wierzchołki 7-kąta foremnego, zadanie polega na narysowaniu gwiazdy siedmioramiennej jak na obrazku zad1b.jpg. Do shadera należy przesłać pozycje wierzchołków i ich odcienie z tablicy hues podobnie jak w zadaniu 1a. - // Idealnie rozwiązane zadanie wymaga użycia indeksowania z użyciem Element Buffer Objects oraz trybu rysowania GL_LINE_STRIP - // (dodatkowe) Jedna krawędź przechodzi przez wszystkie odcienie zamiast z czerwonego do magenty. Co to powoduje? W jaki sposób byś to naprawił? - - glUseProgram(program); - - - - - glUseProgram(0); - glutSwapBuffers(); -} - -void init() -{ - glEnable(GL_DEPTH_TEST); - program = shaderLoader.CreateProgram("shaders/shader_2_1b.vert", "shaders/shader_2_1b.frag"); - - - -} - -void shutdown() -{ - shaderLoader.DeleteProgram(program); -} - -void idle() -{ - glutPostRedisplay(); -} - -int main(int argc, char ** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); - glutInitWindowPosition(200, 200); - glutInitWindowSize(600, 600); - glutCreateWindow("OpenGL Pierwszy Program"); - glewInit(); - - init(); - glutDisplayFunc(renderScene); - glutIdleFunc(idle); - - glutMainLoop(); - - shutdown(); - - return 0; -} diff --git a/cw 2/src/main_2_2.cpp b/cw 2/src/main_2_2.cpp deleted file mode 100644 index a9e76f8..0000000 --- a/cw 2/src/main_2_2.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "glew.h" -#include "freeglut.h" -#include "glm.hpp" -#include "ext.hpp" -#include -#include - -#include "Shader_Loader.h" -#include "Render_Utils.h" -#include "Camera.h" - -#include "Box.cpp" -#include -#include -#include -#include - - -GLuint program; -Core::Shader_Loader shaderLoader; - -Core::RenderContext shipContext; -Core::RenderContext sphereContext; - - -float cameraAngle = 0; -glm::vec3 cameraPos = glm::vec3(-5, 0, 0); -glm::vec3 cameraDir; - - -void keyboard(unsigned char key, int x, int y) -{ - float angleSpeed = 0.1f; - float moveSpeed = 0.1f; - switch(key) - { - case 'a': cameraAngle -= angleSpeed; break; - case 'd': cameraAngle += angleSpeed; break; - case 'w': cameraPos += cameraDir * moveSpeed; break; - case 's': cameraPos -= cameraDir * moveSpeed; break; - } -} - -glm::mat4 createCameraMatrix() -{ - cameraDir = glm::vec3(cosf(cameraAngle), 0.0f, sinf(cameraAngle)); - glm::vec3 up = glm::vec3(0,1,0); - - return Core::createViewMatrix(cameraPos, cameraDir, up); -} - -void renderScene() -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glClearColor(0.0f, 0.3f, 0.3f, 1.0f); - - glUseProgram(program); - - glm::mat4 camera = createCameraMatrix(); - glm::mat4 perspective = Core::createPerspectiveMatrix(); - glm::mat4 transformation = perspective * camera; - - glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation); - - glUseProgram(0); - glutSwapBuffers(); -} - -void init() -{ - glEnable(GL_DEPTH_TEST); - program = shaderLoader.CreateProgram("shaders/shader_2_2.vert", "shaders/shader_2_2.frag"); -} - -void shutdown() -{ - shaderLoader.DeleteProgram(program); -} - -void loadModelToContext(std::string path,Core::RenderContext& context) -{ - Assimp::Importer import; - const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace); - - if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) - { - std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl; - return; - } -} - - -void idle() -{ - glutPostRedisplay(); -} - -int main(int argc, char ** argv) -{ - loadModelToContext(".\\models\\spaceship.obj", sphereContext); - - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); - glutInitWindowPosition(200, 200); - glutInitWindowSize(600, 600); - glutCreateWindow("OpenGL Pierwszy Program"); - glewInit(); - - init(); - glutKeyboardFunc(keyboard); - glutDisplayFunc(renderScene); - glutIdleFunc(idle); - - glutMainLoop(); - - shutdown(); - - return 0; -} diff --git a/cw 2/style.css b/cw 2/style.css deleted file mode 100644 index cf42427..0000000 --- a/cw 2/style.css +++ /dev/null @@ -1,107 +0,0 @@ -html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } - -body{ -color:#444; -font-family:Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; -font-size:12px; -line-height:1.5em; -padding:1em; -margin:auto; -max-width:42em; -background:#fefefe; -} - -a{ color: #0645ad; text-decoration:none;} -a:visited{ color: #0b0080; } -a:hover{ color: #06e; } -a:active{ color:#faa700; } -a:focus{ outline: thin dotted; } -a:hover, a:active{ outline: 0; } - -::-moz-selection{background:rgba(255,255,0,0.3);color:#000} -::selection{background:rgba(255,255,0,0.3);color:#000} - -a::-moz-selection{background:rgba(255,255,0,0.3);color:#0645ad} -a::selection{background:rgba(255,255,0,0.3);color:#0645ad} - -p{ -margin:1em 0; -} - -img{ -max-width:100%; -} - -h1,h2,h3,h4,h5,h6{ -font-weight:normal; -color:#111; -line-height:1em; -} -h4,h5,h6{ font-weight: bold; } -h1{ font-size:2.5em; } -h2{ font-size:2em; } -h3{ font-size:1.5em; } -h4{ font-size:1.2em; } -h5{ font-size:1em; } -h6{ font-size:0.9em; } - -blockquote{ -color:#666666; -margin:0; -padding-left: 3em; -border-left: 0.5em #EEE solid; -} -hr { display: block; height: 2px; border: 0; border-top: 1px solid #aaa;border-bottom: 1px solid #eee; margin: 1em 0; padding: 0; } -pre, code, kbd, samp { color: #000; font-family: monospace, monospace; _font-family: 'courier new', monospace; font-size: 0.98em; } -pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } - -b, strong { font-weight: bold; } - -dfn { font-style: italic; } - -ins { background: #ff9; color: #000; text-decoration: none; } - -mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; } - -sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } -sup { top: -0.5em; } -sub { bottom: -0.25em; } - -ul, ol { margin: 1em 0; padding: 0 0 0 2em; } -li p:last-child { margin:0 } -dd { margin: 0 0 0 2em; } - -img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; } - -table { -border-collapse: collapse; -border-spacing: 0; -width: 100%; -} -th { border-bottom: 1px solid black; } -td { vertical-align: top; } - -@media only screen and (min-width: 480px) { -body{font-size:14px;} -} - -@media only screen and (min-width: 768px) { -body{font-size:16px;} -} - -@media print { - * { background: transparent !important; color: black !important; filter:none !important; -ms-filter: none !important; } - body{font-size:12pt; max-width:100%;} - a, a:visited { text-decoration: underline; } - hr { height: 1px; border:0; border-bottom:1px solid black; } - a[href]:after { content: " (" attr(href) ")"; } - abbr[title]:after { content: " (" attr(title) ")"; } - .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } - pre, blockquote { border: 1px solid #999; padding-right: 1em; page-break-inside: avoid; } - tr, img { page-break-inside: avoid; } - img { max-width: 100% !important; } - @page :left { margin: 15mm 20mm 15mm 10mm; } - @page :right { margin: 15mm 10mm 15mm 20mm; } - p, h2, h3 { orphans: 3; widows: 3; } - h2, h3 { page-break-after: avoid; } -} \ No newline at end of file diff --git a/cw 2/zad1b.JPG b/cw 2/zad1b.JPG deleted file mode 100644 index c5668d1..0000000 Binary files a/cw 2/zad1b.JPG and /dev/null differ diff --git a/cw 2/zadanie_2_2.html b/cw 2/zadanie_2_2.html deleted file mode 100644 index 5d72888..0000000 --- a/cw 2/zadanie_2_2.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - zadanie_2_2 - - - - - -

Ładowanie modeli

-

w tym zadaniu przećwiczymy ładowanie modeli z plików, wykorzystamy do tego bibliotekę assimp (The Open Asset Import Library ), która zapewnia wspólny interfejs dla różnych typów plików.

-

Funkcja loadModelToContext pobiera ścieżkę do pliku z modelem i wczytuje go przy użyciu importera assimp.

-
const aiScene* scene = import.ReadFile(path, aiProcess_TriangulateaiProcess_Triangulate | aiProcess_CalcTangentSpace);
-

Importer przyjmuje ścieżkę i flagi preprocesingu, które mówią jakie operacje ma wykonać importer przed przekazaniem nam pliku. W naszym przypadku dokonuje triangularyzacji (zamienia wszystkie wielokąty na trójkąty) i oblicza przestrzeń styczną (o której będzie mowa później).

-
-

Wywołaj funkcję dla ścieżki do statku ./models/spaceship.obj i zmiennej globalnej Core::RenderContext sphereContext. Dodaj breakpoint po załadowaniu sceny i obejrzyj jak wygląda struktura załadowanego obiektu

-
-

Załadowany obiekt posiada szereg pól jak na przykład tekstury, oświetlenia, materiały, węzły (Node) czy modele. Węzły odpowiadają za hierarchię elementów w modelu, co ułatwia jego animację, wykorzystamy to w późniejszych zajęciach, w trakcie tych zajęć będziemy się skupiać na modelach. Nasze obiekty składają się z tylko jednego modelu, wywołaj context.initFromAiMesh z nim jako argumentem.

-

Zadanie

-

Jeśli tego nie zrobiłeś wywołaj metodę context.initFromAiMesh z argumentemscene->mMeshes[0] po wczytaniu sceny. Metoda nie jest kompletna, uzupełnij ją o ładowanie indeksów, wierzchołków, normalnych i współrzędnych tekstur do bufora. Współrzędne tekstur i indeksy zostały przekonwertowane do odpowiedniego formatu i znajdują się w zmiennych std::vector<float> textureCoord i std::vector<unsigned int> indices odpowiednio. Pozostałe są dostępne jako atrybuty aiMesh, mianowicie mesh->mVertices zawiera wierzchołki a mesh->mNormals normalne

-

Dodatkowo

-
unsigned int vertexDataBufferSize = sizeof(float) * mesh->mNumVertices * 3;
-unsigned int vertexNormalBufferSize = sizeof(float) * mesh->mNumVertices * 3;
-unsigned int vertexTexBufferSize = sizeof(float) * mesh->mNumVertices * 2;
-

zawierają rozmiary buforów.

-

Wykorzystaj w renderScene funkcję Core::DrawContext(Core::RenderContext& context)

- - diff --git a/cw 2/zadanie_2_2.md b/cw 2/zadanie_2_2.md deleted file mode 100644 index 9b688b0..0000000 --- a/cw 2/zadanie_2_2.md +++ /dev/null @@ -1,32 +0,0 @@ -# Ładowanie modeli - -w tym zadaniu przećwiczymy ładowanie modeli z plików, wykorzystamy do tego bibliotekę assimp (The Open Asset Import Library ), która zapewnia wspólny interfejs dla różnych typów plików. - -Funkcja `loadModelToContext` pobiera ścieżkę do pliku z modelem i wczytuje go przy użyciu importera assimp. - -```c++ -const aiScene* scene = import.ReadFile(path, aiProcess_TriangulateaiProcess_Triangulate | aiProcess_CalcTangentSpace); -``` - -Importer przyjmuje ścieżkę i flagi preprocesingu, które mówią jakie operacje ma wykonać importer przed przekazaniem nam pliku. W naszym przypadku dokonuje triangularyzacji (zamienia wszystkie wielokąty na trójkąty) i oblicza przestrzeń styczną (o której będzie mowa później). - -> Wywołaj funkcję dla ścieżki do statku **./models/spaceship.obj** i zmiennej globalnej `Core::RenderContext sphereContext`. Dodaj breakpoint po załadowaniu sceny i obejrzyj jak wygląda struktura załadowanego obiektu - -Załadowany obiekt posiada szereg pól jak na przykład tekstury, oświetlenia, materiały, węzły (*Node*) czy modele. Węzły odpowiadają za hierarchię elementów w modelu, co ułatwia jego animację, wykorzystamy to w późniejszych zajęciach, w trakcie tych zajęć będziemy się skupiać na modelach. Nasze obiekty składają się z tylko jednego modelu, wywołaj `context.initFromAiMesh` z nim jako argumentem. - -### Zadanie - -Jeśli tego nie zrobiłeś wywołaj metodę `context.initFromAiMesh` z argumentem`scene->mMeshes[0]` po wczytaniu sceny. Metoda nie jest kompletna, uzupełnij ją o ładowanie indeksów, wierzchołków, normalnych i współrzędnych tekstur do bufora. Współrzędne tekstur i indeksy zostały przekonwertowane do odpowiedniego formatu i znajdują się w zmiennych `std::vector textureCoord` i ` std::vector indices` odpowiednio. Pozostałe są dostępne jako atrybuty `aiMesh`, mianowicie `mesh->mVertices` zawiera wierzchołki a `mesh->mNormals` normalne - -Dodatkowo - -```C++ -unsigned int vertexDataBufferSize = sizeof(float) * mesh->mNumVertices * 3; -unsigned int vertexNormalBufferSize = sizeof(float) * mesh->mNumVertices * 3; -unsigned int vertexTexBufferSize = sizeof(float) * mesh->mNumVertices * 2; -``` - -zawierają rozmiary buforów. - -Wykorzystaj w `renderScene` funkcję `Core::DrawContext(Core::RenderContext& context)` - diff --git a/cw 2/zlib.dll b/cw 2/zlib.dll deleted file mode 100644 index 7e7c10e..0000000 Binary files a/cw 2/zlib.dll and /dev/null differ diff --git a/cw 2/zlibd.dll b/cw 2/zlibd.dll deleted file mode 100644 index 5f03c2c..0000000 Binary files a/cw 2/zlibd.dll and /dev/null differ diff --git a/cw 6/Release/Bubble.obj b/cw 6/Release/Bubble.obj new file mode 100644 index 0000000..35ca5eb Binary files /dev/null and b/cw 6/Release/Bubble.obj differ diff --git a/cw 6/Release/Camera.obj b/cw 6/Release/Camera.obj new file mode 100644 index 0000000..c0acf5e Binary files /dev/null and b/cw 6/Release/Camera.obj differ diff --git a/cw 6/Release/Fish.obj b/cw 6/Release/Fish.obj new file mode 100644 index 0000000..63cfdaa Binary files /dev/null and b/cw 6/Release/Fish.obj differ diff --git a/cw 6/Release/KeyPoints.obj b/cw 6/Release/KeyPoints.obj new file mode 100644 index 0000000..ac73eeb Binary files /dev/null and b/cw 6/Release/KeyPoints.obj differ diff --git a/cw 6/Release/Model.obj b/cw 6/Release/Model.obj new file mode 100644 index 0000000..799c521 Binary files /dev/null and b/cw 6/Release/Model.obj differ diff --git a/cw 6/Release/Particle.obj b/cw 6/Release/Particle.obj new file mode 100644 index 0000000..af0b704 Binary files /dev/null and b/cw 6/Release/Particle.obj differ diff --git a/cw 6/Release/Physics.obj b/cw 6/Release/Physics.obj new file mode 100644 index 0000000..b9d7cfa Binary files /dev/null and b/cw 6/Release/Physics.obj differ diff --git a/cw 6/Release/Render_Utils.obj b/cw 6/Release/Render_Utils.obj new file mode 100644 index 0000000..ce56c02 Binary files /dev/null and b/cw 6/Release/Render_Utils.obj differ diff --git a/cw 6/Release/SOIL.obj b/cw 6/Release/SOIL.obj new file mode 100644 index 0000000..7fa6d48 Binary files /dev/null and b/cw 6/Release/SOIL.obj differ diff --git a/cw 6/Release/Shader_Loader.obj b/cw 6/Release/Shader_Loader.obj new file mode 100644 index 0000000..ba792f1 Binary files /dev/null and b/cw 6/Release/Shader_Loader.obj differ diff --git a/cw 6/Release/Skybox.obj b/cw 6/Release/Skybox.obj new file mode 100644 index 0000000..b99278a Binary files /dev/null and b/cw 6/Release/Skybox.obj differ diff --git a/cw 6/Release/Texture.obj b/cw 6/Release/Texture.obj new file mode 100644 index 0000000..a0e7251 Binary files /dev/null and b/cw 6/Release/Texture.obj differ diff --git a/cw 6/Release/image_DXT.obj b/cw 6/Release/image_DXT.obj new file mode 100644 index 0000000..28d5898 Binary files /dev/null and b/cw 6/Release/image_DXT.obj differ diff --git a/cw 6/Release/image_helper.obj b/cw 6/Release/image_helper.obj new file mode 100644 index 0000000..57febf3 Binary files /dev/null and b/cw 6/Release/image_helper.obj differ diff --git a/cw 6/Release/main_6_1.obj b/cw 6/Release/main_6_1.obj new file mode 100644 index 0000000..42e9fce Binary files /dev/null and b/cw 6/Release/main_6_1.obj differ diff --git a/cw 6/Release/stb_image_aug.obj b/cw 6/Release/stb_image_aug.obj new file mode 100644 index 0000000..aca212f Binary files /dev/null and b/cw 6/Release/stb_image_aug.obj differ