add sponza
This commit is contained in:
702666
res/sponza.obj
Normal file
702666
res/sponza.obj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,20 @@
|
||||
#include "hart_module.hpp"
|
||||
|
||||
using namespace inferno;
|
||||
|
||||
HHM::HHM()
|
||||
: mDirectory()
|
||||
{
|
||||
mDirectory.discoverModules("./hart/", true);
|
||||
}
|
||||
|
||||
HHM::~HHM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HARTModuleDirectory* HHM::getModuleDirectory()
|
||||
{
|
||||
return &mDirectory;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// the HHM (Hamlin Hamlin McGill) aka the Head HART Module keeps track of the module
|
||||
// and gives the renderer a cleaner interface to talk to a HART Module
|
||||
|
||||
#include "hart_directory.hpp"
|
||||
|
||||
namespace inferno {
|
||||
|
||||
class Scene;
|
||||
@@ -18,6 +20,8 @@ public:
|
||||
HHM();
|
||||
~HHM();
|
||||
|
||||
HARTModuleDirectory* getModuleDirectory();
|
||||
|
||||
// needs to syncronusly stop the module's execution and
|
||||
// prepare for setting up a new HART layer
|
||||
void notifyModuleChange(HARTModule* newModule);
|
||||
@@ -30,6 +34,9 @@ public:
|
||||
void rayReturn(HitInfo* hit);
|
||||
void bounce(Ray* newRay);
|
||||
|
||||
private:
|
||||
HARTModuleDirectory mDirectory;
|
||||
|
||||
private:
|
||||
HARTModule* activeModule;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "gui/layout.hpp"
|
||||
#include "window.hpp"
|
||||
|
||||
#include "hart_module.hpp"
|
||||
#include "hart_directory.hpp"
|
||||
|
||||
#include "preview_renderer/renderer.hpp"
|
||||
@@ -36,6 +37,7 @@ Inferno::Inferno()
|
||||
mRasterRenderer = new RasterizeRenderer();
|
||||
mRayRenderer = new RayRenderer();
|
||||
mScene = new Scene();
|
||||
mHeadHartModule = new HHM();
|
||||
}
|
||||
|
||||
Inferno::~Inferno()
|
||||
@@ -123,16 +125,13 @@ void Inferno::stopMoveInput()
|
||||
|
||||
int Inferno::run()
|
||||
{
|
||||
HARTModuleDirectory moduleDirectory;
|
||||
moduleDirectory.discoverModules("./hart/", true);
|
||||
|
||||
Material basicMaterial("basic");
|
||||
Shader basicShader;
|
||||
basicShader.load("res/shaders/basic.glsl")->link();
|
||||
basicMaterial.setGlShader(&basicShader);
|
||||
|
||||
Mesh cornell;
|
||||
cornell.loadOBJ("res/cornell-box.obj");
|
||||
cornell.loadOBJ("res/sponza.obj");
|
||||
cornell.ready();
|
||||
cornell.setMaterial(&basicMaterial);
|
||||
mScene->addMesh(&cornell);
|
||||
@@ -226,20 +225,20 @@ int Inferno::run()
|
||||
ImGui::Text("Select Accelerator:");
|
||||
if (ImGui::BeginListBox("", ImVec2(-FLT_MIN, 3 * ImGui::GetTextLineHeightWithSpacing())))
|
||||
{
|
||||
std::vector<std::string> moduleNames = moduleDirectory.getModules();
|
||||
int active = moduleDirectory.getActiveIndex();
|
||||
std::vector<std::string> moduleNames = mHeadHartModule->getModuleDirectory()->getModules();
|
||||
int active = mHeadHartModule->getModuleDirectory()->getActiveIndex();
|
||||
for (int n = 0; n < moduleNames.size(); n++)
|
||||
{
|
||||
const bool isSelected = (active == n);
|
||||
if (ImGui::Selectable(moduleNames[n].c_str(), isSelected))
|
||||
moduleDirectory.setActiveIndex(n);
|
||||
mHeadHartModule->getModuleDirectory()->setActiveIndex(n);
|
||||
if (isSelected)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
auto* activeCredit = moduleDirectory.getActiveCredit();
|
||||
ImGui::Text(moduleDirectory.getActive().c_str());
|
||||
auto* activeCredit = mHeadHartModule->getModuleDirectory()->getActiveCredit();
|
||||
ImGui::Text(activeCredit->ModuleName.c_str());
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("v%i.%i.%i", activeCredit->VersionMajor,
|
||||
activeCredit->VersionMinor,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
namespace inferno {
|
||||
|
||||
class Window;
|
||||
class HHM;
|
||||
|
||||
class RasterizeRenderer;
|
||||
class RayRenderer;
|
||||
@@ -31,10 +32,14 @@ public:
|
||||
uint8_t movementDelta;
|
||||
|
||||
private:
|
||||
// need deffered init as they need an OpenGL context
|
||||
// could and should be fixed with a static window
|
||||
RasterizeRenderer* mRasterRenderer;
|
||||
RayRenderer* mRayRenderer;
|
||||
Scene* mScene;
|
||||
|
||||
HHM* mHeadHartModule;
|
||||
|
||||
private:
|
||||
Window* mWin;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user