Added the camera class

Added the DDS Texture Loading for future use
Added the gamepad class for future use
Added first child method to the scenegraph
Added RGB to intensity and lerp methods to the shared methods class
Added the terrain node class with normals
Fixed issue with submeshnode not passing the world transform to the actual meshes
This commit is contained in:
iDunnoDev
2022-04-18 22:33:15 +01:00
committed by iDunnoDev
parent 65255f1321
commit 7a57c73ac3
47 changed files with 4323 additions and 91 deletions

View File

@ -7,7 +7,7 @@
DirectXFramework * _dxFramework = nullptr;
DirectXFramework::DirectXFramework() : DirectXFramework(800, 600)
{
{
}
DirectXFramework::DirectXFramework(unsigned int width, unsigned int height) : Framework(width, height)
@ -19,12 +19,6 @@ DirectXFramework::DirectXFramework(unsigned int width, unsigned int height) : Fr
_backgroundColour[1] = 0.0f;
_backgroundColour[2] = 0.0f;
_backgroundColour[3] = 0.0f;
// Initialise vectors used to create camera. We will move these
// to a separate Camera class later
_eyePosition = XMFLOAT4(0.0f, 20.0f, -90.0f, 0.0f);
_focalPointPosition = XMFLOAT4(0.0f, 20.0f, 0.0f, 0.0f);
_upVector = XMFLOAT4(0.0f, 1.0f, 0.0f, 0.0f);
}
DirectXFramework * DirectXFramework::GetDXFramework()
@ -32,11 +26,6 @@ DirectXFramework * DirectXFramework::GetDXFramework()
return _dxFramework;
}
XMMATRIX DirectXFramework::GetViewTransformation()
{
return XMLoadFloat4x4(&_viewTransformation);
}
XMMATRIX DirectXFramework::GetProjectionTransformation()
{
return XMLoadFloat4x4(&_projectionTransformation);
@ -73,12 +62,13 @@ bool DirectXFramework::Initialise()
}
OnResize(SIZE_RESTORED);
// Create camera and projection matrices (we will look at how the
// camera matrix is created from vectors later)
XMStoreFloat4x4(&_projectionTransformation, XMMatrixPerspectiveFovLH(XM_PIDIV4, (float)GetWindowWidth() / GetWindowHeight(), 1.0f, 10000.0f));
// Create camera and projection matrices
XMStoreFloat4x4(&_projectionTransformation, XMMatrixPerspectiveFovLH(XM_PIDIV4, (float)GetWindowWidth() / GetWindowHeight(), 1.0f, 1000.0f));
_resourceManager = make_shared<ResourceManager>();
_sceneGraph = make_shared<SceneGraph>();
_camera = make_shared<Camera>();
CreateSceneGraph();
return _sceneGraph->Initialise();
}
@ -93,6 +83,8 @@ void DirectXFramework::Update()
{
// Do any updates to the scene graph nodes
UpdateSceneGraph();
_camera->Update();
// Now apply any updates that have been made to world transformations
// to all the nodes
_sceneGraph->Update(XMMatrixIdentity());
@ -112,7 +104,7 @@ void DirectXFramework::Render()
void DirectXFramework::OnResize(WPARAM wParam)
{
// Update view and projection matrices to allow for the window size change
XMStoreFloat4x4(&_viewTransformation, XMMatrixLookAtLH(XMLoadFloat4(&_eyePosition), XMLoadFloat4(&_focalPointPosition), XMLoadFloat4(&_upVector)));
//XMStoreFloat4x4(&_viewTransformation, XMMatrixLookAtLH(XMLoadFloat4(&_eyePosition), XMLoadFloat4(&_focalPointPosition), XMLoadFloat4(&_upVector)));
XMStoreFloat4x4(&_projectionTransformation, XMMatrixPerspectiveFovLH(XM_PIDIV4, (float)GetWindowWidth() / GetWindowHeight(), 1.0f, 10000.0f));
// This will free any existing render and depth views (which