Plasma Engine  2.0
Loading...
Searching...
No Matches
VolumeSampler.h
1#pragma once
2
3#include <Core/World/SpatialData.h>
4#include <Foundation/Types/Variant.h>
5#include <GameEngine/GameEngineDLL.h>
6
8class PL_GAMEENGINE_DLL plVolumeSampler
9{
10public:
13
14 void RegisterValue(plHashedString sName, plVariant defaultValue, plTime interpolationDuration = plTime::MakeZero());
15 void DeregisterValue(plHashedString sName);
16 void DeregisterAllValues();
17
18 void SampleAtPosition(const plWorld& world, plSpatialData::Category spatialCategory, const plVec3& vGlobalPosition, plTime deltaTime);
19
20 plVariant GetValue(plTempHashedString sName) const
21 {
22 if (const Value* pValue = m_Values.GetValue(sName))
23 {
24 return pValue->m_CurrentValue;
25 }
26
27 return plVariant();
28 }
29
30 static plUInt32 ComputeSortingKey(float fSortOrder, float fMaxScale);
31
32private:
33 struct Value
34 {
35 plVariant m_DefaultValue;
36 plVariant m_TargetValue;
37 plVariant m_CurrentValue;
38 double m_fInterpolationFactor = -1.0;
39 };
40
42};
Definition HashTable.h:333
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
A class to use together with plHashedString for quick comparisons with temporary strings that need no...
Definition HashedString.h:151
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
A volume sampler is used to sample the registered values from volumes at a given position....
Definition VolumeSampler.h:9
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Definition SpatialData.h:27
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42