Merged develop branch into NewAtmosphere branch.

This commit is contained in:
Jonathas Costa
2017-03-30 15:59:20 -04:00
366 changed files with 7399 additions and 5736 deletions
+8 -7
View File
@@ -23,8 +23,10 @@
****************************************************************************************/
#include <modules/space/rendering/planetgeometry.h>
#include <openspace/util/factorymanager.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
namespace {
@@ -35,7 +37,7 @@ namespace {
namespace openspace {
namespace planetgeometry {
Documentation PlanetGeometry::Documentation() {
documentation::Documentation PlanetGeometry::Documentation() {
using namespace documentation;
return {
"Planet Geometry",
@@ -51,7 +53,7 @@ Documentation PlanetGeometry::Documentation() {
};
}
PlanetGeometry* PlanetGeometry::createFromDictionary(const ghoul::Dictionary& dictionary)
std::unique_ptr<PlanetGeometry> PlanetGeometry::createFromDictionary(const ghoul::Dictionary& dictionary)
{
documentation::testSpecificationAndThrow(
Documentation(),
@@ -62,7 +64,7 @@ PlanetGeometry* PlanetGeometry::createFromDictionary(const ghoul::Dictionary& di
std::string geometryType = dictionary.value<std::string>(KeyType);
auto factory = FactoryManager::ref().factory<PlanetGeometry>();
PlanetGeometry* result = factory->create(geometryType, dictionary);
std::unique_ptr<PlanetGeometry> result = factory->create(geometryType, dictionary);
if (result == nullptr) {
throw ghoul::RuntimeError(
"Failed to create a PlanetGeometry object of type '" + geometryType + "'"
@@ -72,10 +74,9 @@ PlanetGeometry* PlanetGeometry::createFromDictionary(const ghoul::Dictionary& di
}
PlanetGeometry::PlanetGeometry()
: _parent(nullptr)
{
setName("PlanetGeometry");
}
: properties::PropertyOwner("PlanetGeometry")
, _parent(nullptr)
{}
PlanetGeometry::~PlanetGeometry() {}
+9 -3
View File
@@ -27,16 +27,22 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/documentation/documentation.h>
#include <memory>
namespace ghoul { class Dictionary; }
namespace openspace {
class Renderable;
namespace documentation { struct Documentation; }
namespace planetgeometry {
class PlanetGeometry : public properties::PropertyOwner {
public:
static PlanetGeometry* createFromDictionary(const ghoul::Dictionary& dictionary);
static std::unique_ptr<PlanetGeometry> createFromDictionary(
const ghoul::Dictionary& dictionary
);
PlanetGeometry();
virtual ~PlanetGeometry();
@@ -44,7 +50,7 @@ public:
virtual void deinitialize();
virtual void render() = 0;
static openspace::Documentation Documentation();
static documentation::Documentation Documentation();
protected:
Renderable* _parent;
+15 -8
View File
@@ -83,8 +83,11 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
{
std::string name;
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
ghoul_assert(success,
"RenderablePlanet need the '" << SceneGraphNode::KeyName<<"' be specified");
ghoul_assert(
success,
std::string("RenderablePlanet need the '") + SceneGraphNode::KeyName +
"' be specified"
);
ghoul::Dictionary geometryDictionary;
success = dictionary.getValue(keyGeometry, geometryDictionary);
@@ -94,10 +97,14 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
glm::vec2 planetRadiusVec;
success = geometryDictionary.getValue(keyRadius, planetRadiusVec);
if (success)
_planetRadius = planetRadiusVec[0] * glm::pow(10, planetRadiusVec[1]);
else
if (success) {
_planetRadius = static_cast<float>(
planetRadiusVec[0] * glm::pow(10, planetRadiusVec[1])
);
}
else {
LWARNING("No Radius value expecified for " << name << " planet.");
}
}
//===============================================================
@@ -131,7 +138,7 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
_heightMapTexturePath = absPath(heightMapTexturePath);
}
addPropertySubOwner(_geometry);
addPropertySubOwner(_geometry.get());
addProperty(_colorTexturePath);
_colorTexturePath.onChange(std::bind(&RenderablePlanet::loadTexture, this));
@@ -326,7 +333,7 @@ bool RenderablePlanet::initialize() {
bool RenderablePlanet::deinitialize() {
if(_geometry) {
_geometry->deinitialize();
delete _geometry;
_geometry = nullptr;
}
RenderEngine& renderEngine = OsEng.renderEngine();
@@ -444,7 +451,7 @@ void RenderablePlanet::render(const RenderData& data) {
float xp_test = shadowConf.caster.second * sc_length / (shadowConf.source.second + shadowConf.caster.second);
float rp_test = shadowConf.caster.second * (glm::length(planetCaster_proj) + xp_test) / xp_test;
float casterDistSun = glm::length(casterPos);
double casterDistSun = glm::length(casterPos);
float planetDistSun = glm::length(data.position.vec3());
ShadowRenderingStruct shadowData;
+3 -2
View File
@@ -35,8 +35,9 @@
#include <ghoul/opengl/textureunit.h>
#include <vector>
#include <memory>
#include <string>
#include <vector>
namespace ghoul {
namespace opengl {
@@ -93,7 +94,7 @@ private:
properties::FloatProperty _heightExaggeration;
planetgeometry::PlanetGeometry* _geometry;
std::unique_ptr<planetgeometry::PlanetGeometry> _geometry;
properties::BoolProperty _performShading;
properties::IntProperty _rotation;
float _alpha;
+3 -2
View File
@@ -24,6 +24,7 @@
#include <modules/space/rendering/renderablerings.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -43,7 +44,7 @@ namespace {
namespace openspace {
Documentation RenderableRings::Documentation() {
documentation::Documentation RenderableRings::Documentation() {
using namespace documentation;
return {
"Renderable Rings",
@@ -104,7 +105,7 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
"RenderableRings"
);
_size = dictionary.value<double>(KeySize);
_size = static_cast<float>(dictionary.value<double>(KeySize));
setBoundingSphere(PowerScaledScalar::CreatePSS(_size));
addProperty(_size);
_size.onChange([&]() { _planeIsDirty = true; });
+2 -2
View File
@@ -27,7 +27,6 @@
#include <openspace/rendering/renderable.h>
#include <openspace/documentation/documentation.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec2property.h>
@@ -44,6 +43,7 @@ namespace ghoul {
}
namespace openspace {
namespace documentation { struct Documentation; }
class RenderableRings : public Renderable {
public:
@@ -57,7 +57,7 @@ public:
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
static openspace::Documentation Documentation();
static documentation::Documentation Documentation();
private:
void loadTexture();
+3 -2
View File
@@ -24,6 +24,7 @@
#include <modules/space/rendering/renderablestars.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/util/updatestructures.h>
#include <openspace/engine/openspaceengine.h>
@@ -82,7 +83,7 @@ namespace {
namespace openspace {
openspace::Documentation RenderableStars::Documentation() {
documentation::Documentation RenderableStars::Documentation() {
using namespace documentation;
return {
"RenderableStars",
@@ -466,7 +467,7 @@ bool RenderableStars::readSpeckFile() {
// (signaled by the keywords 'datavar', 'texturevar', and 'texture')
std::string line = "";
while (true) {
std::ifstream::streampos position = file.tellg();
std::streampos position = file.tellg();
std::getline(file, line);
if (line[0] == '#' || line.empty()) {
+8 -11
View File
@@ -27,23 +27,20 @@
#include <openspace/rendering/renderable.h>
#include <openspace/documentation/documentation.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
namespace ghoul {
namespace filesystem {
class File;
}
}
namespace filesystem { class File; }
namespace opengl {
class ProgramObject;
class Texture;
} // namespace opengl
} // namespace ghoul
namespace openspace {
namespace opengl {
class ProgramObject;
class Texture;
}
namespace documentation { struct Documentation; }
class RenderableStars : public Renderable {
public:
@@ -58,7 +55,7 @@ public:
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
static openspace::Documentation Documentation();
static documentation::Documentation Documentation();
private:
enum ColorOption {