Basic Scene creation
This commit is contained in:
@ -15,19 +15,20 @@
|
||||
void ProcessVertices(aiMesh* mesh, std::vector<BarinkEngine::Vertex>& out_vertices);
|
||||
void ProcessIndices(aiMesh* mesh, std::vector<unsigned int>& out_indices);
|
||||
|
||||
namespace BarinkEngine {
|
||||
class ModelImporter {
|
||||
|
||||
class ModelImporter {
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
SceneObject* Import(const std::string path);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
static BarinkEngine::Mesh ModelImporter::processMesh(aiMesh* mesh, const aiScene* scene);
|
||||
static std::vector<BarinkEngine::Mesh> ModelImporter::processNode(aiNode* node, const aiScene* scene);
|
||||
|
||||
SceneObject* Import(const std::string path);
|
||||
|
||||
|
||||
};
|
||||
private:
|
||||
|
||||
static BarinkEngine::Mesh ModelImporter::processMesh(aiMesh* mesh, const aiScene* scene);
|
||||
static std::vector<BarinkEngine::Mesh> ModelImporter::processNode(aiNode* node, const aiScene* scene);
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include <imgui.h>
|
||||
|
||||
struct EngineStatistics {
|
||||
uint32_t lastSampleTime;
|
||||
long long lastSampleTime;
|
||||
float frameTime;
|
||||
uint32_t verts;
|
||||
uint32_t DC;
|
||||
|
||||
uint64_t frames;
|
||||
uint64_t FPS;
|
||||
long long frames;
|
||||
long long FPS;
|
||||
};
|
||||
extern EngineStatistics* ES;
|
||||
|
||||
@ -18,15 +18,15 @@ inline void PerfomanceSamplerInit(){
|
||||
ES->frames = 0;
|
||||
ES->lastSampleTime = 0;
|
||||
ES->lastSampleTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline void SamplePerformance(void) {
|
||||
ES->frames++;
|
||||
ES->DC = 0;
|
||||
ES->verts = 0;
|
||||
unsigned int now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||
unsigned int MilliSecondsPast = now - ES->lastSampleTime;
|
||||
unsigned long long now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||
unsigned long long MilliSecondsPast = now - ES->lastSampleTime;
|
||||
if (MilliSecondsPast >= 1000) {
|
||||
|
||||
ES->frameTime = (float)1000 / ES->frames;
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
Node& GetSceneNode(std::string);
|
||||
Node& GetRoot();
|
||||
|
||||
Scene(std::string SceneName = "Default Scene");
|
||||
Scene(const std::string& sceneName = "Default Scene");
|
||||
~Scene();
|
||||
|
||||
private:
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
class Node {
|
||||
public:
|
||||
Node(std::string& name);
|
||||
std::string& name;
|
||||
Node(const std::string& name);
|
||||
const std::string& name;
|
||||
Node* parent;
|
||||
std::vector<Node*> children;
|
||||
|
||||
@ -18,7 +18,7 @@ class Node {
|
||||
|
||||
class Group : public Node {
|
||||
public:
|
||||
Group(std::string& name);
|
||||
Group(const std::string& name);
|
||||
Transform& transform;
|
||||
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "Scene.h"
|
||||
static class SceneManager {
|
||||
class SceneManager {
|
||||
|
||||
public:
|
||||
static Scene* CreateScene(const std::string& name );
|
||||
@ -12,7 +12,6 @@ public:
|
||||
|
||||
private:
|
||||
static Scene* CurrentScene;
|
||||
|
||||
static std::map<std::string, Scene*> Scenes;
|
||||
static std::map<std::string, Scene*> Scenes;
|
||||
|
||||
};
|
@ -3,20 +3,20 @@
|
||||
#include "Graphics/Renderable.h"
|
||||
#include "Scene/Node.h"
|
||||
|
||||
class SceneCamera : public Group
|
||||
{
|
||||
public:
|
||||
Camera& camera;
|
||||
SceneCamera();
|
||||
};
|
||||
namespace BarinkEngine {
|
||||
class SceneCamera : public Group
|
||||
{
|
||||
public:
|
||||
Camera& camera;
|
||||
SceneCamera();
|
||||
};
|
||||
|
||||
|
||||
class SceneObject : public Group
|
||||
{
|
||||
public:
|
||||
Renderable& renderable;
|
||||
SceneObject();
|
||||
|
||||
|
||||
};
|
||||
|
||||
class SceneObject : public Group
|
||||
{
|
||||
public:
|
||||
SceneObject(std::string name, Renderable* visual);
|
||||
~SceneObject();
|
||||
Renderable* renderable;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user