mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +00:00
STARK: Add support for negative lights
This commit is contained in:
parent
d4a890a36e
commit
5f2f1927c4
@ -39,7 +39,8 @@ Light::Light(Object *parent, byte subType, uint16 index, const Common::String &n
|
||||
_innerConeAngle(0),
|
||||
_falloffNear(100.0),
|
||||
_falloffFar(500.0),
|
||||
_lightEntry(nullptr) {
|
||||
_lightEntry(nullptr),
|
||||
_multiplier(1.0) {
|
||||
_type = TYPE;
|
||||
}
|
||||
|
||||
@ -67,7 +68,8 @@ void Light::onPostRead() {
|
||||
_lightEntry->falloffNear = _falloffNear;
|
||||
_lightEntry->falloffFar = _falloffFar;
|
||||
|
||||
// TODO: Add support for negative lights
|
||||
// Negative lights add darkness
|
||||
_multiplier = _name.hasPrefix("x_neg") ? -1.0 : 1.0;
|
||||
}
|
||||
|
||||
void Light::saveLoad(ResourceSerializer *serializer) {
|
||||
@ -88,7 +90,7 @@ void Light::setPosition(const Math::Vector3d &position) {
|
||||
}
|
||||
|
||||
Gfx::LightEntry *Light::getLightEntry() {
|
||||
_lightEntry->color = _color;
|
||||
_lightEntry->color = _multiplier * _color;
|
||||
_lightEntry->position = _position;
|
||||
|
||||
return _lightEntry;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
static const Type::ResourceType TYPE = Type::kLight;
|
||||
|
||||
Light(Object *parent, byte subType, uint16 index, const Common::String &name);
|
||||
virtual ~Light();
|
||||
~Light() override;
|
||||
|
||||
// Resource API
|
||||
void readData(Formats::XRCReadStream *stream) override;
|
||||
@ -75,6 +75,7 @@ protected:
|
||||
float _outerConeAngle;
|
||||
float _falloffNear;
|
||||
float _falloffFar;
|
||||
float _multiplier;
|
||||
|
||||
Gfx::LightEntry *_lightEntry;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user