26 {
27
28
29
30
31 SPrefab* jack = SResource::Create<SPrefab>(
"jack.prefab");
32 SPrefab* plane = SResource::Create<SPrefab>(
"plane_circle.prefab");
33 SPrefab* roomPrefab = SResource::Create<SPrefab>(
"room.prefab");
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
63 root->GetTransform()->m_position =
vec3{0, -1, 0};
64
65 auto room = roomPrefab->Clone(
vec3{0, 0.2f, 0}, root);
66 room->GetTransform()->m_scale =
vec3{ 4.f, 4.f, 4.f };
67 room->GetTransform()->m_rotation.Rotate(Quaternion::AngleAxis(
vec3{0, 1, 0}, 3.14f / 2));
68
69 const auto& room_children = room->GetChildren();
70 for (const auto& gameObject : room_children) {
72 if(component == nullptr) continue;
73 component->SetMaterial(SResource::Create<SMaterial>("File:Material/Room.mat"));
74 }
75
76
78 b->SetParent(root);
80 d->SetParent(root);
81
82
83
84 cube =
new MeshSurface(CH02::teapot_smoothNumVerts, CH02::teapot_smoothVerts, CH02::teapot_smoothNormals);
85 cube->SetUndestroyable(false);
89 buf_tex->SetName("framebuffer_test");
90 buf_tex->SetAbsoluteID("framebuffer_test");
93
95 root->AddChild(testing);
96
98 camera_gm->SetParent(testing);
99 camera_gm->GetTransform()->m_position =
vec3{ 0, -0.3f, 0 };
100 {
102 sc->SetClassName("testScript.script");
103 }
104
106 light_gm->SetParent(testing);
107 light_gm->GetTransform()->m_scale =
vec3{ 0.2f, 0.2f, 0.2f };
108 {
110 sc->SetClassName("testScriptFast.script");
111 }
112
114 a->SetParent(camera_gm);
115
118 ab->GetTransform()->m_scale =
vec3{ 0.0002f, 0.0002f, 0.0002f };
119 ab2->GetTransform()->m_scale =
vec3{ 0.0002f, 0.0002f, 0.0002f };
120 ab2->GetTransform()->m_rotation.Rotate(Quaternion::AngleAxis(
vec3{1, 0, 0}, 3.14f / 2));
121 ab2->GetTransform()->m_rotation.Rotate(Quaternion::AngleAxis(
vec3{0, 1, 0}, 1.f));
122
123
124
125 {
126 const auto& ab_children = ab->GetChildren();
127 for (const auto& gameObject : ab_children) {
129 if (component == nullptr) continue;
130 if(gameObject->GetName() == "Mesh-mesh") {
131 const auto& material = SResource::Create<SMaterial>("File:Material/Jack.mat");
132 material->SetOrderLayer(5500);
133 component->SetMaterial(material);
134 }
135 else {
136 const auto& material = SResource::Create<SMaterial>("File:Material/Label.mat");
137 component->SetMaterial(material);
138 }
139 }
140 }
141 {
142 const auto& ab_children = ab2->GetChildren();
143 for (const auto& gameObject : ab_children) {
145 if (component == nullptr) continue;
146 if(gameObject->GetName() == "Mesh-mesh") {
147 const auto& material = SResource::Create<SMaterial>("File:Material/Jack.mat");
148 material->SetOrderLayer(5500);
149 component->SetMaterial(material);
150 }
151 else {
152 const auto& material = SResource::Create<SMaterial>("File:Material/Label.mat");
153 component->SetMaterial(material);
154 }
155 }
156 }
157
159 c2->SetParent(testing);
160
163
164
165 c2->GetTransform()->m_position =
vec3{ -0.2f, -0.3f, -0.2f };
166 c2->GetTransform()->m_scale =
vec3{ 0.5f, 0.5f, 0.5f };
167 {
169 const auto& material = SResource::Create<SMaterial>("File:Material/SSS_PBR.mat");
170 material->SetOrderLayer(6000);
171 render->SetMaterial(material);
172 }
173
174
176 c3->SetParent(root);
177 c3->GetTransform()->m_position.y = -0.7f;
178
180 c3->GetComponent<
CustomComponent>()->SetClassName(
"testScript2.script");
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197 auto c4 = SCloneFactory::Clone(c3, c3);
198
199
200 c4->GetTransform()->m_position.y = -0.1f;
201 c4->GetTransform()->m_position.x = -2.f;
202 c4->GetTransform()->m_scale.Set(0.5, 0.5, 0.5);
204
205
207 direction->SetParent(root);
208 direction->SetName("directional");
209 direction->GetTransform()->m_position =
vec3{ 0.f, 1.f, 0.f };
211
212
214 direction->GetComponent<
LightComponent>()->SetLightType(LightComponent::DIRECTIONAL);
217
219 direction->GetComponent<
CustomComponent>()->SetClassName(
"directionalLight.script");
220
221
222
223
224
225
226 d->SetName("light");
228 d->GetTransform()->m_position =
vec3{ -2.8f, -1.5f, 0 };
229 light_gm->AddChild(d);
232 d->GetComponent<
LightComponent>()->SetLightType(LightComponent::POINT);
235
236
237
238
239
240
241
242
243
244
245
246
248
249
250 a->GetTransform()->m_position =
vec3{ 0, 0.2f, 0.8f };
251
252
253
255 a_cam->SetTarget(camera_gm);
256 a_cam->SetBackgroundSkybox();
257 a_cam->SetBackgroundType(CameraBase::SKYBOX);
258
259
260
264 c4->GetComponent<
CameraComponent>()->SetBackgroundType(CameraBase::SKYBOX);
266 SResource::Create<SFrameBuffer>("File:Texture/TestFrameBuffer.framebuffer"));
267
268
269 SSceneLoader::SavePrefab(root, CSE::NativeAssetsPath() + "Scene/test_scene.scene");
270}
STexture * GenerateTexturebuffer(BufferType type, int channel, int level=0)
void RasterizeFramebuffer()
void GenerateFramebuffer(BufferDimension dimension, int width, int height)
void Destroy() override
자동 삭제가 아닌 특정한 상황에서 삭제될 때 호출되는 함수