mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 13:08:49 -05:00
Merge branch 'master' into feature/loadingscreen-refactor
# Conflicts: # modules/base/rendering/renderabletrailorbit.h # modules/digitaluniverse/rendering/renderablebillboardscloud.cpp # modules/digitaluniverse/rendering/renderableplanescloud.cpp # modules/digitaluniverse/rendering/renderablepoints.cpp # modules/galaxy/rendering/renderablegalaxy.cpp # modules/galaxy/rendering/renderablegalaxy.h # modules/kameleonvolume/rendering/renderablekameleonvolume.cpp # modules/kameleonvolume/rendering/renderablekameleonvolume.h # modules/spacecraftinstruments/rendering/renderablefov.h # modules/spacecraftinstruments/rendering/renderableplaneprojection.h # modules/toyvolume/rendering/renderabletoyvolume.cpp # modules/toyvolume/rendering/renderabletoyvolume.h # modules/volume/rendering/renderabletimevaryingvolume.cpp # modules/volume/rendering/renderabletimevaryingvolume.h
This commit is contained in:
@@ -78,7 +78,7 @@ std::unique_ptr<ModelGeometry> ModelGeometry::createFromDictionary(
|
||||
}
|
||||
|
||||
const std::string geometryType = dictionary.value<std::string>(KeyType);
|
||||
|
||||
|
||||
auto factory = FactoryManager::ref().factory<ModelGeometry>();
|
||||
return factory->create(geometryType, dictionary);;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ bool ModelGeometry::initialize(Renderable* parent) {
|
||||
if (_vertices.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
glGenVertexArrays(1, &_vaoID);
|
||||
glGenBuffers(1, &_vbo);
|
||||
glGenBuffers(1, &_ibo);
|
||||
|
||||
@@ -53,11 +53,11 @@ public:
|
||||
|
||||
ModelGeometry(const ghoul::Dictionary& dictionary);
|
||||
virtual ~ModelGeometry() = default;
|
||||
|
||||
|
||||
virtual bool initialize(Renderable* parent);
|
||||
virtual void deinitialize();
|
||||
void render();
|
||||
|
||||
|
||||
virtual bool loadModel(const std::string& filename) = 0;
|
||||
void changeRenderMode(const GLenum mode);
|
||||
//bool getVertices(std::vector<Vertex>* vertexList);
|
||||
|
||||
@@ -40,7 +40,7 @@ bool MultiModelGeometry::loadModel(const std::string& filename) {
|
||||
std::vector<ghoul::io::ModelReaderBase::Vertex> vertices;
|
||||
std::vector<int> indices;
|
||||
ghoul::io::ModelReaderMultiFormat().loadModel(filename, vertices, indices);
|
||||
|
||||
|
||||
_vertices.reserve(vertices.size());
|
||||
for (const ghoul::io::ModelReaderBase::Vertex& v : vertices) {
|
||||
Vertex vv;
|
||||
|
||||
@@ -183,7 +183,7 @@ void RenderableModel::deinitializeGL() {
|
||||
|
||||
void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
|
||||
@@ -107,7 +107,6 @@ documentation::Documentation RenderablePlane::Documentation() {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath(TextureInfo)
|
||||
@@ -237,7 +236,7 @@ void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_shader->setUniform("modelViewProjectionTransform",
|
||||
data.camera.projectionMatrix() * glm::mat4(modelViewTransform));
|
||||
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
@@ -330,7 +329,7 @@ void RenderablePlane::createPlane() {
|
||||
sizeof(GLfloat) * 6,
|
||||
nullptr
|
||||
);
|
||||
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(
|
||||
1,
|
||||
|
||||
@@ -259,13 +259,13 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
float distCamera = glm::distance(data.camera.positionVec3(), data.position.dvec3());
|
||||
double term = std::exp((-distCamera + _size * _fadeOutThreshold) / (_size * _fadeOutThreshold));
|
||||
|
||||
|
||||
_shader->setUniform("alpha", _transparency * static_cast<float>(term / (term + 1.0)));
|
||||
}
|
||||
else {
|
||||
_shader->setUniform("alpha", _transparency);
|
||||
}
|
||||
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
@@ -273,7 +273,7 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
|
||||
bool usingFramebufferRenderer =
|
||||
OsEng.renderEngine().rendererImplementation() == RenderEngine::RendererImplementation::Framebuffer;
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) {
|
||||
bool usingFramebufferRenderer =
|
||||
OsEng.renderEngine().rendererImplementation() ==
|
||||
RenderEngine::RendererImplementation::Framebuffer;
|
||||
|
||||
|
||||
if (usingFramebufferRenderer) {
|
||||
glDepthMask(false);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
@@ -394,7 +394,7 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) {
|
||||
if (renderPoints) {
|
||||
glDisable(GL_PROGRAM_POINT_SIZE);
|
||||
}
|
||||
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
if (usingFramebufferRenderer) {
|
||||
|
||||
@@ -91,7 +91,7 @@ protected:
|
||||
|
||||
/// Returns the documentation entries that the con
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
/// The layout of the VBOs
|
||||
struct TrailVBOLayout {
|
||||
float x, y, z;
|
||||
|
||||
@@ -382,7 +382,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
// The previously oldest permanent point has been moved nNewPoints steps into the
|
||||
// future
|
||||
_firstPointTime += nNewPoints * secondsPerPoint;
|
||||
|
||||
|
||||
return { true, nNewPoints };
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace openspace {
|
||||
|
||||
documentation::Documentation RenderableTrailTrajectory::Documentation() {
|
||||
using namespace documentation;
|
||||
|
||||
|
||||
documentation::Documentation doc {
|
||||
"RenderableTrailTrajectory",
|
||||
"base_renderable_renderabletrailtrajectory",
|
||||
@@ -244,7 +244,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
|
||||
|
||||
// We clear the indexArray just in case. The base class will take care not to use
|
||||
// it if it is empty
|
||||
_indexArray.clear();
|
||||
@@ -252,7 +252,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
|
||||
_subsamplingIsDirty = true;
|
||||
_needsFullSweep = false;
|
||||
}
|
||||
|
||||
|
||||
// This has to be done every update step;
|
||||
if (_renderFullTrail) {
|
||||
// If the full trail should be rendered at all times, we can directly render the
|
||||
@@ -280,7 +280,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
|
||||
_vertexArray[_primaryRenderInformation.count - 1].y,
|
||||
_vertexArray[_primaryRenderInformation.count - 1].z
|
||||
);
|
||||
|
||||
|
||||
// And get the current location of the object
|
||||
glm::dvec3 p = _translation->position(data.time.j2000Seconds());
|
||||
glm::dvec3 v1 = { p.x, p.y, p.z };
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void deinitializeGL() override;
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
|
||||
@@ -107,7 +107,7 @@ void ScreenSpaceFramebuffer::render() {
|
||||
);
|
||||
GLint defaultFBO = _framebuffer->getActiveObject();
|
||||
_framebuffer->activate();
|
||||
|
||||
|
||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
@@ -123,7 +123,7 @@ void ScreenSpaceFramebuffer::render() {
|
||||
static_cast<GLsizei>(resolution.x),
|
||||
static_cast<GLsizei>(resolution.y)
|
||||
);
|
||||
|
||||
|
||||
glm::mat4 rotation = rotationMatrix();
|
||||
glm::mat4 translation = translationMatrix();
|
||||
glm::mat4 scale = scaleMatrix();
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void setSize(glm::vec4);
|
||||
void addRenderFunction(std::shared_ptr<std::function<void()>> renderFunction);
|
||||
void removeAllRenderFunctions();
|
||||
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class ScreenSpaceImageLocal : public ScreenSpaceRenderable {
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class ScreenSpaceImageOnline : public ScreenSpaceRenderable {
|
||||
|
||||
@@ -107,7 +107,6 @@ bool WavefrontGeometry::loadModel(const std::string& filename) {
|
||||
_vertices[j + currentPosition].tex[0] = shapes[i].mesh.texcoords[2 * j + 0];
|
||||
_vertices[j + currentPosition].tex[1] = shapes[i].mesh.texcoords[2 * j + 1];
|
||||
}
|
||||
|
||||
}
|
||||
currentPosition += shapes[i].mesh.positions.size() / 3;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void LuaRotation::update(const UpdateData& data) {
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
);
|
||||
|
||||
|
||||
// Execute the scaling function
|
||||
int success = lua_pcall(_state, 2, 9, 0);
|
||||
if (success != 0) {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#include <ghoul/lua/luastate.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class LuaRotation : public Rotation {
|
||||
public:
|
||||
LuaRotation();
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include <openspace/properties/matrix/dmat3property.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class StaticRotation : public Rotation {
|
||||
public:
|
||||
StaticRotation();
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
private:
|
||||
properties::DMat3Property _rotationMatrix;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___STATICROTATION___H__
|
||||
|
||||
@@ -103,7 +103,7 @@ void LuaScale::update(const UpdateData& data) {
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
);
|
||||
|
||||
|
||||
// Execute the scaling function
|
||||
int success = lua_pcall(_state, 2, 1, 0);
|
||||
if (success != 0) {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#include <ghoul/lua/luastate.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class LuaScale : public Scale {
|
||||
public:
|
||||
LuaScale();
|
||||
|
||||
@@ -66,7 +66,7 @@ StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
|
||||
: StaticScale()
|
||||
{
|
||||
documentation::testSpecificationAndThrow(Documentation(), dictionary, "StaticScale");
|
||||
|
||||
|
||||
_scaleValue = static_cast<float>(dictionary.value<double>(ScaleInfo.identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class StaticScale : public Scale {
|
||||
public:
|
||||
StaticScale();
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
private:
|
||||
properties::FloatProperty _scaleValue;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___STATICSCALE___H__
|
||||
|
||||
@@ -120,7 +120,7 @@ void LuaTranslation::update(const UpdateData& data) {
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
);
|
||||
|
||||
|
||||
// Execute the scaling function
|
||||
int success = lua_pcall(_state, 2, 3, 0);
|
||||
if (success != 0) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class LuaTranslation : public Translation {
|
||||
public:
|
||||
LuaTranslation();
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
|
||||
std::unique_ptr<ghoul::filesystem::File> _fileHandle;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
|
||||
class StaticTranslation : public Translation {
|
||||
public:
|
||||
StaticTranslation();
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
private:
|
||||
properties::DVec3Property _position;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___STATICTRANSLATION___H__
|
||||
|
||||
Reference in New Issue
Block a user