Add simple sky scene to example
This commit is contained in:
parent
4a46786db0
commit
7d0d81c385
2 changed files with 26 additions and 2 deletions
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class ExampleApp : public prism::app {
|
class ExampleApp : public prism::app {
|
||||||
public:
|
public:
|
||||||
|
void initialize_render() override;
|
||||||
};
|
};
|
|
@ -1,5 +1,29 @@
|
||||||
#include "example.hpp"
|
#include "example.hpp"
|
||||||
|
|
||||||
void app_main(prism::engine* engine) {
|
#include "platform.hpp"
|
||||||
|
#include "file.hpp"
|
||||||
|
#include "engine.hpp"
|
||||||
|
#include "scene.hpp"
|
||||||
|
|
||||||
|
void app_main(prism::engine* engine) {
|
||||||
|
file::set_domain_path(file::Domain::App, "data");
|
||||||
|
file::set_domain_path(file::Domain::Internal, "{resource_dir}/shaders");
|
||||||
|
|
||||||
|
platform::open_window("Example", {0, 0, 1280, 720}, WindowFlags::None);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExampleApp::initialize_render() {
|
||||||
|
engine->create_empty_scene();
|
||||||
|
auto scene = engine->get_scene();
|
||||||
|
|
||||||
|
auto camera_obj = scene->add_object();
|
||||||
|
auto& camera = scene->add<Camera>(camera_obj);
|
||||||
|
auto& camera_trans = scene->get<Transform>(camera_obj);
|
||||||
|
camera_trans.position.z = -3;
|
||||||
|
|
||||||
|
auto sun_obj = scene->add_object();
|
||||||
|
auto& sun = scene->add<Light>(sun_obj);
|
||||||
|
sun.type = Light::Type::Sun;
|
||||||
|
auto& sun_trans = scene->get<Transform>(sun_obj);
|
||||||
|
sun_trans.position = {5, 5, 5};
|
||||||
}
|
}
|
Reference in a new issue