mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Add scale as a property of every scenegraph node.
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Scale {
|
||||
class Scale : public properties::PropertyOwner {
|
||||
public:
|
||||
static Scale* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
|
||||
@@ -25,24 +25,28 @@
|
||||
#include <modules/base/scale/staticscale.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "StaticScale";
|
||||
const std::string KeyValue = "Scale";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
|
||||
: _scaleValue(1.0)
|
||||
: _scaleValue("scale", "Scale", 1.0, 1.0, 1000.0)
|
||||
{
|
||||
const bool hasValue = dictionary.hasKeyAndValue<glm::vec3>(KeyValue);
|
||||
if (hasValue) {
|
||||
dictionary.getValue(KeyValue, _scaleValue);
|
||||
float value;
|
||||
dictionary.getValue(KeyValue, value);
|
||||
_scaleValue.setValue(value);
|
||||
}
|
||||
Scale::addProperty(_scaleValue);
|
||||
}
|
||||
|
||||
StaticScale::~StaticScale() {}
|
||||
|
||||
double StaticScale::scaleValue() const {
|
||||
return _scaleValue;
|
||||
return _scaleValue.value();
|
||||
}
|
||||
|
||||
void StaticScale::update(const UpdateData&) {}
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace openspace {
|
||||
|
||||
class StaticScale: public Scale {
|
||||
public:
|
||||
StaticScale(const ghoul::Dictionary& dictionary
|
||||
= ghoul::Dictionary());
|
||||
StaticScale(const ghoul::Dictionary& dictionary = ghoul::Dictionary());
|
||||
virtual ~StaticScale();
|
||||
virtual double scaleValue() const;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
private:
|
||||
double _scaleValue;
|
||||
properties::FloatProperty _scaleValue;
|
||||
//double _scaleValue;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -150,6 +150,9 @@ SceneGraphNode* SceneGraphNode::createFromDictionary(const ghoul::Dictionary& di
|
||||
|
||||
//parentNode->addNode(result);
|
||||
|
||||
result->_scale->setName("Transform");
|
||||
result->addPropertySubOwner(result->_scale);
|
||||
|
||||
LDEBUG("Successfully created SceneGraphNode '"
|
||||
<< result->name() << "'");
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user