mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
STARK: Add a light resource
This commit is contained in:
parent
3e4a4646d9
commit
603c6cabba
@ -40,6 +40,7 @@
|
||||
#include "engines/stark/resources/knowledgeset.h"
|
||||
#include "engines/stark/resources/layer.h"
|
||||
#include "engines/stark/resources/level.h"
|
||||
#include "engines/stark/resources/light.h"
|
||||
#include "engines/stark/resources/location.h"
|
||||
#include "engines/stark/resources/object.h"
|
||||
#include "engines/stark/resources/root.h"
|
||||
@ -248,6 +249,9 @@ Resources::Object *XRCReader::createResource(XRCReadStream *stream, Resources::O
|
||||
case Resources::Type::kSpeech:
|
||||
resource = new Resources::Speech(parent, subType, index, name);
|
||||
break;
|
||||
case Resources::Type::kLight:
|
||||
resource = new Resources::Light(parent, subType, index, name);
|
||||
break;
|
||||
case Resources::Type::kBonesMesh:
|
||||
resource = new Resources::BonesMesh(parent, subType, index, name);
|
||||
break;
|
||||
|
@ -32,6 +32,7 @@ MODULE_OBJS := \
|
||||
resources/knowledgeset.o \
|
||||
resources/layer.o \
|
||||
resources/level.o \
|
||||
resources/light.o \
|
||||
resources/location.o \
|
||||
resources/object.o \
|
||||
resources/root.o \
|
||||
|
67
engines/stark/resources/light.cpp
Normal file
67
engines/stark/resources/light.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/stark/resources/light.h"
|
||||
|
||||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Light::~Light() {
|
||||
}
|
||||
|
||||
Light::Light(Object *parent, byte subType, uint16 index, const Common::String &name) :
|
||||
Object(parent, subType, index, name),
|
||||
_outerConeAngle(0),
|
||||
_innerConeAngle(0),
|
||||
_falloffNear(100.0),
|
||||
_falloffFar(500.0) {
|
||||
_type = TYPE;
|
||||
}
|
||||
|
||||
void Light::readData(Formats::XRCReadStream *stream) {
|
||||
_color = stream->readVector3();
|
||||
_position = stream->readVector3();
|
||||
_direction = stream->readVector3();
|
||||
_outerConeAngle = stream->readFloat();
|
||||
_innerConeAngle = stream->readFloat();
|
||||
|
||||
if (stream->isDataLeft()) {
|
||||
_falloffNear = stream->readFloat();
|
||||
_falloffFar = stream->readFloat();
|
||||
}
|
||||
}
|
||||
|
||||
void Light::printData() {
|
||||
Common::Debug debug = streamDbg();
|
||||
debug << "color: " << _color << "\n";
|
||||
debug << "position: " << _position << "\n";
|
||||
debug << "direction: " << _direction << "\n";
|
||||
debug << "innerConeAngle: " << _innerConeAngle << "\n";
|
||||
debug << "outerConeAngle: " << _outerConeAngle << "\n";
|
||||
debug << "falloffNear: " << _falloffNear << "\n";
|
||||
debug << "falloffFar: " << _falloffFar << "\n";
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
75
engines/stark/resources/light.h
Normal file
75
engines/stark/resources/light.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STARK_RESOURCES_LIGHT_H
|
||||
#define STARK_RESOURCES_LIGHT_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
#include "math/vector3d.h"
|
||||
|
||||
#include "engines/stark/resources/object.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
namespace Formats {
|
||||
class XRCReadStream;
|
||||
}
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A light source
|
||||
*/
|
||||
class Light : public Object {
|
||||
public:
|
||||
static const Type::ResourceType TYPE = Type::kLight;
|
||||
|
||||
enum SubType {
|
||||
kAmbiant = 0,
|
||||
kPoint = 1,
|
||||
kDirectional = 2,
|
||||
kSpot = 4
|
||||
};
|
||||
|
||||
Light(Object *parent, byte subType, uint16 index, const Common::String &name);
|
||||
virtual ~Light();
|
||||
|
||||
// Resource API
|
||||
void readData(Formats::XRCReadStream *stream) override;
|
||||
|
||||
protected:
|
||||
void printData() override;
|
||||
|
||||
Math::Vector3d _color;
|
||||
Math::Vector3d _position;
|
||||
Math::Vector3d _direction;
|
||||
float _innerConeAngle;
|
||||
float _outerConeAngle;
|
||||
float _falloffNear;
|
||||
float _falloffFar;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_LIGHT_H
|
Loading…
x
Reference in New Issue
Block a user