Cogs.Core
Source
Systems
Core
EnvironmentSystem.cpp
1
#include <algorithm>
2
#include "EnvironmentSystem.h"
3
#include "Resources/TextureManager.h"
4
5
namespace
{
6
using namespace
Cogs::Core
;
7
8
void
updateLod(
unsigned
& lods,
TextureHandle
tex)
9
{
10
if
(tex) {
11
if
((tex->description.flags &
Cogs::TextureFlags::GenerateMipMaps
) != 0) {
12
lods = 1 +
static_cast<
uint32_t
>
(std::floor(std::log2((
double
)std::max(tex->description.width, tex->description.height))));
13
}
14
else
{
15
lods = tex->description.levels;
16
}
17
}
18
}
19
20
21
}
22
23
void
Cogs::Core::EnvironmentSystem::update
(
Context
*
/*context*/
)
24
{
25
for
(
auto
& envComp :
pool
) {
26
auto
& envData = getData(&envComp);
27
28
updateLod(envData.radianceLods, envComp.radiance);
29
updateLod(envData.irradianceLods, envComp.irradiance);
30
updateLod(envData.ambientIrradianceLods, envComp.ambientIrradiance);
31
}
32
}
Cogs::Core::ComponentSystemBase::update
void update()
Updates the system state to that of the current frame.
Definition:
ComponentSystem.h:65
Cogs::Core::ComponentSystem::pool
ComponentPool< ComponentType > pool
Pool of components managed by the system.
Definition:
ComponentSystem.h:235
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Definition:
ComponentFunctions.h:10
Cogs::Core::ResourceHandle_t< Texture >
Cogs::TextureFlags::GenerateMipMaps
@ GenerateMipMaps
The texture supports automatic mipmap generation performed by the graphics device.
Definition:
Flags.h:124
Generated by
1.9.6