
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
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#pragma once
|
|
#include "core.h"
|
|
#include "DirectXCore.h"
|
|
|
|
using namespace std;
|
|
|
|
// Abstract base class for all nodes of the scene graph.
|
|
// This scene graph implements the Composite Design Pattern
|
|
|
|
class SceneNode;
|
|
|
|
typedef shared_ptr<SceneNode> SceneNodePointer;
|
|
|
|
class SceneNode : public enable_shared_from_this<SceneNode>
|
|
{
|
|
public:
|
|
SceneNode(wstring name) {_name = name; XMStoreFloat4x4(&_worldTransformation, XMMatrixIdentity()); };
|
|
~SceneNode(void) {};
|
|
|
|
// Core methods
|
|
virtual bool Initialise() = 0;
|
|
virtual void Update(FXMMATRIX& currentWorldTransformation) { XMStoreFloat4x4(&_combinedWorldTransformation, XMLoadFloat4x4(&_worldTransformation) * currentWorldTransformation); }
|
|
virtual void Render() = 0;
|
|
virtual void Shutdown() = 0;
|
|
|
|
virtual void DoTestUpdate(float inputTest) { _testInt = inputTest; }
|
|
|
|
void SetWorldTransform(FXMMATRIX& worldTransformation) { XMStoreFloat4x4(&_worldTransformation, worldTransformation); }
|
|
void AddToWorldTransform(FXMMATRIX& transformation) { XMStoreFloat4x4(&_worldTransformation, XMLoadFloat4x4(&_worldTransformation) * transformation); }
|
|
|
|
// Although only required in the composite class, these are provided
|
|
// in order to simplify the code base.
|
|
virtual void Add(SceneNodePointer node) {}
|
|
virtual void Remove(SceneNodePointer node) {};
|
|
virtual SceneNodePointer Find(wstring name) { return (_name == name) ? shared_from_this() : nullptr; }
|
|
virtual SceneNodePointer GetFirstChild() { return shared_from_this(); }
|
|
|
|
protected:
|
|
XMFLOAT4X4 _worldTransformation;
|
|
XMFLOAT4X4 _combinedWorldTransformation;
|
|
wstring _name;
|
|
float _testInt = 0.0f;
|
|
};
|
|
|