mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-03 01:59:35 -06:00
Property for rotation
This commit is contained in:
@@ -92,6 +92,12 @@ namespace {
|
||||
"all other transformations are applied."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo RotationVecInfo = {
|
||||
"RotationVec",
|
||||
"Rotation Vector",
|
||||
"Rotation vector "
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo LightSourcesInfo = {
|
||||
"LightSources",
|
||||
"Light Sources",
|
||||
@@ -149,6 +155,12 @@ documentation::Documentation RenderableModel::Documentation() {
|
||||
Optional::Yes,
|
||||
ModelTransformInfo.description
|
||||
},
|
||||
{
|
||||
RotationVecInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
RotationVecInfo.description
|
||||
},
|
||||
{
|
||||
LightSourcesInfo.identifier,
|
||||
new TableVerifier({
|
||||
@@ -172,7 +184,8 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
, _diffuseIntensity(DiffuseIntensityInfo, 1.f, 0.f, 1.f)
|
||||
, _specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f)
|
||||
, _performShading(ShadingInfo, true)
|
||||
, _modelTransform(ModelTransformInfo, glm::mat3(1.f))
|
||||
, _modelTransform(ModelTransformInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
|
||||
, _rotationVec(RotationVecInfo, glm::dvec3(3.14), glm::dvec3(-3.14), glm::dvec3(2*(3.1415)))
|
||||
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
@@ -238,6 +251,13 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_diffuseIntensity);
|
||||
addProperty(_specularIntensity);
|
||||
addProperty(_performShading);
|
||||
addProperty(_modelTransform);
|
||||
addProperty(_rotationVec);
|
||||
|
||||
_rotationVec.onChange([this]() {
|
||||
_modelTransform = glm::mat4_cast(
|
||||
glm::quat(_rotationVec));
|
||||
});
|
||||
}
|
||||
|
||||
bool RenderableModel::isReady() const {
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <ghoul/opengl/uniformcache.h>
|
||||
#include <memory>
|
||||
#include <openspace/properties/matrix/dmat4property.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
|
||||
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
@@ -73,11 +77,13 @@ private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
|
||||
properties::FloatProperty _ambientIntensity;
|
||||
|
||||
properties::FloatProperty _diffuseIntensity;
|
||||
properties::FloatProperty _specularIntensity;
|
||||
|
||||
properties::BoolProperty _performShading;
|
||||
properties::Mat3Property _modelTransform;
|
||||
properties::DMat4Property _modelTransform;
|
||||
properties::Vec3Property _rotationVec;
|
||||
|
||||
ghoul::opengl::ProgramObject* _program = nullptr;
|
||||
UniformCache(opacity, nLightSources, lightDirectionsViewSpace, lightIntensities,
|
||||
|
||||
Reference in New Issue
Block a user