
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
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#include "SplitMeshNode.h"
|
|
|
|
bool SplitMeshNode::Initialise()
|
|
{
|
|
bool currentStatus = true;
|
|
|
|
_resourceManager = DirectXFramework::GetDXFramework()->GetResourceManager();
|
|
_mesh = _resourceManager->GetMesh(_modelName);
|
|
if (_mesh == nullptr)
|
|
{
|
|
currentStatus = false;
|
|
}
|
|
else
|
|
{
|
|
Add(AddMeshNode(_mesh->GetRootNode()));
|
|
}
|
|
|
|
if (currentStatus)
|
|
{
|
|
currentStatus = SceneGraph::Initialise();
|
|
}
|
|
|
|
return currentStatus;
|
|
}
|
|
|
|
SceneNodePointer SplitMeshNode::AddMeshNode(shared_ptr<Node> node)
|
|
{
|
|
unsigned int subMeshCount = (unsigned int)node->GetMeshCount();
|
|
SceneNodePointer currentNodeGraph = make_shared<SceneGraph>(node->GetName());
|
|
|
|
/*string nameString;
|
|
for (char x : node->GetName())
|
|
{
|
|
nameString += x;
|
|
}
|
|
|
|
fileOut << string(depth, '-') + " " + nameString << endl;*/
|
|
|
|
// Loop through all submeshes in the mesh
|
|
for (unsigned int i = 0; i < subMeshCount; i++)
|
|
{
|
|
unsigned int meshIndex = node->GetMesh(i);
|
|
shared_ptr<SubMesh> subMesh = _mesh->GetSubMesh(meshIndex);
|
|
shared_ptr<SubMeshNode> subNode = make_shared<SubMeshNode>(node->GetName() + L"_" + to_wstring(i), subMesh);
|
|
currentNodeGraph->Add(subNode);
|
|
}
|
|
|
|
// Render the children
|
|
unsigned int childrenCount = (unsigned int)node->GetChildrenCount();
|
|
// Loop through all submeshes in the mesh, rendering them
|
|
for (unsigned int i = 0; i < childrenCount; i++)
|
|
{
|
|
currentNodeGraph->Add(AddMeshNode(node->GetChild(i)));
|
|
}
|
|
|
|
return currentNodeGraph;
|
|
} |