Skip to content

Commit a282bb4

Browse files
author
Ravbug
committed
Load stuff for environment mapping
1 parent 8d4860c commit a282bb4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

RavEngine

Samples/Rendering/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ struct Level : public RavEngine::World {
263263
#endif
264264
}
265265

266+
// environment lighting demo
267+
{
268+
auto shinyMat = RavEngine::New<PBRMaterialInstance>(Material::Manager::Get<PBRMaterial>());
269+
shinyMat->SetMetallicTint(0.9);
270+
shinyMat->SetRoughnessTint(0.1);
271+
shinyMat->SetSpecularTint(0.8);
272+
273+
auto shinyObject = Instantiate<GameObject>();
274+
shinyObject.EmplaceComponent<StaticMesh>(MeshCollectionStaticManager::Get("sphere"), shinyMat);
275+
shinyObject.GetTransform().SetWorldPosition({ -2, 2, 12});
276+
}
277+
266278
// wine glasses
267279
#if ENABLE_TRANSPARENTS
268280
auto wineglassMeshCol = MeshCollectionStaticManager::Get("wineglass");
@@ -309,6 +321,11 @@ struct Level : public RavEngine::World {
309321
auto& ambientLight = lightsEntity.EmplaceComponent<AmbientLight>();
310322
ambientLight.SetIntensity(0.2);
311323
ambientLight.SetIlluminationLayers(~bakedLayer);
324+
auto cubemap = RavEngine::New<CubemapTexture>(512, CubemapTexture::Config{
325+
.enableRenderTarget = true,
326+
.debugName = "Environment map",
327+
});
328+
ambientLight.environment = { skybox, cubemap};
312329

313330

314331
lightsEntity.GetTransform().LocalRotateDelta(vector3{ deg_to_rad(45), deg_to_rad(45),0 });

0 commit comments

Comments
 (0)