diff --git a/Actions.hpp b/Actions.hpp index e3307d0..abe767f 100644 --- a/Actions.hpp +++ b/Actions.hpp @@ -257,6 +257,7 @@ namespace Actions return returnRef; } + // TODO: Not yet working template IAction* Request_AAction(const ObjectType& _objectRef, const function< FunctionType>& _actionToQueue, const ActionParams&... _paramsForAction) { @@ -274,11 +275,11 @@ namespace Actions { ActionType* castedEntry = static_cast(possibleAction->get()); - if (castedEntry->IsSame(_actionToQueue, _paramsForAction...)) + if (castedEntry->IsSame(_objectRef, _actionToQueue, _paramsForAction...)) { return castedEntry; } - else if (castedEntry->Used() && castedEntry->SameAction(_actionToQueue)) + else if (castedEntry->Used() && castedEntry->SameAction(_actionToQueue) && castedEntry->SameObject(_objectRef)) { castedEntry->ReInitalize(_paramsForAction...); @@ -286,16 +287,16 @@ namespace Actions } } - shared_ptr< IAction> newAction = make_shared< AAction>(_actionToQueue, _paramsForAction...); - IAction* returnRef = newAction.get (); + shared_ptr< IAction> newAction = make_shared< AAction_ObjectBound>(_actionToQueue, _paramsForAction...); + IAction* returnRef = newAction.get (); aActions_Available.at(AActionID).push_front(newAction); return returnRef; } - shared_ptr< IAction> newAction = make_shared< AAction>(_actionToQueue, _paramsForAction...); - IAction* returnRef = newAction.get (); + shared_ptr< IAction> newAction = make_shared< AAction_ObjectBound>(_actionToQueue, _paramsForAction...); + IAction* returnRef = newAction.get (); aActions_Available.insert(std::make_pair(AActionID, Make_Managed_Actions())); diff --git a/DGL/DGL_Entity.hpp b/DGL/DGL_Entity.hpp index 55a6717..ed66cc3 100644 --- a/DGL/DGL_Entity.hpp +++ b/DGL/DGL_Entity.hpp @@ -91,7 +91,7 @@ namespace DGL transform = Translate(transform, position); transform = Scale (transform, scale ); - valueLoop += 0.31879f * _delta; + valueLoop += 0.31879f * gFloat(_delta); return; } @@ -232,9 +232,9 @@ namespace DGL transform = CoordSpace(1.0f); - transform = DGL::Translate(transform, position); + transform = Translate(transform, position); - transform = DGL::Scale(transform, scale); + transform = Scale(transform, scale); return; } @@ -245,9 +245,9 @@ namespace DGL transform = CoordSpace(1.0f); - transform = DGL::Translate(transform, position); + transform = Translate(transform, position); - transform = DGL::Scale(transform, scale); + transform = Scale(transform, scale); return; } @@ -281,7 +281,7 @@ namespace DGL private: - //EEntityType type; + // EEntityType type; Vector3 position ; Vector3 scale ; diff --git a/DGL/DGL_Model.hpp b/DGL/DGL_Model.hpp index e39590e..a316924 100644 --- a/DGL/DGL_Model.hpp +++ b/DGL/DGL_Model.hpp @@ -3,7 +3,7 @@ Title : Ducktaped GL: Model Author: Edward R. Gonzalez Description: - +Allows the management of loading and buffer/rendering models from wavefront obj file sources. */ #pragma once @@ -120,6 +120,8 @@ namespace DGL if (normals.size() > 0) { //generated.Normals.vec[index] = normals[index]; + + // Not using built in normals for now... } } @@ -157,11 +159,6 @@ namespace DGL normal = GetCrossNormal(edge1, edge2); - - //faces[faceIndex].Normals.vec[0] = vertexIndex1; - //faces[faceIndex].Normals.vec[1] = vertexIndex2; - //faces[faceIndex].Normals.vec[2] = vertexIndex3; - normals[vertexIndex1] += normal; normals[vertexIndex2] += normal; normals[vertexIndex3] += normal; @@ -169,14 +166,6 @@ namespace DGL for (int index = 0; index < normals.size(); index++) { - /*gFloat magnitude = 0.0f; - - magnitude = normals[index].x + normals[index].y + normals[index].z; - - normals[index].x /= magnitude; - normals[index].y /= magnitude; - normals[index].z /= magnitude;*/ - normals[index] = GetDirection(normals[index]); } } @@ -201,6 +190,8 @@ namespace DGL // Hardcoded to only do the verticies and normals for now... void Buffer() { + // Generate buffers + GenerateVertexBuffers(vertexArrayID , 1); GenerateBuffers (vertexBufferID , 1); GenerateBuffers (normalBuffferID, 1); @@ -256,24 +247,11 @@ namespace DGL } - BindBuffer(EBufferTarget::VertexIndices, elementBufferID); BufferData(faces[0], gSize(faces.size() * sizeof(Face)), EBufferTarget::VertexIndices, EBufferUsage::StaticDraw); - - UnbindVertexArray(); // Unbind vertex array. - - /*for (int index = 0; index < verticies.size(); index++) - { - cout << "Vertex: " << verticies[index].x << ", " << verticies[index].y << ", " << ", " << verticies[index].z << endl; - } - - for (int index = 0; index < verticies.size(); index++) - { - cout << "Normal: " << normals[index].x << ", " << normals[index].y << ", " << ", " << normals[index].z << endl; - }*/ } void Load() diff --git a/DGL/DGL_Shader.hpp b/DGL/DGL_Shader.hpp index 7c51079..3101aa6 100644 --- a/DGL/DGL_Shader.hpp +++ b/DGL/DGL_Shader.hpp @@ -1,3 +1,12 @@ +/* +Title : Ducktaped GL: Shader +Author: Edward R. Gonzalez + +Description: +All the wrappers for the openGL shader related and and implementation of a basic light and phong shader. +*/ + + #pragma once //DGL diff --git a/DGL/DGL_Space.hpp b/DGL/DGL_Space.hpp index 0583c7f..88b68f7 100644 --- a/DGL/DGL_Space.hpp +++ b/DGL/DGL_Space.hpp @@ -1,3 +1,11 @@ +/* +Title : Ducktaped GL: Space +Author: Edward R. Gonzalez + +Description: +Contains related functionality for dealing with 3D-Space, and viewing. +*/ + #pragma once // GLM diff --git a/DGL/DGL_Utilities.hpp b/DGL/DGL_Utilities.hpp index c866da2..3b151a1 100644 --- a/DGL/DGL_Utilities.hpp +++ b/DGL/DGL_Utilities.hpp @@ -1,3 +1,12 @@ +/* +Title : Ducktaped GL: Utilities +Author: Edward R. Gonzalez + +Description: +The header with the general functionality for using glm/glfw/glew. +*/ + + #pragma once // GLFW, GLEW, GLM @@ -18,6 +27,7 @@ #include "Cpp_Alias.hpp" + namespace DGL { // Object Instances @@ -232,6 +242,11 @@ namespace DGL return; } + void SetWindowHeader(Window* const _window, string _title) + { + glfwSetWindowTitle(_window, _title.c_str()); + } + void SwapBuffers(Window* const _window) { glfwSwapBuffers(_window); diff --git a/Execution.cpp b/Execution.cpp index 8779923..1ede4c8 100644 --- a/Execution.cpp +++ b/Execution.cpp @@ -75,6 +75,7 @@ namespace Execution using DGL::SetInputMode ; using DGL::SetPolygonMode ; using DGL::SetUniformVariable_MVA ; + using DGL::SetWindowHeader ; using DGL::SwapBuffers ; using DGL::UseProgramShader ; using DGL::TerminateGLFW ; @@ -97,7 +98,6 @@ namespace Execution enum class EModels { Bunny , - Cube , Eight , Gargoyle , Hand , @@ -111,34 +111,32 @@ namespace Execution bool Exist = true; // Determines if the the execution should exit cycler. - TimeValDec CycleStart , // Snapshot of cycle loop start time. - CycleEnd , // Snapshot of cycle loop end time. - DeltaTime , // Delta between last cycle start and end. + TimeValDec CycleStart , // Snapshot of cycle loop start time. + CycleEnd , // Snapshot of cycle loop end time. + DeltaTime , // Delta between last cycle start and end. InputInterval = 1.0f / 144.0f, // Interval per second to complete the input process of the cycle. PhysicsInterval = 1.0f / 144.0f, // Interval per second to complete the physics process of the cycle. - RenderInterval = 1.0f / 144.0f, // Interval per second to complete the render process of the cycle. - InputBuffer = 1.0f; + RenderInterval = 1.0f / 144.0f ; // Interval per second to complete the render process of the cycle. Window* DefaultWindow; // Default window to use for execution. double CursorX, CursorY; // Cursor axis position on the window. - bool CursorOff = true, ShowLight = true; + bool CursorOff = true, + ShowLight = true ; gFloat CamMoveSpeed = 7.0f, // Rate at which the camera should move. CamRotationSpeed = 27.0f ; // Rate at which the camera should rotate. TimeValDec InputDelta = 0.0, // Current delta since last input process. - InputBufferDelta = 0.0, PhysicsDelta = 0.0, // Current delta since last physics process. RenderDelta = 0.0 ; // Current delta since last render process. ActionQueue ActionsToComplete; // Actions queue to run during the physics process of the cycle. - EModels CurrentModel = EModels::Cube; + EModels CurrentModel = EModels::Bunny; Model Bunny ("./Models/bunny.obj" ); - Model Cube ("./Models/blendercube2.obj"); Model Eight ("./Models/eight.obj" ); Model Gargoyle ("./Models/gargoyle.obj" ); Model Hand ("./Models/hand.obj" ); @@ -152,7 +150,6 @@ namespace Execution Light_Basic Light ; // Hardcoded light. Rotates around object. Entity_Basic ObjectToView; // Object that will be currently in the middle with the light source rotating. - string windowTitle = "Assignment 1" , deltaStr = "Delta: " , @@ -164,7 +161,6 @@ namespace Execution - // Functionality void ChangeModel() @@ -184,7 +180,7 @@ namespace Execution { if (not Bunny.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Bunny..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Bunny..."); Bunny.Load(); } @@ -197,28 +193,11 @@ namespace Execution return; } - case EModels::Cube: - { - if (not Cube.Ready()) - { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Cube..."); - - Cube.Load(); - } - - ObjectToView.SetModel(Cube); - - ObjectToView.SetScale(1.0f); - - ObjectToView.SetPosition(Vector3(0, -1.0, 0)); - - return; - } case EModels::Eight: { if (not Eight.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Eight..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Eight..."); Eight.Load(); } @@ -235,7 +214,7 @@ namespace Execution { if (not Gargoyle.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Gargoyle..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Gargoyle..."); Gargoyle.Load(); } @@ -252,7 +231,7 @@ namespace Execution { if (not Hand.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Hand..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Hand..."); Hand.Load(); } @@ -263,14 +242,13 @@ namespace Execution ObjectToView.SetPosition(Vector3(0, -1.1f, 0)); - return; } case EModels::Sculpture: { if (not Sculpture.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Sculpture..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Sculpture..."); Sculpture.Load(); } @@ -285,7 +263,7 @@ namespace Execution { if (not Topology.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Topology..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Topology..."); Topology.Load(); } @@ -300,7 +278,7 @@ namespace Execution { if (not Torus.Ready()) { - glfwSetWindowTitle(DefaultWindow, "Assignment 1: Loading Torus..."); + SetWindowHeader(DefaultWindow, "Assignment 1: Loading Torus..."); Torus.Load(); } @@ -411,8 +389,6 @@ namespace Execution SetPolygonMode(DGL::EFace::Front_and_Back, DGL::ERenderMode::Fill); - glShadeModel(GL_FLAT); - // Cursor stuff @@ -435,14 +411,14 @@ namespace Execution Light.Load(); - Cube.Load(); + Bunny.Load(); ObjectMaterial.Color = DGL::Colors::WarmSphia.Vector(); ObjectMaterial.Ambience = 0.112f ; ObjectMaterial.Diffuse = 0.928f ; ObjectMaterial.Specular = 0.21f ; - ObjectToView = Entity_Basic(Cube, ObjectMaterial); + ObjectToView = Entity_Basic(Bunny, ObjectMaterial); } @@ -515,8 +491,6 @@ namespace Execution InputDelta += DeltaTime; PhysicsDelta += DeltaTime; RenderDelta += DeltaTime; - - InputBufferDelta += DeltaTime; } return; @@ -530,8 +504,8 @@ namespace Execution if (!KeyPressed(_currentWindowContext, EKeyCodes::H )) H_Held = false; if (!KeyPressed(_currentWindowContext, EKeyCodes::M )) M_Held = false; - - if (KeyPressed(_currentWindowContext, EKeyCodes::F1) && not F1_Held) + // TODO: Not necessary for now and throws memory error. + /*if (KeyPressed(_currentWindowContext, EKeyCodes::F1) && not F1_Held) { ECursorMode cursorMode = ECursorMode(GetMouseInputMode(DefaultWindow, EMouseMode::Cursor)); @@ -554,7 +528,7 @@ namespace Execution } F1_Held = true; - } + }*/ if (KeyPressed(_currentWindowContext, EKeyCodes::H) && not H_Held) { @@ -673,7 +647,7 @@ namespace Execution void RenderProcedure() { - glfwSetWindowTitle(DefaultWindow, WindowTitle.str().c_str()); + SetWindowHeader(DefaultWindow, WindowTitle.str()); if (ShowLight) { diff --git a/x64/Debug/CompGraphics.Build.CppClean.log b/x64/Debug/CompGraphics.Build.CppClean.log deleted file mode 100644 index e51dd15..0000000 --- a/x64/Debug/CompGraphics.Build.CppClean.log +++ /dev/null @@ -1,9 +0,0 @@ -f:\projects\compgraphics\x64\debug\compgraphics.exe -f:\projects\compgraphics\x64\debug\compgraphics.ilk -f:\projects\compgraphics\x64\debug\compgraphics.pdb -f:\projects\compgraphics\compgraphics\x64\debug\vc142.idb -f:\projects\compgraphics\compgraphics\x64\debug\vc142.pdb -f:\projects\compgraphics\compgraphics\x64\debug\compgraphics.tlog\cl.command.1.tlog -f:\projects\compgraphics\compgraphics\x64\debug\compgraphics.tlog\link.command.1.tlog -f:\projects\compgraphics\compgraphics\x64\debug\compgraphics.tlog\link.read.1.tlog -f:\projects\compgraphics\compgraphics\x64\debug\compgraphics.tlog\link.write.1.tlog diff --git a/x64/Debug/CompGraphics.log b/x64/Debug/CompGraphics.log deleted file mode 100644 index 647e778..0000000 --- a/x64/Debug/CompGraphics.log +++ /dev/null @@ -1,3 +0,0 @@ - Execution.cpp -F:\Projects\CompGraphics\CompGraphics\DGL\DGL_Entity.hpp(94,1): warning C4244: '+=': conversion from 'double' to 'DGL::gFloat', possible loss of data - CompGraphics.vcxproj -> F:\Projects\CompGraphics\x64\Debug\CompGraphics.exe diff --git a/x64/Debug/CompGraphics.tlog/CL.command.1.tlog b/x64/Debug/CompGraphics.tlog/CL.command.1.tlog deleted file mode 100644 index fa93eae..0000000 Binary files a/x64/Debug/CompGraphics.tlog/CL.command.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.tlog/CL.read.1.tlog b/x64/Debug/CompGraphics.tlog/CL.read.1.tlog deleted file mode 100644 index d7af5fc..0000000 Binary files a/x64/Debug/CompGraphics.tlog/CL.read.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.tlog/CL.write.1.tlog b/x64/Debug/CompGraphics.tlog/CL.write.1.tlog deleted file mode 100644 index 5b46319..0000000 Binary files a/x64/Debug/CompGraphics.tlog/CL.write.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.tlog/CompGraphics.lastbuildstate b/x64/Debug/CompGraphics.tlog/CompGraphics.lastbuildstate deleted file mode 100644 index a2b0806..0000000 --- a/x64/Debug/CompGraphics.tlog/CompGraphics.lastbuildstate +++ /dev/null @@ -1,2 +0,0 @@ -#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0 -Debug|x64|F:\Projects\CompGraphics\| diff --git a/x64/Debug/CompGraphics.tlog/link.command.1.tlog b/x64/Debug/CompGraphics.tlog/link.command.1.tlog deleted file mode 100644 index 37581a6..0000000 Binary files a/x64/Debug/CompGraphics.tlog/link.command.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.tlog/link.read.1.tlog b/x64/Debug/CompGraphics.tlog/link.read.1.tlog deleted file mode 100644 index f66e71e..0000000 Binary files a/x64/Debug/CompGraphics.tlog/link.read.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.tlog/link.write.1.tlog b/x64/Debug/CompGraphics.tlog/link.write.1.tlog deleted file mode 100644 index 7fcf8ae..0000000 Binary files a/x64/Debug/CompGraphics.tlog/link.write.1.tlog and /dev/null differ diff --git a/x64/Debug/CompGraphics.vcxproj.FileListAbsolute.txt b/x64/Debug/CompGraphics.vcxproj.FileListAbsolute.txt deleted file mode 100644 index e69de29..0000000 diff --git a/x64/Debug/Execution.obj b/x64/Debug/Execution.obj deleted file mode 100644 index a827692..0000000 Binary files a/x64/Debug/Execution.obj and /dev/null differ diff --git a/x64/Debug/vc142.idb b/x64/Debug/vc142.idb deleted file mode 100644 index 8ee5dc1..0000000 Binary files a/x64/Debug/vc142.idb and /dev/null differ diff --git a/x64/Debug/vc142.pdb b/x64/Debug/vc142.pdb deleted file mode 100644 index a351497..0000000 Binary files a/x64/Debug/vc142.pdb and /dev/null differ