CSEngine
Loading...
Searching...
No Matches
WebDemoScene Class Reference
Inheritance diagram for WebDemoScene:
CSE::Scene CSE::SObject

Public Member Functions

void Init () override
 
void Tick (float elapsedTime) override
 
void Destroy () override
 
- Public Member Functions inherited from CSE::Scene
void Exterminate () override
 
- Public Member Functions inherited from CSE::SObject
 SObject (bool isRegister)
 
virtual void SetUndestroyable (bool enable)
 
virtual void __FORCE_DESTROY__ ()
 
virtual std::string GenerateMeta ()
 
std::string GetHash () const
 
virtual void SetHash (std::string &hash)
 

Additional Inherited Members

- Public Attributes inherited from CSE::Scene
std::string m_name
 
- Static Protected Member Functions inherited from CSE::Scene
static void SetScene (Scene *scene)
 
- Protected Attributes inherited from CSE::SObject
std::string m_hash
 

Detailed Description

Definition at line 6 of file WebDemoScene.h.

Member Function Documentation

◆ Destroy()

void WebDemoScene::Destroy ( )
overridevirtual

Implements CSE::Scene.

Definition at line 49 of file WebDemoScene.cpp.

49 {
50
51}

◆ Init()

void WebDemoScene::Init ( )
overridevirtual

Implements CSE::Scene.

Definition at line 13 of file WebDemoScene.cpp.

13 {
14// SPrefab* stormtrooper = SResource::Create<SPrefab>("stormtrooper.prefab");
15 SPrefab* stormtrooper = SResource::Create<SPrefab>("model.prefab");
16
17 auto root = new SGameObject("root");
18 auto ab = stormtrooper->Clone(vec3{ 0, -0.3f, 0 }, root);
19// ab->GetTransform()->m_scale = vec3{ 0.2f, 0.2f, 0.2f };
20 ab->GetTransform()->m_scale = vec3{ 0.08f, 0.08f, 0.08f };
21 ab->GetTransform()->m_rotation = Quaternion::AngleAxis(vec3{1, 0, 0}, Pi/2.f);
22 ab->CreateComponent<CustomComponent>();
23 ab->GetComponent<CustomComponent>()->SetClassName("Stormtrooper.script");
24
25 auto camera = new SGameObject("camera");
26 const auto& camera_comp = camera->CreateComponent<CameraComponent>();
27 camera->GetTransform()->m_position = vec3{0, 0, 1.2f };
28 camera_comp->SetBackgroundSkybox();
29 camera_comp->SetBackgroundType(CameraBase::SKYBOX);
30
31 SGameObject* direction = new SGameObject();
32 direction->SetParent(root);
33 direction->SetName("directional");
34 direction->GetTransform()->m_position = vec3{ 0.f, 0.5f, 0.f };
35 direction->CreateComponent<LightComponent>();
36 direction->GetComponent<LightComponent>()->SetSunrising(true);
37 direction->GetComponent<LightComponent>()->SetLightType(LightComponent::DIRECTIONAL);
38 direction->GetComponent<LightComponent>()->SetDirection(vec4{ 0.0f, 1.0f, 1, 0 });
39 direction->GetComponent<LightComponent>()->SetShadow(true);
40
41// auto a_cam = camera->GetComponent<CameraComponent>();
42// a_cam->SetTarget(ab);
43}

◆ Tick()

void WebDemoScene::Tick ( float  elapsedTime)
overridevirtual

Implements CSE::Scene.

Definition at line 45 of file WebDemoScene.cpp.

45 {
46
47}

The documentation for this class was generated from the following files: