TESTSKYBOX: new test application for the Skybox class

Martin Gerhardy 2019-11-26 18:39:11 +01:00
parent 58d8fefea9
commit aa88152251
10 changed files with 94 additions and 0 deletions

BIN
data/testskybox/test_bk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
data/testskybox/test_dn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
data/testskybox/test_ft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
data/testskybox/test_lf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
data/testskybox/test_rt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
data/testskybox/test_up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -16,4 +16,5 @@ add_subdirectory(testvoxelfont)
add_subdirectory(testvoxelgpu)
add_subdirectory(testcomputetexture3d)
add_subdirectory(testtraze)
add_subdirectory(testskybox)
#add_subdirectory(testtemplate)

View File

@ -0,0 +1,15 @@
project(testskybox)
set(SRCS
TestSkybox.h TestSkybox.cpp
)
set(FILES
testskybox/test_bk.png
testskybox/test_dn.png
testskybox/test_ft.png
testskybox/test_lf.png
testskybox/test_rt.png
testskybox/test_up.png
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} WINDOWED NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES testcore)

View File

@ -0,0 +1,51 @@
/**
* @file
*/
#include "TestSkybox.h"
#include "core/io/Filesystem.h"
TestSkybox::TestSkybox(const metric::MetricPtr& metric, const io::FilesystemPtr& filesystem,
const core::EventBusPtr& eventBus, const core::TimeProviderPtr& timeProvider) :
Super(metric, filesystem, eventBus, timeProvider) {
init(ORGANISATION, "testskybox");
}
core::AppState TestSkybox::onConstruct() {
core::AppState state = Super::onConstruct();
_skyboxVar = core::Var::get("skybox", "bluecloud");
return state;
}
core::AppState TestSkybox::onInit() {
core::AppState state = Super::onInit();
if (state != core::AppState::Running) {
return state;
}
_camera.setPosition(glm::backward);
_camera.lookAt(glm::forward);
if (!_skybox.init(_skyboxVar->strVal().c_str())) {
Log::error("Failed to initialize the skybox");
return core::AppState::InitFailure;
}
return state;
}
core::AppState TestSkybox::onCleanup() {
core::AppState state = Super::onCleanup();
_skybox.shutdown();
return state;
}
void TestSkybox::doRender() {
if (_skyboxVar->isDirty()) {
_skybox.shutdown();
_skybox.init(_skyboxVar->strVal().c_str());
_skyboxVar->markClean();
}
_skybox.render(_camera);
}
TEST_APP(TestSkybox)

View File

@ -0,0 +1,27 @@
/**
* @file
*/
#pragma once
#include "testcore/TestApp.h"
#include "render/Skybox.h"
#include "core/Var.h"
/**
* https://learnopengl.com/Advanced-OpenGL/Cubemaps
*/
class TestSkybox: public TestApp {
private:
using Super = TestApp;
render::Skybox _skybox;
core::VarPtr _skyboxVar;
void doRender() override;
public:
TestSkybox(const metric::MetricPtr& metric, const io::FilesystemPtr& filesystem, const core::EventBusPtr& eventBus, const core::TimeProviderPtr& timeProvider);
virtual core::AppState onConstruct() override;
virtual core::AppState onInit() override;
virtual core::AppState onCleanup() override;
};