mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 08:58:54 -05:00
Merge branch 'master' into feature/space-mouse
* Resolve conflicts
This commit is contained in:
@@ -94,24 +94,6 @@ private:
|
||||
const std::vector<HandlebarTemplate> _handlebarTemplates;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function takes a \p text and escapes all necessary characters () that JSON
|
||||
* does not want in its strings.
|
||||
* \param text The text that is to be escaped
|
||||
* \return The same text will all required characteres escaped
|
||||
*/
|
||||
std::string escapedJson(const std::string& text);
|
||||
|
||||
|
||||
/**
|
||||
* This function takes a \p list of text and escapes all necessary characters () that JSON
|
||||
* does not want in its strings.
|
||||
* \param text The list text that is to be escaped
|
||||
* \return The same text will all required characteres escaped
|
||||
*/
|
||||
std::string escapedJson(const std::vector<std::string>& list);
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___DOCUMENTATIONGENERATOR___H__
|
||||
|
||||
@@ -85,7 +85,7 @@ struct Configuration {
|
||||
bool shouldUseScreenshotDate = false;
|
||||
|
||||
std::string onScreenTextScaling = "window";
|
||||
bool usePerSceneCache = false;
|
||||
bool usePerProfileCache = false;
|
||||
|
||||
bool isRenderingOnMasterDisabled = false;
|
||||
glm::dvec3 globalRotation = glm::dvec3(0.0);
|
||||
|
||||
@@ -31,35 +31,21 @@ namespace openspace::properties {
|
||||
|
||||
class DoubleListProperty : public ListProperty<double> {
|
||||
public:
|
||||
DoubleListProperty(Property::PropertyInfo info);
|
||||
DoubleListProperty(Property::PropertyInfo info, std::vector<double> values);
|
||||
DoubleListProperty(Property::PropertyInfo info,
|
||||
std::vector<double> values = std::vector<double>());
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<std::vector<double>>::operator std::vector<double>;
|
||||
using TemplateProperty<std::vector<double>>::operator=;
|
||||
|
||||
protected:
|
||||
std::vector<double> fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
std::string toStringConversion() const override;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<double>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<double>
|
||||
PropertyDelegate<TemplateProperty<std::vector<double>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<double>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<double>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toString(
|
||||
std::string& outValue, const std::vector<double>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__
|
||||
|
||||
@@ -31,34 +31,21 @@ namespace openspace::properties {
|
||||
|
||||
class IntListProperty : public ListProperty<int> {
|
||||
public:
|
||||
IntListProperty(Property::PropertyInfo info);
|
||||
IntListProperty(Property::PropertyInfo info, std::vector<int> values);
|
||||
IntListProperty(Property::PropertyInfo info,
|
||||
std::vector<int> values = std::vector<int>());
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<std::vector<int>>::operator std::vector<int>;
|
||||
using TemplateProperty<std::vector<int>>::operator=;
|
||||
|
||||
protected:
|
||||
std::vector<int> fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
std::string toStringConversion() const override;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<int>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
|
||||
std::string& outValue, const std::vector<int>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___INTLISTPROPERTY___H__
|
||||
|
||||
@@ -32,35 +32,22 @@ namespace openspace::properties {
|
||||
|
||||
class StringListProperty : public ListProperty<std::string> {
|
||||
public:
|
||||
StringListProperty(Property::PropertyInfo info);
|
||||
StringListProperty(Property::PropertyInfo info, std::vector<std::string> values);
|
||||
StringListProperty(Property::PropertyInfo info,
|
||||
std::vector<std::string> values = std::vector<std::string>());
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<std::vector<std::string>>::operator std::vector<std::string>;
|
||||
using TemplateProperty<std::vector<std::string>>::operator=;
|
||||
|
||||
protected:
|
||||
std::vector<std::string> fromLuaConversion(lua_State* state,
|
||||
bool& success) const override;
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
std::string toStringConversion() const override;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::vector<std::string>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<std::string>
|
||||
PropertyDelegate<TemplateProperty<std::vector<std::string>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toLuaValue(
|
||||
lua_State* state, const std::vector<std::string>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<std::string>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toString(
|
||||
std::string& outValue, const std::vector<std::string>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace openspace::properties {
|
||||
template <typename T>
|
||||
class ListProperty : public TemplateProperty<std::vector<T>> {
|
||||
public:
|
||||
ListProperty(Property::PropertyInfo info);
|
||||
ListProperty(Property::PropertyInfo info, std::vector<T> values);
|
||||
|
||||
virtual ~ListProperty() = 0;
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
template <typename T>
|
||||
ListProperty<T>::ListProperty(Property::PropertyInfo info)
|
||||
: TemplateProperty<std::vector<T>>(std::move(info))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
ListProperty<T>::ListProperty(Property::PropertyInfo info, std::vector<T> values)
|
||||
: TemplateProperty<std::vector<T>>(std::move(info), std::move(values))
|
||||
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat2Property, glm::dmat2x2)
|
||||
class DMat2Property : public NumericalProperty<glm::dmat2x2> {
|
||||
public:
|
||||
DMat2Property(Property::PropertyInfo info, glm::dmat2x2 value = glm::dmat2x2(0.0),
|
||||
glm::dmat2x2 minValue =
|
||||
ghoul::createFillMat2x2<double>(std::numeric_limits<double>::lowest()),
|
||||
glm::dmat2x2 maxValue =
|
||||
ghoul::createFillMat2x2<double>(std::numeric_limits<double>::max()),
|
||||
glm::dmat2x2 stepValue = ghoul::createFillMat2x2<double>(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dmat2x2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dmat2x2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT2X3PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT2X3PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat2x3Property, glm::dmat2x3)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT2X3PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT2X4PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT2X4PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat2x4Property, glm::dmat2x4)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT2X4PROPERTY___H__
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat3Property, glm::dmat3x3)
|
||||
class DMat3Property : public NumericalProperty<glm::dmat3x3> {
|
||||
public:
|
||||
DMat3Property(Property::PropertyInfo info, glm::dmat3x3 value = glm::dmat3x3(0.0),
|
||||
glm::dmat3x3 minValue =
|
||||
ghoul::createFillMat3x3<double>(std::numeric_limits<double>::lowest()),
|
||||
glm::dmat3x3 maxValue =
|
||||
ghoul::createFillMat3x3<double>(std::numeric_limits<double>::max()),
|
||||
glm::dmat3x3 stepValue = ghoul::createFillMat3x3<double>(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dmat3x3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dmat3x3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT3X2PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT3X2PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat3x2Property, glm::dmat3x2)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT3X2PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT3X4PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT3X4PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat3x4Property, glm::dmat3x4)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT3X4PROPERTY___H__
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat4Property, glm::dmat4x4)
|
||||
class DMat4Property : public NumericalProperty<glm::dmat4x4> {
|
||||
public:
|
||||
DMat4Property(Property::PropertyInfo info, glm::dmat4x4 value = glm::dmat4x4(0.0),
|
||||
glm::dmat4x4 minValue =
|
||||
ghoul::createFillMat4x4<double>(std::numeric_limits<double>::lowest()),
|
||||
glm::dmat4x4 maxValue =
|
||||
ghoul::createFillMat4x4<double>(std::numeric_limits<double>::max()),
|
||||
glm::dmat4x4 stepValue = ghoul::createFillMat4x4<double>(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dmat4x4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dmat4x4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT4X2PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT4X2PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat4x2Property, glm::dmat4x2)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT4X2PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___DMAT4X3PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___DMAT4X3PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DMat4x3Property, glm::dmat4x3)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___DMAT4X3PROPERTY___H__
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat2Property, glm::mat2x2)
|
||||
class Mat2Property : public NumericalProperty<glm::mat2x2> {
|
||||
public:
|
||||
Mat2Property(Property::PropertyInfo info, glm::mat2x2 value = glm::mat2x2(0.f),
|
||||
glm::mat2x2 minValue =
|
||||
ghoul::createFillMat2x2<float>(std::numeric_limits<float>::lowest()),
|
||||
glm::mat2x2 maxValue =
|
||||
ghoul::createFillMat2x2<float>(std::numeric_limits<float>::max()),
|
||||
glm::mat2x2 stepValue = ghoul::createFillMat2x2<float>(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::mat2x2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::mat2x2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT2X3PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT2X3PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat2x3Property, glm::mat2x3)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT2X3PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT2X4PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT2X4PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat2x4Property, glm::mat2x4)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT2X4PROPERTY___H__
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat3Property, glm::mat3x3)
|
||||
class Mat3Property : public NumericalProperty<glm::mat3x3> {
|
||||
public:
|
||||
Mat3Property(Property::PropertyInfo info, glm::mat3x3 value = glm::mat3x3(),
|
||||
glm::mat3x3 minValue =
|
||||
ghoul::createFillMat3x3<float>(std::numeric_limits<float>::lowest()),
|
||||
glm::mat3x3 maxValue =
|
||||
ghoul::createFillMat3x3<float>(std::numeric_limits<float>::max()),
|
||||
glm::mat3x3 stepValue = ghoul::createFillMat3x3<float>(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::mat3x3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::mat3x3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT3X2PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT3X2PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat3x2Property, glm::mat3x2)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT3X2PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT3X4PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT3X4PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat3x4Property, glm::mat3x4)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT3X4PROPERTY___H__
|
||||
@@ -28,10 +28,27 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat4Property, glm::mat4x4)
|
||||
class Mat4Property : public NumericalProperty<glm::mat4x4> {
|
||||
public:
|
||||
Mat4Property(Property::PropertyInfo info, glm::mat4x4 value = glm::mat4x4(),
|
||||
glm::mat4x4 minValue =
|
||||
ghoul::createFillMat4x4<float>(std::numeric_limits<float>::lowest()),
|
||||
glm::mat4x4 maxValue =
|
||||
ghoul::createFillMat4x4<float>(std::numeric_limits<float>::max()),
|
||||
glm::mat4x4 stepValue = ghoul::createFillMat4x4<float>(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::mat4x4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::mat4x4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT4X2PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT4X2PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat4x2Property, glm::mat4x2)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT4X2PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___MAT4X3PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___MAT4X3PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Mat4x3Property, glm::mat4x3)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___MAT4X3PROPERTY___H__
|
||||
@@ -32,20 +32,11 @@ namespace openspace::properties {
|
||||
template <typename T>
|
||||
class NumericalProperty : public TemplateProperty<T> {
|
||||
public:
|
||||
NumericalProperty(Property::PropertyInfo info);
|
||||
NumericalProperty(Property::PropertyInfo info, T value);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
|
||||
T maximumValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
|
||||
T maximumValue, T steppingValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
|
||||
T maximumValue, T steppingValue, float exponent);
|
||||
T maximumValue, T steppingValue, float exponent = 1.f);
|
||||
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
int typeLua() const override;
|
||||
|
||||
bool getStringValue(std::string& value) const override;
|
||||
virtual std::string className() const override = 0;
|
||||
virtual int typeLua() const override = 0;
|
||||
|
||||
T minValue() const;
|
||||
void setMinValue(T value);
|
||||
@@ -59,8 +50,6 @@ public:
|
||||
float exponent() const;
|
||||
void setExponent(float exponent);
|
||||
|
||||
virtual std::string className() const override;
|
||||
|
||||
std::string jsonValue() const override;
|
||||
|
||||
using TemplateProperty<T>::operator=;
|
||||
@@ -71,13 +60,16 @@ public:
|
||||
void interpolateValue(float t,
|
||||
ghoul::EasingFunc<float> easingFunc = nullptr) override;
|
||||
|
||||
|
||||
protected:
|
||||
static const std::string MinimumValueKey;
|
||||
static const std::string MaximumValueKey;
|
||||
static const std::string SteppingValueKey;
|
||||
static const std::string ExponentValueKey;
|
||||
|
||||
virtual T fromLuaConversion(lua_State* state, bool& success) const override = 0;
|
||||
virtual void toLuaConversion(lua_State* state) const override;
|
||||
virtual std::string toStringConversion() const override;
|
||||
|
||||
std::string generateAdditionalJsonDescription() const override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,175 +22,12 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/util/json_helper.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <glm/ext/matrix_common.hpp>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
#define REGISTER_NUMERICALPROPERTY_HEADER(CLASS_NAME, TYPE) \
|
||||
using CLASS_NAME = NumericalProperty<TYPE>; \
|
||||
\
|
||||
template <> \
|
||||
std::string PropertyDelegate<NumericalProperty<TYPE>>::className(); \
|
||||
\
|
||||
template <> \
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMinimumValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMaximumValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue(lua_State* state, \
|
||||
bool& success); \
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue(lua_State* state, \
|
||||
bool& success); \
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue(lua_State* state, \
|
||||
const TYPE& value); \
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toLuaValue(lua_State* state, \
|
||||
const TYPE& value); \
|
||||
template <> \
|
||||
int PropertyDelegate<TemplateProperty<TYPE>>::typeLua(); \
|
||||
template <> \
|
||||
int PropertyDelegate<NumericalProperty<TYPE>>::typeLua(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue);
|
||||
|
||||
|
||||
#define REGISTER_NUMERICALPROPERTY_SOURCE(CLASS_NAME, TYPE, DEFAULT_VALUE, \
|
||||
DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, \
|
||||
DEFAULT_STEPPING, FROM_LUA_LAMBDA_EXPRESSION, \
|
||||
TO_LUA_LAMBDA_EXPRESSION, \
|
||||
TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \
|
||||
template <> \
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
|
||||
{ \
|
||||
return #CLASS_NAME; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
std::string PropertyDelegate<NumericalProperty<TYPE>>::className() \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::className(); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_VALUE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMinimumValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_MIN_VALUE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMaximumValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_MAX_VALUE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_STEPPING; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(state, success); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>( \
|
||||
state, success); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
const TYPE& value) \
|
||||
{ \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(state, value); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
const TYPE& value) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(state, value); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
int PropertyDelegate<TemplateProperty<TYPE>>::typeLua() \
|
||||
{ \
|
||||
return LUA_TYPE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
int PropertyDelegate<NumericalProperty<TYPE>>::typeLua() \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::typeLua(); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue) \
|
||||
{ \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(outValue, inValue); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toString(outValue, inValue); \
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
const std::string NumericalProperty<T>::MinimumValueKey = "MinimumValue";
|
||||
|
||||
@@ -203,60 +40,6 @@ const std::string NumericalProperty<T>::SteppingValueKey = "SteppingValue";
|
||||
template <typename T>
|
||||
const std::string NumericalProperty<T>::ExponentValueKey = "Exponent";
|
||||
|
||||
// Delegating constructors are necessary; automatic template deduction cannot
|
||||
// deduce template argument for 'U' if 'default' methods are used as default values in
|
||||
// a single constructor
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info)
|
||||
: NumericalProperty<T>(
|
||||
std::move(info),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
1.f
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value)
|
||||
: NumericalProperty<T>(
|
||||
std::move(info),
|
||||
std::move(value),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
1.f
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
T minimumValue, T maximumValue)
|
||||
: NumericalProperty<T>(
|
||||
std::move(info),
|
||||
std::move(value),
|
||||
std::move(minimumValue),
|
||||
std::move(maximumValue),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
1.f
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue)
|
||||
: NumericalProperty<T>(
|
||||
std::move(info),
|
||||
std::move(value),
|
||||
std::move(minimumValue),
|
||||
std::move(maximumValue),
|
||||
std::move(steppingValue),
|
||||
1.f
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue,
|
||||
@@ -268,44 +51,6 @@ NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
, _exponent(exponent)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
std::string NumericalProperty<T>::className() const {
|
||||
return PropertyDelegate<NumericalProperty<T>>::className();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::setLuaValue(lua_State* state) {
|
||||
bool success = false;
|
||||
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(
|
||||
state, success
|
||||
);
|
||||
if (success) {
|
||||
TemplateProperty<T>::setValue(std::move(value));
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::getLuaValue(lua_State* state) const {
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toLuaValue<T>(
|
||||
state, TemplateProperty<T>::_value
|
||||
);
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int NumericalProperty<T>::typeLua() const {
|
||||
return PropertyDelegate<NumericalProperty<T>>::typeLua();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::getStringValue(std::string& value) const {
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toString<T>(
|
||||
value, TemplateProperty<T>::_value
|
||||
);
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::minValue() const {
|
||||
return _minimumValue;
|
||||
@@ -374,8 +119,7 @@ std::string NumericalProperty<T>::luaToJson(std::string luaValue) const {
|
||||
|
||||
template <typename T>
|
||||
std::string NumericalProperty<T>::jsonValue() const {
|
||||
std::string value;
|
||||
getStringValue(value);
|
||||
std::string value = toStringConversion();
|
||||
return luaToJson(value);
|
||||
}
|
||||
|
||||
@@ -390,13 +134,10 @@ void NumericalProperty<T>::setInterpolationTarget(std::any value) {
|
||||
template <typename T>
|
||||
void NumericalProperty<T>::setLuaInterpolationTarget(lua_State* state) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(
|
||||
state,
|
||||
success
|
||||
);
|
||||
T targetValue = fromLuaConversion(state, success);
|
||||
if (success) {
|
||||
_interpolationStart = TemplateProperty<T>::_value;
|
||||
_interpolationEnd = std::move(thisValue);
|
||||
_interpolationEnd = std::move(targetValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,4 +153,14 @@ void NumericalProperty<T>::interpolateValue(float t,
|
||||
));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void NumericalProperty<T>::toLuaConversion(lua_State* state) const {
|
||||
ghoul::lua::push(state, TemplateProperty<T>::_value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string NumericalProperty<T>::toStringConversion() const {
|
||||
return formatJson(TemplateProperty<T>::_value);
|
||||
}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
@@ -381,22 +381,21 @@ public:
|
||||
|
||||
/**
|
||||
* Default view options that can be used in the Property::setViewOption method. The
|
||||
* values are: Property::ViewOptions::Color = \c color,
|
||||
* Property::ViewOptions::LightPosition = \c lightPosition
|
||||
* values are: Property::ViewOptions::Color = \c Color,
|
||||
* Property::ViewOptions::Logarithmic = \c Logarithmic
|
||||
*/
|
||||
struct ViewOptions {
|
||||
static const char* Color;
|
||||
static const char* LightPosition;
|
||||
static const char* Logarithmic;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method allows the developer to give hints to the GUI about different
|
||||
* representations for the GUI. The same Property (for example Vec4Property) can be
|
||||
* used in different ways, each requiring a different input method. These values are
|
||||
* stored in the metaData object using the <code>views.</code> prefix in front of the
|
||||
* <code>option</code> parameter. See Property::ViewOptions for a default list of
|
||||
* possible options. As these are only hints, the GUI is free to ignore any suggestion
|
||||
* by the developer.
|
||||
* stored in the metaData object under <code>ViewOptions</code>.
|
||||
* See Property::ViewOptions for a default list of possible options. As these are
|
||||
* only hints, the GUI is free to ignore any suggestion by the developer.
|
||||
* \param option The view option that should be modified
|
||||
* \param value Determines if the view option should be active (<code>true</code>) or
|
||||
* deactivated (<code>false</code>)
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___PROPERTYDELEGATE___H__
|
||||
#define __OPENSPACE_CORE___PROPERTYDELEGATE___H__
|
||||
|
||||
#include <string>
|
||||
|
||||
struct lua_State;
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
/**
|
||||
* The PropertyDelegate class is used by (among others) the TemplateProperty and the
|
||||
* NumericalProperty classes to outsource the definitions of class names, default values,
|
||||
* etc. Using the PropertyDelegate, it is possible to create new TemplateProperty types
|
||||
* without subclassing the TemplateProperty, but rather creating a specialized instance
|
||||
* of PropertyDelegate. See
|
||||
* (https://github.com/OpenSpace/OpenSpace/wiki/Concepts-Properties) for more detailed
|
||||
* information.
|
||||
* \see TemplateProperty
|
||||
* \see NumericalProperty
|
||||
* \tparam T The full class for which this specialized instance of PropertyDelegate is
|
||||
* responsible. For example <code>T = TemplateProperty<std::string></code>.
|
||||
*/
|
||||
template <typename T>
|
||||
class PropertyDelegate {
|
||||
public:
|
||||
/**
|
||||
* This method returns the class name for the class <code>T</code>. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \return The class name for the class <code>T</code>
|
||||
*/
|
||||
static std::string className();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default value for the class <code>T</code>.
|
||||
* The default implementation will lead to a compile-time error if the class method is
|
||||
* not specialized.
|
||||
* \return The default value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultValue();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default minimum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default minimum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultMinimumValue();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default maximum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default maximum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultMaximumValue();
|
||||
|
||||
/**
|
||||
* The method returns the default stepping value for the class <code>T</code> used in
|
||||
* GUI elements. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default stepping that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultSteppingValue();
|
||||
|
||||
/**
|
||||
* This method converts the top value from the Lua stack into a value of type
|
||||
* <code>U</code> and reports the <code>success</code> back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param success Will be <code>true</code> if the conversion succeeded;
|
||||
* <code>false</code> otherwise
|
||||
* \return The value that was created by converting the top value from the stack
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U fromLuaValue(lua_State* state, bool& success);
|
||||
|
||||
/**
|
||||
* This method converts the passed <code>value</code>, encodes it and places it on the
|
||||
* top value of the Lua stack and returns the success back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param value The value that will be converted into a Lua object
|
||||
* \return <code>true</code> if the conversion succeeded; <code>false</code> otherwise
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static bool toLuaValue(lua_State* state, const U& value);
|
||||
|
||||
/**
|
||||
* Returns the Lua type that will be put onto the stack in the
|
||||
* PropertyDelegate::toLuaValue method and which will be consumed by the
|
||||
* PropertyDelegate::fromLuaValue method. The returned value can belong to the set of
|
||||
* Lua types: <code>LUA_TNONE</code>, <code>LUA_TNIL</code>,
|
||||
* <code>LUA_TBOOLEAN</code>, <code>LUA_TLIGHTUSERDATA</code>,
|
||||
* <code>LUA_TNUMBER</code>, <code>LUA_TSTRING</code>, <code>LUA_TTABLE</code>,
|
||||
* <code>LUA_TFUNCTION</code>, <code>LUA_TUSERDATA</code>, or
|
||||
* <code>LUA_TTHREAD</code>. The default implementation will return
|
||||
* <code>LUA_TNONE</code>. The default implementation will lead to a compile-time
|
||||
* error if the class method is not specialized.
|
||||
* \return The Lua type that will be consumed or produced by the
|
||||
* PropertyDelegate::toLuaValue and PropertyDelegate::fromLuaValue methods.
|
||||
*/
|
||||
static int typeLua();
|
||||
|
||||
template <typename U>
|
||||
static bool toString(std::string& outValue, const U& inValue);
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#include <openspace/properties/propertydelegate.inl>
|
||||
|
||||
#endif // __OPENSPACE_CORE___PROPERTYDELEGATE___H__
|
||||
@@ -44,7 +44,20 @@
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(BoolProperty, bool)
|
||||
class BoolProperty : public TemplateProperty<bool> {
|
||||
public:
|
||||
BoolProperty(Property::PropertyInfo info, bool value = false);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<bool>::operator=;
|
||||
|
||||
protected:
|
||||
bool fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
std::string toStringConversion() const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -41,10 +41,24 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DoubleProperty, double)
|
||||
class DoubleProperty : public NumericalProperty<double> {
|
||||
public:
|
||||
DoubleProperty(Property::PropertyInfo info, double value = 0.0,
|
||||
double minValue = std::numeric_limits<double>::lowest(),
|
||||
double maxValue = std::numeric_limits<double>::max(), double stepValue = 0.01);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<double>::operator=;
|
||||
|
||||
protected:
|
||||
double fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -41,10 +41,24 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(FloatProperty, float)
|
||||
class FloatProperty : public NumericalProperty<float> {
|
||||
public:
|
||||
FloatProperty(Property::PropertyInfo info, float value = 0.f,
|
||||
float minValue = std::numeric_limits<float>::lowest(),
|
||||
float maxValue = std::numeric_limits<float>::max(), float stepValue = 0.01f);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<float>::operator=;
|
||||
|
||||
protected:
|
||||
float fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -41,10 +41,24 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(IntProperty, int)
|
||||
class IntProperty : public NumericalProperty<int> {
|
||||
public:
|
||||
IntProperty(Property::PropertyInfo info, int value = 0,
|
||||
int minValue = std::numeric_limits<int>::lowest(),
|
||||
int maxValue = std::numeric_limits<int>::max(), int stepValue = 1);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<int>::operator=;
|
||||
|
||||
protected:
|
||||
int fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___LONGDOUBLEPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___LONGDOUBLEPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file longdoubleproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class LongDoubleProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>long double</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(LongDoubleProperty, long double)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___LONGDOUBLEPROPERTY___H__
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___LONGLONGPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___LONGLONGPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file longlongproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class LongLongProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>long long</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(LongLongProperty, long long)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___LONGLONGPROPERTY___H__
|
||||
@@ -41,10 +41,25 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(LongProperty, long)
|
||||
class LongProperty : public NumericalProperty<long> {
|
||||
public:
|
||||
LongProperty(Property::PropertyInfo info, long value = long(0),
|
||||
long minValue = std::numeric_limits<long>::lowest(),
|
||||
long maxValue = std::numeric_limits<long>::max(),
|
||||
long stepValue = long(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<long>::operator=;
|
||||
|
||||
protected:
|
||||
long fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -41,10 +41,25 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(ShortProperty, short)
|
||||
class ShortProperty : public NumericalProperty<short> {
|
||||
public:
|
||||
ShortProperty(Property::PropertyInfo info, short value = short(0),
|
||||
short minValue = std::numeric_limits<short>::lowest(),
|
||||
short maxValue = std::numeric_limits<short>::max(),
|
||||
short stepValue = short(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<short>::operator=;
|
||||
|
||||
protected:
|
||||
short fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___SIGNEDCHARPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___SIGNEDCHARPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file signedcharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class SignedCharProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>signed char</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(SignedCharProperty, signed char)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___SIGNEDCHARPROPERTY___H__
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___UCHARPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___UCHARPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file ucharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class UCharProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>unsigned char</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___UCHARPROPERTY___H__
|
||||
@@ -41,10 +41,25 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UIntProperty, unsigned int)
|
||||
class UIntProperty : public NumericalProperty<unsigned int> {
|
||||
public:
|
||||
UIntProperty(Property::PropertyInfo info, unsigned int value = 0,
|
||||
unsigned int minValue = std::numeric_limits<unsigned int>::lowest(),
|
||||
unsigned int maxValue = std::numeric_limits<unsigned int>::max(),
|
||||
unsigned int stepValue = 1);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<unsigned int>::operator=;
|
||||
|
||||
protected:
|
||||
unsigned int fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___ULONGLONGPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___ULONGLONGPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file ulonglongproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class ULongLongProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>unsigned long long</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(ULongLongProperty, unsigned long long)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___ULONGLONGPROPERTY___H__
|
||||
@@ -41,10 +41,25 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(ULongProperty, unsigned long)
|
||||
class ULongProperty : public NumericalProperty<unsigned long> {
|
||||
public:
|
||||
ULongProperty(Property::PropertyInfo info, unsigned long value = 0ul,
|
||||
unsigned long minValue = std::numeric_limits<unsigned long>::lowest(),
|
||||
unsigned long maxValue = std::numeric_limits<unsigned long>::max(),
|
||||
unsigned long stepValue = 1ul);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<unsigned long>::operator=;
|
||||
|
||||
protected:
|
||||
unsigned long fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -41,10 +41,25 @@
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UShortProperty, unsigned short)
|
||||
class UShortProperty : public NumericalProperty<unsigned short> {
|
||||
public:
|
||||
UShortProperty(Property::PropertyInfo info, unsigned short value = 0,
|
||||
unsigned short minValue = std::numeric_limits<unsigned short>::lowest(),
|
||||
unsigned short maxValue = std::numeric_limits<unsigned short>::max(),
|
||||
unsigned short stepValue = 1);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<unsigned short>::operator=;
|
||||
|
||||
protected:
|
||||
unsigned short fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___WCHARPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___WCHARPROPERTY___H__
|
||||
|
||||
/**
|
||||
* \file wcharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class WCharProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>wchar_t</code>.
|
||||
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
//REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___WCHARPROPERTY___H__
|
||||
@@ -37,6 +37,9 @@ class SelectionProperty : public TemplateProperty<std::set<std::string>> {
|
||||
public:
|
||||
SelectionProperty(Property::PropertyInfo info);
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
/**
|
||||
* This method sets the stored value to the provided value <code>val</code>.
|
||||
* If the value is different, the listeners are notified. It also removes any
|
||||
@@ -110,6 +113,13 @@ public:
|
||||
|
||||
using TemplateProperty<std::set<std::string>>::operator=;
|
||||
|
||||
protected:
|
||||
std::set<std::string> fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
|
||||
std::string toStringConversion() const override;
|
||||
|
||||
private:
|
||||
void sortOptions();
|
||||
bool removeInvalidKeys(std::set<std::string>& keys);
|
||||
@@ -120,28 +130,6 @@ private:
|
||||
std::vector<std::string> _options;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::string PropertyDelegate<TemplateProperty<std::set<std::string>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::set<std::string>
|
||||
PropertyDelegate<TemplateProperty<std::set<std::string>>>::fromLuaValue(lua_State* state,
|
||||
bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toLuaValue(
|
||||
lua_State* state, const std::set<std::string>& value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::set<std::string>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toString(
|
||||
std::string& outValue, const std::set<std::string>& inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___SELECTIONPROPERTY___H__
|
||||
|
||||
@@ -29,7 +29,20 @@
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(StringProperty, std::string)
|
||||
class StringProperty : public TemplateProperty<std::string> {
|
||||
public:
|
||||
StringProperty(Property::PropertyInfo info, std::string value = "");
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<std::string>::operator=;
|
||||
|
||||
protected:
|
||||
std::string fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
void toLuaConversion(lua_State* state) const override;
|
||||
std::string toStringConversion() const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -27,12 +27,10 @@
|
||||
|
||||
#include <openspace/properties/property.h>
|
||||
|
||||
#include <openspace/properties/propertydelegate.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
/**
|
||||
* This concrete subclass of Property handles a single parameter value that is of type
|
||||
* This subclass of Property handles a single parameter value that is of type
|
||||
* <code>T</code>. It provides all the necessary methods to automatically access the
|
||||
* value. One notable instantiation of this class is StringProperty, using
|
||||
* <code>T = std::string</code> while NumericalProperty is a templated subclass dealing
|
||||
@@ -40,16 +38,14 @@ namespace openspace::properties {
|
||||
* The accessor operator and assignment operators are overloaded, so that the
|
||||
* TemplateProperty can be used just in the same way as a regular member variable. In the
|
||||
* case that these cannot not be used inline, the Property::get method will work.
|
||||
* The default value for the stored value of this TemplateProperty is retrieved via a call
|
||||
* to the PropertyDelegate::defaultValue method, providing the template parameter
|
||||
* <code>T</code> as argument. When a new TemplateProperty is required, that method needs
|
||||
* to be specialized for the new type or a compile-time error will occur
|
||||
* (See https://github.com/OpenSpace/OpenSpace/wiki/Concepts-Properties).
|
||||
*
|
||||
* Each instantiation of this class should provide a constructor that deals with the
|
||||
* default value for that specific type <code>T</code>, so that a property can be
|
||||
* created from just a Property::PropertyInfo object.
|
||||
*
|
||||
* \tparam T The type of value that is stored in this TemplateProperty
|
||||
* \see Property
|
||||
* \see NumericalProperty
|
||||
* \see PropertyDelegate
|
||||
*/
|
||||
template <typename T>
|
||||
class TemplateProperty : public Property {
|
||||
@@ -67,19 +63,15 @@ public:
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
TemplateProperty(Property::PropertyInfo info,
|
||||
T value = PropertyDelegate<TemplateProperty<T>>::template defaultValue<T>());
|
||||
TemplateProperty(Property::PropertyInfo info, T value);
|
||||
|
||||
/**
|
||||
* Returns the class name for this TemplateProperty. The default implementation makes
|
||||
* a call to the PropertyDelegate::className method with the template parameter
|
||||
* <code>T</code> as argument. For this to work, that method needs to be specialized
|
||||
* to return the correct class name for the new template parameter T, or a
|
||||
* compile-time error will occur.
|
||||
* Returns the class name for this TemplateProperty. This method has to be
|
||||
* specialized for each new type.
|
||||
*
|
||||
* \return The class name for the TemplateProperty
|
||||
*/
|
||||
virtual std::string className() const override;
|
||||
virtual std::string className() const override = 0;
|
||||
|
||||
/**
|
||||
* Returns the stored value packed into a ghoul::any object.
|
||||
@@ -108,41 +100,34 @@ public:
|
||||
|
||||
/**
|
||||
* This method encodes the stored value into a Lua object and pushes that object onto
|
||||
* the stack. The encoding is performed by calling PropertyDelegate::toLuaValue with
|
||||
* the template parameter <code>T</code> as an argument. This method has to be
|
||||
* specialized for each new type, or a compile-time error will occur.
|
||||
* the stack.
|
||||
*
|
||||
* \param state The Lua state onto which the encoded object will be pushed
|
||||
* \return \c true if the encoding succeeded; \c false otherwise
|
||||
*/
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
virtual bool getLuaValue(lua_State* state) const override;
|
||||
|
||||
/**
|
||||
* Sets the value of this TemplateProperty by decoding the object at the top of the Lua
|
||||
* stack and, if successful, assigning it using the Property::set method. The decoding
|
||||
* is performed by calling the PropertyDelegate::fromLuaValue with the template
|
||||
* parameter <code>T</code> as argument. If the decoding is successful, the new value
|
||||
* is set, otherwise it remains unchanged.
|
||||
* Sets the value of this TemplateProperty by decoding the object at the top of the
|
||||
* stack and, if successful, assigning it using the Property::set method. If the
|
||||
* decoding is successful, the new value is set, otherwise it remains unchanged.
|
||||
*
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \return \c true if the decoding succeeded; \c false otherwise
|
||||
*/
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
virtual bool setLuaValue(lua_State* state) override;
|
||||
|
||||
/// \see Property::typeLua
|
||||
int typeLua() const override;
|
||||
virtual int typeLua() const override = 0;
|
||||
|
||||
/**
|
||||
* This method encodes the stored value into a std::string object. The encoding is
|
||||
* performed by calling PropertyDelegate::toStringValue with the template parameter
|
||||
* <code>T</code> as an argument. This method has to be specialized for each new
|
||||
* type, or a compile-time error will occur. The resulting encoding must also be a
|
||||
* valid JSON representation fo the property.
|
||||
* This method encodes the stored value into a std::string object. The resulting
|
||||
* encoding must also be a valid JSON representation fo the property.
|
||||
*
|
||||
* \param value The string object in which to store the resulting encoding
|
||||
* \return \c true if the encoding succeeded; \c false otherwise
|
||||
*/
|
||||
bool getStringValue(std::string& value) const override;
|
||||
virtual bool getStringValue(std::string& value) const override;
|
||||
|
||||
/**
|
||||
* Returns the description for this TemplateProperty as a Lua script that returns a
|
||||
@@ -199,6 +184,33 @@ public:
|
||||
T value() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Decodes the object at the top of the stack to a value of the type <code>T</code>
|
||||
* and returns it. This method has to be specialized for each new type.
|
||||
*
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \param success Set to true \c true if the decoding succeeded; \c false otherwise
|
||||
* \return the decoded value
|
||||
*/
|
||||
virtual T fromLuaConversion(lua_State* state, bool& success) const = 0;
|
||||
|
||||
/**
|
||||
* Encodes the stored value into a Lua object and pushes that object onto
|
||||
* the stack. This method has to be specialized for each new type.
|
||||
*
|
||||
* \param state The Lua state onto which the encoded object will be pushed
|
||||
*/
|
||||
virtual void toLuaConversion(lua_State* state) const = 0;
|
||||
|
||||
/**
|
||||
* Encodes the stored value into a std::string object, in a format that is a valid
|
||||
* JSON representation of the property. This method has to be specialized for each
|
||||
* new type.
|
||||
*
|
||||
* \return The resulting encoding
|
||||
*/
|
||||
virtual std::string toStringConversion() const = 0;
|
||||
|
||||
/// The value that this TemplateProperty currently stores
|
||||
T _value;
|
||||
};
|
||||
|
||||
@@ -24,118 +24,12 @@
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
// The following macros can be used to quickly generate the necessary PropertyDelegate
|
||||
// specializations required by the TemplateProperty class. Use the
|
||||
// REGISTER_TEMPLATEPROPERTY_HEADER macro in the header file and the
|
||||
// REGISTER_TEMPLATEPROPERTY_SOURCE macro in the source file of your new
|
||||
// specialization of a TemplateProperty
|
||||
|
||||
|
||||
// CLASS_NAME = The string that the Property::className() should return as well as the
|
||||
// C++ class name for which a typedef will be created
|
||||
// TYPE = The template parameter T for which the TemplateProperty is specialized
|
||||
#define REGISTER_TEMPLATEPROPERTY_HEADER(CLASS_NAME, TYPE) \
|
||||
using CLASS_NAME = TemplateProperty<TYPE>; \
|
||||
\
|
||||
template <> \
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::defaultValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue(lua_State* state, \
|
||||
bool& success); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue(lua_State* state, \
|
||||
const TYPE& value); \
|
||||
\
|
||||
template <> \
|
||||
int PropertyDelegate<TemplateProperty<TYPE>>::typeLua(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue);
|
||||
|
||||
|
||||
// CLASS_NAME = The string that the Property::className() should return as well as the
|
||||
// C++ class name for which a typedef will be created
|
||||
// TYPE = The template parameter T for which the TemplateProperty is specialized
|
||||
// DEFAULT_VALUE = The value (as type T) which should be used as a default value
|
||||
// FROM_LUA_LAMBDA_EXPRESSION = A lambda expression receiving a lua_State* as the first
|
||||
// parameter, a bool& as the second parameter and returning
|
||||
// a value T. It is used by the fromLua method of
|
||||
// TemplateProperty. The lambda expression must extract the
|
||||
// stored value from the lua_State, return the value and
|
||||
// report success in the second argument
|
||||
// TO_LUA_LAMBDA_EXPRESSION = A lambda expression receiving a lua_State*, a value T and
|
||||
// returning a bool. The lambda expression must encode the
|
||||
// value T onto the lua_State stack and return the success
|
||||
// LUA_TYPE = The Lua type that will be produced/consumed by the previous
|
||||
// Lambda expressions
|
||||
#define REGISTER_TEMPLATEPROPERTY_SOURCE(CLASS_NAME, TYPE, DEFAULT_VALUE, \
|
||||
FROM_LUA_LAMBDA_EXPRESSION, \
|
||||
TO_LUA_LAMBDA_EXPRESSION, \
|
||||
TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \
|
||||
template <> \
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
|
||||
{ \
|
||||
return #CLASS_NAME; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::defaultValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_VALUE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
{ \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(state, success); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
const TYPE& value) \
|
||||
{ \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(state, value); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
int PropertyDelegate<TemplateProperty<TYPE>>::typeLua() { \
|
||||
return LUA_TYPE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
const TYPE& inValue) \
|
||||
{ \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(outValue, inValue); \
|
||||
} \
|
||||
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::TemplateProperty(Property::PropertyInfo info, T value)
|
||||
: Property(std::move(info))
|
||||
, _value(std::move(value))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
std::string TemplateProperty<T>::className() const {
|
||||
return PropertyDelegate<TemplateProperty<T>>::className();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::operator T() {
|
||||
return _value;
|
||||
@@ -190,20 +84,14 @@ const std::type_info& TemplateProperty<T>::type() const {
|
||||
|
||||
template <typename T>
|
||||
bool TemplateProperty<T>::getLuaValue(lua_State* state) const {
|
||||
bool success = PropertyDelegate<TemplateProperty<T>>::template toLuaValue<T>(
|
||||
state,
|
||||
_value
|
||||
);
|
||||
return success;
|
||||
toLuaConversion(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool TemplateProperty<T>::setLuaValue(lua_State* state) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromLuaValue<T>(
|
||||
state,
|
||||
success
|
||||
);
|
||||
T thisValue = fromLuaConversion(state, success);
|
||||
if (success) {
|
||||
set(std::any(thisValue));
|
||||
}
|
||||
@@ -211,17 +99,9 @@ bool TemplateProperty<T>::setLuaValue(lua_State* state) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int TemplateProperty<T>::typeLua() const {
|
||||
return PropertyDelegate<TemplateProperty<T>>::typeLua();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool TemplateProperty<T>::getStringValue(std::string& value) const {
|
||||
bool success = PropertyDelegate<TemplateProperty<T>>::template toString<T>(
|
||||
value,
|
||||
_value
|
||||
);
|
||||
return success;
|
||||
bool TemplateProperty<T>::getStringValue(std::string& outValue) const {
|
||||
outValue = toStringConversion();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___BVEC2PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___BVEC2PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(BVec2Property, glm::bvec2)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___BVEC2PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___BVEC3PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___BVEC3PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(BVec3Property, glm::bvec3)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___BVEC3PROPERTY___H__
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___BVEC4PROPERTY___H__
|
||||
#define __OPENSPACE_CORE___BVEC4PROPERTY___H__
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(BVec4Property, glm::bvec4)
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
#endif // __OPENSPACE_CORE___BVEC4PROPERTY___H__
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DVec2Property, glm::dvec2)
|
||||
class DVec2Property : public NumericalProperty<glm::dvec2> {
|
||||
public:
|
||||
DVec2Property(Property::PropertyInfo info, glm::dvec2 value = glm::dvec2(0.0),
|
||||
glm::dvec2 minValue = glm::dvec2(std::numeric_limits<double>::lowest()),
|
||||
glm::dvec2 maxValue = glm::dvec2(std::numeric_limits<double>::max()),
|
||||
glm::dvec2 stepValue = glm::dvec2(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dvec2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dvec2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DVec3Property, glm::dvec3)
|
||||
class DVec3Property : public NumericalProperty<glm::dvec3> {
|
||||
public:
|
||||
DVec3Property(Property::PropertyInfo info, glm::dvec3 value = glm::dvec3(0.0),
|
||||
glm::dvec3 minValue = glm::dvec3(std::numeric_limits<double>::lowest()),
|
||||
glm::dvec3 maxValue = glm::dvec3(std::numeric_limits<double>::max()),
|
||||
glm::dvec3 stepValue = glm::dvec3(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dvec3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dvec3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(DVec4Property, glm::dvec4)
|
||||
class DVec4Property : public NumericalProperty<glm::dvec4> {
|
||||
public:
|
||||
DVec4Property(Property::PropertyInfo info, glm::dvec4 value = glm::dvec4(0.0),
|
||||
glm::dvec4 minValue = glm::dvec4(std::numeric_limits<double>::lowest()),
|
||||
glm::dvec4 maxValue = glm::dvec4(std::numeric_limits<double>::max()),
|
||||
glm::dvec4 stepValue = glm::dvec4(0.01));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::dvec4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::dvec4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(IVec2Property, glm::ivec2)
|
||||
class IVec2Property : public NumericalProperty<glm::ivec2> {
|
||||
public:
|
||||
IVec2Property(Property::PropertyInfo info, glm::ivec2 value = glm::ivec2(0),
|
||||
glm::ivec2 minValue = glm::ivec2(std::numeric_limits<int>::lowest()),
|
||||
glm::ivec2 maxValue = glm::ivec2(std::numeric_limits<int>::max()),
|
||||
glm::ivec2 stepValue = glm::ivec2(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::ivec2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::ivec2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(IVec3Property, glm::ivec3)
|
||||
class IVec3Property : public NumericalProperty<glm::ivec3> {
|
||||
public:
|
||||
IVec3Property(Property::PropertyInfo info, glm::ivec3 value = glm::ivec3(0),
|
||||
glm::ivec3 minValue = glm::ivec3(std::numeric_limits<int>::lowest()),
|
||||
glm::ivec3 maxValue = glm::ivec3(std::numeric_limits<int>::max()),
|
||||
glm::ivec3 stepValue = glm::ivec3(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::ivec3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::ivec3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(IVec4Property, glm::ivec4)
|
||||
class IVec4Property : public NumericalProperty<glm::ivec4> {
|
||||
public:
|
||||
IVec4Property(Property::PropertyInfo info, glm::ivec4 value = glm::ivec4(0),
|
||||
glm::ivec4 minValue = glm::ivec4(std::numeric_limits<int>::lowest()),
|
||||
glm::ivec4 maxValue = glm::ivec4(std::numeric_limits<int>::max()),
|
||||
glm::ivec4 stepValue = glm::ivec4(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::ivec4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::ivec4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UVec2Property, glm::uvec2)
|
||||
class UVec2Property : public NumericalProperty<glm::uvec2> {
|
||||
public:
|
||||
UVec2Property(Property::PropertyInfo info, glm::uvec2 value = glm::uvec2(0),
|
||||
glm::uvec2 minValue = glm::uvec2(std::numeric_limits<unsigned int>::lowest()),
|
||||
glm::uvec2 maxValue = glm::uvec2(std::numeric_limits<unsigned int>::max()),
|
||||
glm::uvec2 stepValue = glm::uvec2(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::uvec2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::uvec2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UVec3Property, glm::uvec3)
|
||||
class UVec3Property : public NumericalProperty<glm::uvec3> {
|
||||
public:
|
||||
UVec3Property(Property::PropertyInfo info, glm::uvec3 value = glm::uvec3(0),
|
||||
glm::uvec3 minValue = glm::uvec3(std::numeric_limits<unsigned int>::lowest()),
|
||||
glm::uvec3 maxValue = glm::uvec3(std::numeric_limits<unsigned int>::max()),
|
||||
glm::uvec3 stepValue = glm::uvec3(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::uvec3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::uvec3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UVec4Property, glm::uvec4)
|
||||
class UVec4Property : public NumericalProperty<glm::uvec4> {
|
||||
public:
|
||||
UVec4Property(Property::PropertyInfo info, glm::uvec4 value = glm::uvec4(0),
|
||||
glm::uvec4 minValue = glm::uvec4(std::numeric_limits<unsigned int>::lowest()),
|
||||
glm::uvec4 maxValue = glm::uvec4(std::numeric_limits<unsigned int>::max()),
|
||||
glm::uvec4 stepValue = glm::uvec4(1));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::uvec4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::uvec4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Vec2Property, glm::vec2)
|
||||
class Vec2Property : public NumericalProperty<glm::vec2> {
|
||||
public:
|
||||
Vec2Property(Property::PropertyInfo info, glm::vec2 value = glm::vec2(0.f),
|
||||
glm::vec2 minValue = glm::vec2(std::numeric_limits<float>::lowest()),
|
||||
glm::vec2 maxValue = glm::vec2(std::numeric_limits<float>::max()),
|
||||
glm::vec2 stepValue = glm::vec2(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::vec2>::operator=;
|
||||
|
||||
protected:
|
||||
glm::vec2 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Vec3Property, glm::vec3)
|
||||
class Vec3Property : public NumericalProperty<glm::vec3> {
|
||||
public:
|
||||
Vec3Property(Property::PropertyInfo info, glm::vec3 value = glm::vec3(0.f),
|
||||
glm::vec3 minValue = glm::vec3(std::numeric_limits<float>::lowest()),
|
||||
glm::vec3 maxValue = glm::vec3(std::numeric_limits<float>::max()),
|
||||
glm::vec3 stepValue = glm::vec3(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::vec3>::operator=;
|
||||
|
||||
protected:
|
||||
glm::vec3 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -28,10 +28,25 @@
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <limits>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(Vec4Property, glm::vec4)
|
||||
class Vec4Property : public NumericalProperty<glm::vec4> {
|
||||
public:
|
||||
Vec4Property(Property::PropertyInfo info, glm::vec4 value = glm::vec4(0.f),
|
||||
glm::vec4 minValue = glm::vec4(std::numeric_limits<float>::lowest()),
|
||||
glm::vec4 maxValue = glm::vec4(std::numeric_limits<float>::max()),
|
||||
glm::vec4 stepValue = glm::vec4(0.01f));
|
||||
|
||||
std::string className() const override;
|
||||
int typeLua() const override;
|
||||
|
||||
using TemplateProperty<glm::vec4>::operator=;
|
||||
|
||||
protected:
|
||||
glm::vec4 fromLuaConversion(lua_State* state, bool& success) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -61,12 +61,12 @@ void renderBox(const glm::vec2& position, const glm::vec2& size, const glm::vec4
|
||||
struct Shaders {
|
||||
struct {
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> program;
|
||||
UniformCache(tex, hasTexture, shouldFlipTexture, ortho, color) cache;
|
||||
UniformCache(tex, hasTexture, shouldFlipTexture, proj, color) cache;
|
||||
} xyuvrgba;
|
||||
|
||||
struct {
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> program;
|
||||
UniformCache(tex, hasTexture, shouldFlipTexture, ortho, color) cache;
|
||||
UniformCache(tex, hasTexture, shouldFlipTexture, proj, color) cache;
|
||||
} screenfilling;
|
||||
};
|
||||
|
||||
@@ -76,6 +76,14 @@ struct VertexObjects {
|
||||
GLuint vbo;
|
||||
} square;
|
||||
|
||||
struct {
|
||||
GLuint vao;
|
||||
GLuint vbo;
|
||||
GLuint ibo;
|
||||
|
||||
int nElements = 64;
|
||||
} sphere;
|
||||
|
||||
struct {
|
||||
GLuint vao;
|
||||
} empty;
|
||||
@@ -108,6 +116,9 @@ std::vector<VertexXYZ> convert(std::vector<Vertex> v);
|
||||
std::vector<Vertex> createRing(int nSegments, float radius,
|
||||
glm::vec4 colors = glm::vec4(1.f));
|
||||
|
||||
std::pair<std::vector<Vertex>, std::vector<GLushort>>
|
||||
createSphere(int nSegments, glm::vec3 radii, glm::vec4 colors = glm::vec4(1.f));
|
||||
|
||||
} // namespace openspace::rendering::helper
|
||||
|
||||
#endif // __OPENSPACE_CORE___HELPER___H__
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/properties/scalar/doubleproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <ghoul/misc/managedmemoryuniqueptr.h>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
@@ -75,11 +76,17 @@ public:
|
||||
bool isEnabled() const;
|
||||
bool shouldUpdateIfDisabled() const;
|
||||
|
||||
void setBoundingSphere(double boundingSphere);
|
||||
double boundingSphere() const;
|
||||
double interactionSphere() const;
|
||||
|
||||
virtual void render(const RenderData& data, RendererTasks& rendererTask);
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
// The 'surface' in this case is the interaction sphere of this renderable. In some
|
||||
// cases (i.e., planets) this corresponds directly to the physical surface, but in
|
||||
// many cases, models, volumetric data, this will not. Regardless of what the physical
|
||||
// representation is, the 'surface' is always the sphere around which interaction is
|
||||
// handled
|
||||
virtual SurfacePositionHandle calculateSurfacePositionHandle(
|
||||
const glm::dvec3& targetModelSpace) const;
|
||||
|
||||
@@ -98,15 +105,26 @@ public:
|
||||
protected:
|
||||
properties::BoolProperty _enabled;
|
||||
properties::FloatProperty _opacity;
|
||||
properties::DoubleProperty _boundingSphere;
|
||||
properties::StringProperty _renderableType;
|
||||
|
||||
bool _shouldUpdateIfDisabled = false;
|
||||
void setBoundingSphere(double boundingSphere);
|
||||
void setInteractionSphere(double interactionSphere);
|
||||
|
||||
void setRenderBinFromOpacity();
|
||||
void registerUpdateRenderBinFromOpacity();
|
||||
|
||||
double _boundingSphere = 0.0;
|
||||
double _interactionSphere = 0.0;
|
||||
SceneGraphNode* _parent = nullptr;
|
||||
bool _shouldUpdateIfDisabled = false;
|
||||
|
||||
private:
|
||||
// We only want the SceneGraphNode to be able manipulate the parent, so we don't want
|
||||
// to provide a set method for this. Otherwise, anyone might mess around with our
|
||||
// parentage and that's no bueno
|
||||
friend ghoul::mm_unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
|
||||
const ghoul::Dictionary&);
|
||||
|
||||
RenderBin _renderBin = RenderBin::Opaque;
|
||||
};
|
||||
|
||||
|
||||
@@ -104,11 +104,12 @@ protected:
|
||||
properties::Vec3Property _localRotation;
|
||||
|
||||
properties::FloatProperty _scale;
|
||||
properties::Vec3Property _multiplyColor;
|
||||
properties::FloatProperty _opacity;
|
||||
properties::TriggerProperty _delete;
|
||||
|
||||
glm::ivec2 _objectSize = glm::ivec2(0);
|
||||
UniformCache(alpha, modelTransform, viewProj, texture) _uniformCache;
|
||||
UniformCache(color, alpha, modelTransform, viewProj, texture) _uniformCache;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,14 +36,16 @@
|
||||
#include <ghoul/misc/boolean.h>
|
||||
#include <ghoul/misc/managedmemoryuniqueptr.h>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
|
||||
//#define Debugging_Core_SceneGraphNode_Indices
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
namespace ghoul::opengl { class ProgramObject; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -127,6 +129,7 @@ public:
|
||||
std::vector<SceneGraphNode*> children() const;
|
||||
|
||||
double boundingSphere() const;
|
||||
double interactionSphere() const;
|
||||
|
||||
SceneGraphNode* childNode(const std::string& identifier);
|
||||
|
||||
@@ -143,6 +146,7 @@ private:
|
||||
glm::dmat3 calculateWorldRotation() const;
|
||||
glm::dvec3 calculateWorldScale() const;
|
||||
void computeScreenSpaceData(RenderData& newData);
|
||||
void renderDebugSphere(const Camera& camera, double size, glm::vec4 color);
|
||||
|
||||
std::atomic<State> _state = State::Loaded;
|
||||
std::vector<ghoul::mm_unique_ptr<SceneGraphNode>> _children;
|
||||
@@ -178,6 +182,7 @@ private:
|
||||
glm::dmat4 _modelTransformCached = glm::dmat4(1.0);
|
||||
|
||||
properties::DoubleProperty _boundingSphere;
|
||||
properties::DoubleProperty _interactionSphere;
|
||||
properties::BoolProperty _computeScreenSpaceValues;
|
||||
properties::IVec2Property _screenSpacePosition;
|
||||
properties::BoolProperty _screenVisibility;
|
||||
@@ -189,6 +194,12 @@ private:
|
||||
// are calculated when _computeScreenSpaceValues is true)
|
||||
std::chrono::high_resolution_clock::time_point _lastScreenSpaceUpdateTime;
|
||||
|
||||
properties::BoolProperty _showDebugSphere;
|
||||
static ghoul::opengl::ProgramObject* _debugSphereProgram;
|
||||
|
||||
std::optional<double> _overrideBoundingSphere;
|
||||
std::optional<double> _overrideInteractionSphere;
|
||||
|
||||
#ifdef Debugging_Core_SceneGraphNode_Indices
|
||||
int index = 0;
|
||||
static int nextIndex;
|
||||
|
||||
@@ -22,30 +22,47 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___CHARPROPERTY___H__
|
||||
#define __OPENSPACE_CORE___CHARPROPERTY___H__
|
||||
#ifndef __OPENSPACE_CORE___JSON_HELPER___H__
|
||||
#define __OPENSPACE_CORE___JSON_HELPER___H__
|
||||
|
||||
/**
|
||||
* \file charproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
#include <string>
|
||||
|
||||
* \class CharProperty
|
||||
* This class is a concrete implementation of openspace::properties::TemplateProperty with
|
||||
* the type <code>char</code>.
|
||||
namespace openspace {
|
||||
|
||||
* @} @}
|
||||
/**
|
||||
* This function takes a \p text and escapes all necessary characters () that JSON
|
||||
* does not want in its strings.
|
||||
* \param text The text that is to be escaped
|
||||
* \return The same text with all required characteres escaped
|
||||
*/
|
||||
std::string escapedJson(const std::string& text);
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
/**
|
||||
* This function takes a \p list of text and escapes all necessary characters () that
|
||||
* JSON does not want in its strings.
|
||||
* \param text The list of text that is to be escaped
|
||||
* \return The same text with all required characteres escaped
|
||||
*/
|
||||
std::string escapedJson(const std::vector<std::string>& list);
|
||||
|
||||
namespace openspace::properties {
|
||||
/**
|
||||
* Convert the input value to a valid JSON formatted string. Nan and Inf values
|
||||
* are not vald JSON and will be represented by 'null'
|
||||
* \param d The value to format
|
||||
* \return The resulting JSON formatted string
|
||||
*/
|
||||
std::string formatJsonNumber(double d);
|
||||
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(CharProperty, char)
|
||||
/**
|
||||
* Convert the input value to a valid JSON formatted string
|
||||
* \param value The value to be converted
|
||||
* \return The resulting JSON formatted string
|
||||
*/
|
||||
template <typename T>
|
||||
std::string formatJson(T value);
|
||||
|
||||
} // namespace openspace::properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___CHARPROPERTY___H__
|
||||
#include "json_helper.inl"
|
||||
|
||||
#endif // __OPENSPACE_CORE___JSON_HELPER___H__
|
||||
@@ -22,73 +22,75 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <typeinfo>
|
||||
#include <ghoul/fmt.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/dictionaryjsonformatter.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace openspace::properties {
|
||||
namespace openspace {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <class T, class... Ts>
|
||||
struct is_any : std::disjunction<std::is_same<T, Ts>...> {};
|
||||
|
||||
template <typename T>
|
||||
std::string PropertyDelegate<T>::className() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::className specialization");
|
||||
return "";
|
||||
constexpr bool isGlmMatrix() {
|
||||
return is_any<T,
|
||||
glm::mat2x2, glm::mat2x3, glm::mat2x4,
|
||||
glm::mat3x2, glm::mat3x3, glm::mat3x4,
|
||||
glm::mat4x2, glm::mat4x3, glm::mat4x4,
|
||||
glm::dmat2x2, glm::dmat2x3, glm::dmat2x4,
|
||||
glm::dmat3x2, glm::dmat3x3, glm::dmat3x4,
|
||||
glm::dmat4x2, glm::dmat4x3, glm::dmat4x4>::value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultValue specialization");
|
||||
constexpr bool isGlmVector() {
|
||||
return is_any<T,
|
||||
glm::vec2, glm::vec3, glm::vec4,
|
||||
glm::ivec2, glm::ivec3, glm::ivec4,
|
||||
glm::dvec2, glm::dvec3, glm::dvec4,
|
||||
glm::uvec2, glm::uvec3, glm::uvec4>::value;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultMinimumValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultMinimumValue specialization");
|
||||
std::string formatJson(T value) {
|
||||
if constexpr (std::is_same_v<T, bool>) {
|
||||
return value ? "true" : "false";
|
||||
}
|
||||
else if constexpr (std::is_arithmetic_v<T>) {
|
||||
return formatJsonNumber(static_cast<double>(value));
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, std::string>) {
|
||||
return escapedJson(value);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, ghoul::Dictionary>) {
|
||||
return ghoul::formatJson(value);
|
||||
}
|
||||
else if constexpr (internal::isGlmVector<T>()) {
|
||||
std::string values;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_components<T>::value; ++i) {
|
||||
values += std::to_string(value[i]) + ',';
|
||||
}
|
||||
values.pop_back();
|
||||
return fmt::format("[{}]", values);
|
||||
}
|
||||
else if constexpr (internal::isGlmMatrix<T>()) {
|
||||
std::string values;
|
||||
for (glm::length_t i = 0; i < T::type::row_type::length(); ++i) {
|
||||
for (glm::length_t j = 0; j < T::type::col_type::length(); ++j) {
|
||||
values += std::to_string(value[i][j]) + ',';
|
||||
}
|
||||
}
|
||||
values.pop_back();
|
||||
return fmt::format("[{}]", values);
|
||||
}
|
||||
else {
|
||||
static_assert(sizeof(T) == 0, "JSON formatting of type T not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultMaximumValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultMaximumValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultSteppingValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultSteppingValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::fromLuaValue(lua_State*, bool&) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::fromLuaValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
bool PropertyDelegate<T>::toLuaValue(lua_State*, const U&) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::toLuaValue specialization");
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int PropertyDelegate<T>::typeLua() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::luaType specialization");
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
bool PropertyDelegate<T>::toString(std::string&, const U&) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::toString specialization");
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace openspace::properties
|
||||
} // namespace openspace
|
||||
@@ -50,7 +50,7 @@ struct UpdateData {
|
||||
struct RenderData {
|
||||
const Camera& camera;
|
||||
const Time time;
|
||||
int renderBinMask = -1;
|
||||
int8_t renderBinMask = -1;
|
||||
TransformData modelTransform;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user