mirror of
https://github.com/Ed94/DuctTaped_GL.git
synced 2024-12-21 22:44:47 -08:00
Last bit of tape before turning assignment 1
This commit is contained in:
parent
a12a99404e
commit
7dfb188fd2
@ -257,6 +257,7 @@ namespace Actions
|
||||
return returnRef;
|
||||
}
|
||||
|
||||
// TODO: Not yet working
|
||||
template<typename ObjectType, typename FunctionType, typename... ActionParams>
|
||||
IAction* Request_AAction(const ObjectType& _objectRef, const function< FunctionType>& _actionToQueue, const ActionParams&... _paramsForAction)
|
||||
{
|
||||
@ -274,11 +275,11 @@ namespace Actions
|
||||
{
|
||||
ActionType* castedEntry = static_cast<ActionType*>(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,7 +287,7 @@ namespace Actions
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr< IAction> newAction = make_shared< AAction<FunctionType, ActionParams...>>(_actionToQueue, _paramsForAction...);
|
||||
shared_ptr< IAction> newAction = make_shared< AAction_ObjectBound<ObjectType, FunctionType, ActionParams...>>(_actionToQueue, _paramsForAction...);
|
||||
IAction* returnRef = newAction.get ();
|
||||
|
||||
aActions_Available.at(AActionID).push_front(newAction);
|
||||
@ -294,7 +295,7 @@ namespace Actions
|
||||
return returnRef;
|
||||
}
|
||||
|
||||
shared_ptr< IAction> newAction = make_shared< AAction<FunctionType, ActionParams...>>(_actionToQueue, _paramsForAction...);
|
||||
shared_ptr< IAction> newAction = make_shared< AAction_ObjectBound<ObjectType, FunctionType, ActionParams...>>(_actionToQueue, _paramsForAction...);
|
||||
IAction* returnRef = newAction.get ();
|
||||
|
||||
aActions_Available.insert(std::make_pair(AActionID, Make_Managed_Actions()));
|
||||
|
@ -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 ;
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 ,
|
||||
@ -116,29 +116,27 @@ namespace Execution
|
||||
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)
|
||||
{
|
||||
|
@ -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
|
@ -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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0
|
||||
Debug|x64|F:\Projects\CompGraphics\|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user