summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine/lightman.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-26 23:18:57 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-26 23:18:57 +0200
commit80d3a9bff1d5999ec5504b50103be7687672227a (patch)
tree70a695f4304d1ac10d391b7e5c0c641ff7fc05b5 /src/graphics/engine/lightman.h
parent2fa4d7b0db88abcccbda287af10fc336a8dbb910 (diff)
downloadcolobot-80d3a9bff1d5999ec5504b50103be7687672227a.tar.gz
colobot-80d3a9bff1d5999ec5504b50103be7687672227a.tar.bz2
colobot-80d3a9bff1d5999ec5504b50103be7687672227a.zip
Lighting fix (experimental)
- changed fixed light allocation to prioritized per-use basis - minor refactoring in CPlanet and CWater
Diffstat (limited to 'src/graphics/engine/lightman.h')
-rw-r--r--src/graphics/engine/lightman.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/graphics/engine/lightman.h b/src/graphics/engine/lightman.h
index c50d176..3b96e51 100644
--- a/src/graphics/engine/lightman.h
+++ b/src/graphics/engine/lightman.h
@@ -65,6 +65,16 @@ struct LightProgression
};
/**
+ * \enum LightPriority
+ * \brief Priority in light assignment
+ */
+enum LightPriority
+{
+ LIGHT_PRI_HIGH,
+ LIGHT_PRI_LOW
+};
+
+/**
\struct DynamicLight
\brief Dynamic light in 3D scene
@@ -77,6 +87,9 @@ struct DynamicLight
//! Whether the light is turned on
bool enabled;
+ //! Priority in assignment
+ LightPriority priority;
+
//! Configuration of the light
Light light;
@@ -123,7 +136,7 @@ public:
//! Clears and disables all lights
void FlushLights();
//! Creates a new dynamic light and returns its index (lightRank)
- int CreateLight();
+ int CreateLight(LightPriority priority = LIGHT_PRI_LOW);
//! Deletes and disables the given dynamic light
bool DeleteLight(int lightRank);
//! Sets the light parameters for dynamic light
@@ -161,7 +174,7 @@ public:
//! Sets the destination color for dynamic light's color progression
bool SetLightColor(int lightRank, const Color &color);
//! Returns current light color
- Color GetLightColor(int lightRank);
+ Color GetLightColor(int lightRank);
//! Sets the rate of change for dynamic light colors (RGB)
bool SetLightColorSpeed(int lightRank, float speed);
@@ -170,7 +183,7 @@ public:
//! Updates (recalculates) all dynamic lights
void UpdateLights();
//! Enables or disables dynamic lights affecting the given object type
- void UpdateLightsEnableState(EngineObjectType type);
+ void UpdateDeviceLights(EngineObjectType type);
protected:
CInstanceManager* m_iMan;
@@ -181,6 +194,8 @@ protected:
float m_time;
//! List of dynamic lights
std::vector<DynamicLight> m_dynLights;
+ //! Map of current light allotment: graphics light -> dynamic light
+ std::vector<int> m_lightMap;
};
}; // namespace Gfx