MCPcopy Create free account
hub / github.com/KTStephano/StratusGFX / Bathroom

Class Bathroom

Examples/ExampleEnv06/Bathroom.cpp:25–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "FrameRateController.h"
24
25class Bathroom : public stratus::Application {
26public:
27 virtual ~Bathroom() = default;
28
29 const char * GetAppName() const override {
30 return "Bathroom";
31 }
32
33 void PrintNodeHierarchy(const stratus::EntityPtr& p, const std::string& name, const std::string& prefix) {
34 auto rc = stratus::GetComponent<stratus::RenderComponent>(p);
35 std::cout << prefix << name << "{Meshes: " << (rc ? rc->GetMeshCount() : 0) << "}" << std::endl;
36 if (rc) {
37 for (size_t i = 0; i < rc->GetMeshCount(); ++i) {
38 std::cout << rc->GetMeshTransform(i) << std::endl;
39 }
40 }
41 for (auto& c : p->GetChildNodes()) {
42 PrintNodeHierarchy(c, name, prefix + "-> ");
43 }
44 }
45
46 // Perform first-time initialization - true if success, false otherwise
47 virtual bool Initialize() override {
48 STRATUS_LOG << "Initializing " << GetAppName() << std::endl;
49
50 LightCreator::Initialize();
51
52 stratus::InputHandlerPtr controller(new CameraController());
53 INSTANCE(InputManager)->AddInputHandler(controller);
54
55 const glm::vec3 warmMorningColor = glm::vec3(254.0f / 255.0f, 232.0f / 255.0f, 176.0f / 255.0f);
56 const glm::vec3 defaultSunColor = glm::vec3(79.0f / 255.0f, 105.0f / 255.0f, 136.0f / 255.0f);
57 auto wc = new WorldLightController(defaultSunColor, defaultSunColor, 10);
58 wc->SetRotation(stratus::Rotation(stratus::Degrees(21.0479f), stratus::Degrees(10.0f), stratus::Degrees(0)));
59 controller = stratus::InputHandlerPtr(wc);
60 INSTANCE(InputManager)->AddInputHandler(controller);
61
62 controller = stratus::InputHandlerPtr(new FrameRateController());
63 INSTANCE(InputManager)->AddInputHandler(controller);
64
65 INSTANCE(RendererFrontend)->GetWorldLight()->SetAlphaTest(false);
66 INSTANCE(RendererFrontend)->GetWorldLight()->SetNumAtmosphericSamplesPerPixel(256);
67
68 //const glm::vec3 warmMorningColor = glm::vec3(254.0f / 255.0f, 232.0f / 255.0f, 176.0f / 255.0f);
69 //controller = stratus::InputHandlerPtr(new WorldLightController(warmMorningColor));
70 //INSTANCE(InputManager)->AddInputHandler(controller);
71
72 // Disable culling for this model since there are some weird parts that seem to be reversed
73 stratus::Async<stratus::Entity> e = stratus::ResourceManager::Instance()->LoadModel("../Resources/Bathroom/scene.gltf", stratus::ColorSpace::SRGB, true, stratus::RenderFaceCulling::CULLING_NONE);
74 e.AddCallback([this](stratus::Async<stratus::Entity> e) {
75 if (e.Failed()) return;
76 bathroom = e.GetPtr();
77 auto transform = stratus::GetComponent<stratus::LocalTransformComponent>(bathroom);
78 //transform->SetLocalPosition(glm::vec3(0.0f));
79 transform->SetLocalScale(glm::vec3(10.0f));
80 transform->SetLocalRotation(stratus::Rotation(stratus::Degrees(0.0f), stratus::Degrees(70.0f), stratus::Degrees(0.0f)));
81 INSTANCE(EntityManager)->AddEntity(bathroom);
82 });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected