Feature/safe apollo (#879)

* Apollo missions with renderablemodel and spice rotation updates
* Added user control for face culling.
* Added gui property for disabling face culling.
* Changed rotation vector property to handle degrees instead of radians
* Separated apollo globebrowsing
This commit is contained in:
Micah Acinapura
2019-05-20 22:10:23 -04:00
committed by Alexander Bock
parent 70500d9ad2
commit 54d24605cf
22 changed files with 2014 additions and 3 deletions

View File

@@ -85,6 +85,12 @@ namespace {
"of the Sun."
};
constexpr openspace::properties::Property::PropertyInfo DisableFaceCullingInfo = {
"DisableFaceCulling",
"Disable Face Culling",
"Disable OpenGL automatic face culling optimization."
};
constexpr openspace::properties::Property::PropertyInfo ModelTransformInfo = {
"ModelTransform",
"Model Transform",
@@ -92,6 +98,12 @@ namespace {
"all other transformations are applied."
};
constexpr openspace::properties::Property::PropertyInfo RotationVecInfo = {
"RotationVector",
"Rotation Vector",
"Rotation Vector using degrees"
};
constexpr openspace::properties::Property::PropertyInfo LightSourcesInfo = {
"LightSources",
"Light Sources",
@@ -143,12 +155,24 @@ documentation::Documentation RenderableModel::Documentation() {
Optional::Yes,
ShadingInfo.description
},
{
DisableFaceCullingInfo.identifier,
new BoolVerifier,
Optional::Yes,
DisableFaceCullingInfo.description
},
{
ModelTransformInfo.identifier,
new DoubleMatrix3Verifier,
Optional::Yes,
ModelTransformInfo.description
},
{
RotationVecInfo.identifier,
new DoubleVector3Verifier,
Optional::Yes,
RotationVecInfo.description
},
{
LightSourcesInfo.identifier,
new TableVerifier({
@@ -172,7 +196,9 @@ 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))
, _disableFaceCulling(DisableFaceCullingInfo, false)
, _modelTransform(ModelTransformInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
, _rotationVec(RotationVecInfo, glm::dvec3(0), glm::dvec3(0), glm::dvec3(360))
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
{
documentation::testSpecificationAndThrow(
@@ -214,6 +240,10 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
_performShading = dictionary.value<bool>(ShadingInfo.identifier);
}
if (dictionary.hasKey(DisableFaceCullingInfo.identifier)) {
_disableFaceCulling = dictionary.value<bool>(DisableFaceCullingInfo.identifier);
}
if (dictionary.hasKey(LightSourcesInfo.identifier)) {
const ghoul::Dictionary& lsDictionary =
dictionary.value<ghoul::Dictionary>(LightSourcesInfo.identifier);
@@ -238,6 +268,17 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
addProperty(_diffuseIntensity);
addProperty(_specularIntensity);
addProperty(_performShading);
addProperty(_disableFaceCulling);
addProperty(_modelTransform);
addProperty(_rotationVec);
_rotationVec.onChange([this]() {
glm::vec3 degreeVector = _rotationVec;
glm::vec3 radianVector = glm::vec3(glm::radians(degreeVector.x),
glm::radians(degreeVector.y), glm::radians(degreeVector.z));
_modelTransform = glm::mat4_cast(
glm::quat(radianVector));
});
}
bool RenderableModel::isReady() const {
@@ -361,8 +402,16 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
_texture->bind();
_program->setUniform(_uniformCache.texture, unit);
if (_disableFaceCulling) {
glDisable(GL_CULL_FACE);
}
_geometry->render();
if (_disableFaceCulling) {
glEnable(GL_CULL_FACE);
}
_program->deactivate();
}

View File

@@ -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,14 @@ private:
properties::StringProperty _colorTexturePath;
properties::FloatProperty _ambientIntensity;
properties::FloatProperty _diffuseIntensity;
properties::FloatProperty _specularIntensity;
properties::BoolProperty _performShading;
properties::Mat3Property _modelTransform;
properties::BoolProperty _disableFaceCulling;
properties::DMat4Property _modelTransform;
properties::Vec3Property _rotationVec;
ghoul::opengl::ProgramObject* _program = nullptr;
UniformCache(opacity, nLightSources, lightDirectionsViewSpace, lightIntensities,