MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetProbeData

Method SetProbeData

Source/Engine/Level/Actors/SkyLight.cpp:55–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void SkyLight::SetProbeData(TextureData& data)
56{
57 // Validate input data
58 ASSERT(data.GetArraySize() == 6);
59
60 // Check if was using custom probe
61 if (Mode == Modes::CustomTexture)
62 {
63 // Set
64 Mode = Modes::CaptureScene;
65 _bakedProbe = nullptr;
66 }
67
68 Guid id = Guid::New();
69
70#if COMPILE_WITH_ASSETS_IMPORTER
71 // Create asset file
72 const String path = GetScene()->GetDataFolderPath() / TEXT("SkyLights/") / GetID().ToString(Guid::FormatType::N) + ASSET_FILES_EXTENSION_WITH_DOT;
73 AssetInfo info;
74 if (FileSystem::FileExists(path) && Content::GetAssetInfo(path, info))
75 id = info.ID;
76 if (AssetsImportingManager::Create(AssetsImportingManager::CreateCubeTextureTag, path, id, &data))
77 {
78 LOG(Error, "Cannot import generated sky light!");
79 return;
80 }
81#else
82 // TODO: create or reuse virtual texture and use it
83 LOG(Error, "Changing probes at runtime in game is not supported.");
84 return;
85#endif
86
87 // Check if has loaded probe and it has different ID
88 if (_bakedProbe && _bakedProbe->GetID() != id)
89 {
90 const auto prevId = _bakedProbe->GetID();
91 _bakedProbe = nullptr;
92 LOG(Warning, "New sku light cube texture has different ID={0} than old one={1}.", id, prevId);
93 }
94
95 // Link probe texture
96 _bakedProbe = Content::LoadAsync<CubeTexture>(id);
97}
98
99void SkyLight::UpdateBounds()
100{

Callers 2

RunMethod · 0.45
OnRenderMethod · 0.45

Calls 8

GetSceneFunction · 0.85
GetIDFunction · 0.85
GetArraySizeMethod · 0.80
GetDataFolderPathMethod · 0.80
GetIDMethod · 0.80
NewFunction · 0.50
CreateFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected