mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
Solve conflict
This commit is contained in:
@@ -140,6 +140,7 @@ std::vector<Documentation> BaseModule::documentations() const {
|
||||
StaticScale::Documentation(),
|
||||
StaticTranslation::Documentation(),
|
||||
SpiceTranslation::Documentation(),
|
||||
RenderableRings::Documentation(),
|
||||
modelgeometry::ModelGeometry::Documentation(),
|
||||
planetgeometry::PlanetGeometry::Documentation()
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,38 +66,6 @@ public:
|
||||
bool isShadowing;
|
||||
};
|
||||
|
||||
// See: Precomputed Atmospheric Scattering from Bruneton et al.
|
||||
// for explanation of the following parameters.
|
||||
|
||||
const unsigned int TRANSMITTANCE_TABLE_WIDTH = 256;
|
||||
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 64;
|
||||
|
||||
const unsigned int IRRADIANCE_TABLE_WIDTH = 64;
|
||||
const unsigned int IRRADIANCE_TABLE_HEIGHT = 16;
|
||||
|
||||
const unsigned int DELTA_E_TABLE_WIDTH = 64;
|
||||
const unsigned int DELTA_E_TABLE_HEIGHT = 16;
|
||||
|
||||
|
||||
/*const unsigned int TRANSMITTANCE_TABLE_WIDTH = 512;
|
||||
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 128;
|
||||
|
||||
const unsigned int IRRADIANCE_TABLE_WIDTH = 128;
|
||||
const unsigned int IRRADIANCE_TABLE_HEIGHT = 32;
|
||||
|
||||
const unsigned int DELTA_E_TABLE_WIDTH = 128;
|
||||
const unsigned int DELTA_E_TABLE_HEIGHT = 32;*/
|
||||
|
||||
const unsigned int R_SAMPLES = 32;
|
||||
const unsigned int MU_SAMPLES = 128;
|
||||
const unsigned int MU_S_SAMPLES = 32;
|
||||
const unsigned int NU_SAMPLES = 8;
|
||||
|
||||
/*const unsigned int R_SAMPLES = 64;
|
||||
const unsigned int MU_SAMPLES = 256;
|
||||
const unsigned int MU_S_SAMPLES = 64;
|
||||
const unsigned int NU_SAMPLES = 16;*/
|
||||
|
||||
public:
|
||||
explicit RenderablePlanet(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlanet();
|
||||
@@ -111,71 +79,17 @@ public:
|
||||
|
||||
protected:
|
||||
void loadTexture();
|
||||
|
||||
private:
|
||||
void loadComputationPrograms();
|
||||
void unloadComputationPrograms();
|
||||
void createComputationTextures();
|
||||
void deleteComputationTextures();
|
||||
void deleteUnusedComputationTextures();
|
||||
void loadAtmosphereDataIntoShaderProgram(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg);
|
||||
void executeCalculations(const GLuint vao, const GLenum drawBuffers[2], const GLsizei vertexSize);
|
||||
void preCalculateAtmosphereParam();
|
||||
void createAtmosphereFBO();
|
||||
void createRenderQuad(GLuint * vao, GLuint * vbo, const GLfloat size);
|
||||
void renderQuadForCalc(const GLuint vao, const GLsizei size);
|
||||
void step3DTexture(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg,
|
||||
const int layer, const bool doCalc = true);
|
||||
void saveTextureToPPMFile(const GLenum color_buffer_attachment, const std::string & fileName,
|
||||
const int width, const int height) const;
|
||||
|
||||
private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::StringProperty _nightTexturePath;
|
||||
properties::StringProperty _heightMapTexturePath;
|
||||
properties::StringProperty _cloudsTexturePath;
|
||||
properties::StringProperty _reflectanceTexturePath;
|
||||
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _transmittanceProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaEProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaJProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _atmosphereProgramObject;
|
||||
ghoul::opengl::TextureUnit _dummyTextureUnit;
|
||||
ghoul::opengl::TextureUnit _dummy3DTextureUnit;
|
||||
ghoul::opengl::TextureUnit _transmittanceTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _irradianceTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _inScatteringTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaETableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaSRayleighTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaSMieTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaJTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _atmosphereTextureUnit;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _reflectanceTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _heightMapTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _cloudsTexture;
|
||||
GLuint _transmittanceTableTexture;
|
||||
GLuint _irradianceTableTexture;
|
||||
GLuint _inScatteringTableTexture;
|
||||
GLuint _deltaETableTexture;
|
||||
GLuint _deltaSRayleighTableTexture;
|
||||
GLuint _deltaSMieTableTexture;
|
||||
GLuint _deltaJTableTexture;
|
||||
GLuint _dummyTexture;
|
||||
GLuint _dummy3DTexture;
|
||||
GLuint _atmosphereTexture;
|
||||
GLuint _atmosphereFBO;
|
||||
GLuint _atmosphereRenderVAO;
|
||||
GLuint _atmosphereRenderVBO;
|
||||
|
||||
|
||||
properties::FloatProperty _heightExaggeration;
|
||||
|
||||
planetgeometry::PlanetGeometry* _geometry;
|
||||
@@ -189,31 +103,12 @@ private:
|
||||
std::string _frame;
|
||||
std::string _target;
|
||||
bool _hasNightTexture;
|
||||
bool _hasReflectanceTexture;
|
||||
bool _hasHeightTexture;
|
||||
bool _hasCloudsTexture;
|
||||
bool _shadowEnabled;
|
||||
double _time;
|
||||
|
||||
// Atmosphere Data
|
||||
bool _atmosphereCalculated;
|
||||
bool _atmosphereEnabled;
|
||||
float _atmosphereRadius;
|
||||
float _atmospherePlanetRadius;
|
||||
float _planetAverageGroundReflectance;
|
||||
float _rayleighHeightScale;
|
||||
float _mieHeightScale;
|
||||
float _miePhaseConstant;
|
||||
glm::vec3 _mieExtinctionCoeff;
|
||||
glm::vec3 _rayleighScatteringCoeff;
|
||||
glm::vec3 _mieScatteringCoeff;
|
||||
|
||||
|
||||
bool tempPic;
|
||||
|
||||
unsigned int count;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -24,11 +24,10 @@
|
||||
|
||||
#include <modules/base/rendering/renderablerings.h>
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
@@ -37,24 +36,56 @@
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderableRings";
|
||||
|
||||
const std::string KeySize = "Size";
|
||||
const std::string KeyTexture = "Texture";
|
||||
const std::string KeyFrame = "Frame";
|
||||
const std::string KeyOrientation = "Orientation";
|
||||
const std::string KeySize = "Size";
|
||||
const std::string KeyOffset = "Offset";
|
||||
const std::string KeyNightFactor = "NightFactor";
|
||||
const std::string KeyTransparency = "Transparency";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Documentation RenderableRings::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"Renderable Rings",
|
||||
"base_renderable_rings",
|
||||
{
|
||||
{
|
||||
"Type",
|
||||
new StringEqualVerifier("RenderableRings"),
|
||||
"",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
new StringVerifier,
|
||||
"The one dimensional texture that is used for both sides of the ring.",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeySize,
|
||||
new DoubleVerifier,
|
||||
"The radius of the rings in meters.",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyOffset,
|
||||
new DoubleVector2Verifier,
|
||||
"The offset that is used to limit the width of the rings. Each of the "
|
||||
"two values is a value between 0 and 1, where 0 is the center of the "
|
||||
"ring and 1 is the maximum extent at the radius. If this value is, for "
|
||||
"example {0.5, 1.0}, the ring is only shown between radius/2 and radius. "
|
||||
"It defaults to {0.0, 1.0}.",
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath("texture", "Texture")
|
||||
, _size("size", "Size", glm::vec2(1.f, 1.f), glm::vec2(0.f), glm::vec2(1.f, 25.f))
|
||||
, _offset("offset", "Texture Offset", glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _size("size", "Size", 1.f, 0.f, std::pow(1.f, 25.f))
|
||||
, _offset("offset", "Offset", glm::vec2(0, 1.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _nightFactor("nightFactor", "Night Factor", 0.33f, 0.f, 1.f)
|
||||
, _transparency("transparency", "Transparency", 0.15f, 0.f, 1.f)
|
||||
, _shader(nullptr)
|
||||
@@ -65,55 +96,35 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
|
||||
, _vertexPositionBuffer(0)
|
||||
, _planeIsDirty(false)
|
||||
{
|
||||
glm::vec2 size;
|
||||
dictionary.getValue(KeySize, size);
|
||||
_size = size;
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyFrame)) {
|
||||
_frame = dictionary.value<std::string>(KeyFrame);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::mat3>(KeyOrientation)) {
|
||||
_orientation = dictionary.value<glm::mat3>(KeyOrientation);
|
||||
}
|
||||
using ghoul::filesystem::File;
|
||||
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"RenderableRings"
|
||||
);
|
||||
|
||||
_size = dictionary.value<double>(KeySize);
|
||||
setBoundingSphere(PowerScaledScalar::CreatePSS(_size));
|
||||
addProperty(_size);
|
||||
_size.onChange([&]() { _planeIsDirty = true; });
|
||||
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_textureFile = std::make_unique<File>(_texturePath);
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyTexture)) {
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::vec2>(KeyOffset)) {
|
||||
glm::vec2 off = dictionary.value<glm::vec2>(KeyOffset);
|
||||
_offset = off;
|
||||
_offset = dictionary.value<glm::vec2>(KeyOffset);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<float>(KeyNightFactor)) {
|
||||
float v = dictionary.value<float>(KeyNightFactor);
|
||||
_nightFactor = v;
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<float>(KeyTransparency)) {
|
||||
float v = dictionary.value<float>(KeyTransparency);
|
||||
_transparency = v;
|
||||
}
|
||||
|
||||
addProperty(_offset);
|
||||
|
||||
addProperty(_size);
|
||||
_size.onChange([&](){ _planeIsDirty = true; });
|
||||
|
||||
addProperty(_texturePath);
|
||||
_texturePath.onChange([&](){ loadTexture(); });
|
||||
|
||||
_textureFile->setCallback(
|
||||
[&](const ghoul::filesystem::File&) { _textureIsDirty = true; }
|
||||
);
|
||||
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
|
||||
|
||||
addProperty(_nightFactor);
|
||||
|
||||
addProperty(_transparency);
|
||||
|
||||
setBoundingSphere(_size.value());
|
||||
}
|
||||
|
||||
bool RenderableRings::isReady() const {
|
||||
@@ -127,18 +138,14 @@ bool RenderableRings::initialize() {
|
||||
"${MODULE_BASE}/shaders/rings_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/rings_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
_shader->setIgnoreUniformLocationError(
|
||||
ghoul::opengl::ProgramObject::IgnoreError::Yes
|
||||
);
|
||||
}
|
||||
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
glGenVertexArrays(1, &_quad);
|
||||
glGenBuffers(1, &_vertexPositionBuffer);
|
||||
createPlane();
|
||||
|
||||
loadTexture();
|
||||
|
||||
return isReady();
|
||||
@@ -154,11 +161,8 @@ bool RenderableRings::deinitialize() {
|
||||
_textureFile = nullptr;
|
||||
_texture = nullptr;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
OsEng.renderEngine().removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -166,15 +170,27 @@ bool RenderableRings::deinitialize() {
|
||||
void RenderableRings::render(const RenderData& data) {
|
||||
_shader->activate();
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", glm::mat4(_orientation * _state));
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
|
||||
glm::dmat4(data.modelTransform.rotation) *
|
||||
glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)));
|
||||
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
|
||||
_shader->setUniform(
|
||||
"modelViewProjectionTransform",
|
||||
data.camera.projectionMatrix() * glm::mat4(modelViewTransform)
|
||||
);
|
||||
_shader->setUniform("textureOffset", _offset);
|
||||
_shader->setUniform("transparency", _transparency);
|
||||
|
||||
_shader->setUniform("_nightFactor", _nightFactor);
|
||||
_shader->setUniform("sunPosition", _sunPosition);
|
||||
_shader->setUniform(
|
||||
"sunPosition",
|
||||
_sunPosition
|
||||
);
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
setPscUniforms(*_shader, data.camera, data.position);
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
@@ -204,29 +220,26 @@ void RenderableRings::update(const UpdateData& data) {
|
||||
loadTexture();
|
||||
_textureIsDirty = false;
|
||||
}
|
||||
|
||||
if (!_frame.empty()) {
|
||||
_state = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
|
||||
}
|
||||
|
||||
_sunPosition =
|
||||
OsEng.renderEngine().scene()->sceneGraphNode("Sun")->worldPosition() -
|
||||
|
||||
_sunPosition = OsEng.renderEngine().scene()->sceneGraphNode("Sun")->worldPosition() -
|
||||
data.modelTransform.translation;
|
||||
}
|
||||
|
||||
void RenderableRings::loadTexture() {
|
||||
if (_texturePath.value() != "") {
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture =
|
||||
ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");
|
||||
LDEBUGC(
|
||||
"RenderableRings",
|
||||
"Loaded texture from '" << absPath(_texturePath) << "'"
|
||||
);
|
||||
_texture = std::move(texture);
|
||||
|
||||
// Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
// _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
_texture->uploadTexture();
|
||||
_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
|
||||
|
||||
|
||||
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
|
||||
_textureFile->setCallback(
|
||||
[&](const ghoul::filesystem::File&) { _textureIsDirty = true; }
|
||||
@@ -236,28 +249,45 @@ void RenderableRings::loadTexture() {
|
||||
}
|
||||
|
||||
void RenderableRings::createPlane() {
|
||||
// ============================
|
||||
// GEOMETRY (quad)
|
||||
// ============================
|
||||
const GLfloat size = _size.value()[0];
|
||||
const GLfloat w = _size.value()[1];
|
||||
const GLfloat vertex_data[] = {
|
||||
// x y z w s t
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
-size, size, 0.f, w, 0.f, 1.f,
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, -size, 0.f, w, 1.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
const GLfloat size = _size.value();
|
||||
|
||||
struct VertexData {
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
};
|
||||
|
||||
VertexData data[] = {
|
||||
-size, -size, 0.f, 0.f,
|
||||
size, size, 1.f, 1.f,
|
||||
-size, size, 0.f, 1.f,
|
||||
-size, -size, 0.f, 0.f,
|
||||
size, -size, 1.f, 0.f,
|
||||
size, size, 1.f, 1.f,
|
||||
};
|
||||
|
||||
glBindVertexArray(_quad); // bind array
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
|
||||
glBindVertexArray(_quad);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(0));
|
||||
glVertexAttribPointer(
|
||||
0,
|
||||
2,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(VertexData),
|
||||
reinterpret_cast<void*>(0)
|
||||
);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(sizeof(GLfloat) * 4));
|
||||
glVertexAttribPointer(
|
||||
1,
|
||||
2,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(VertexData),
|
||||
reinterpret_cast<void*>(offsetof(VertexData, s))
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
@@ -54,12 +55,14 @@ public:
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
static openspace::Documentation Documentation();
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void createPlane();
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::Vec2Property _size;
|
||||
properties::FloatProperty _size;
|
||||
properties::Vec2Property _offset;
|
||||
properties::FloatProperty _nightFactor;
|
||||
properties::FloatProperty _transparency;
|
||||
@@ -72,11 +75,7 @@ private:
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
bool _planeIsDirty;
|
||||
|
||||
std::string _frame;
|
||||
glm::mat3 _orientation;
|
||||
glm::mat3 _state;
|
||||
|
||||
|
||||
glm::vec3 _sunPosition;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#include <modules/base/rendering/renderablesphere.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -122,7 +121,7 @@ bool RenderableSphere::initialize() {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("Sphere",
|
||||
"${MODULE_BASE}/shaders/sphere_vs.glsl",
|
||||
"${MODULES}/base/shaders/sphere_fs.glsl");
|
||||
"${MODULE_BASE}/shaders/sphere_fs.glsl");
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ in vec4 test;
|
||||
#include "fragment.glsl"
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse = texture(texture1, vs_st);
|
||||
vec4 diffuse2 = texture(nightTex, vs_st);
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ in vec4 vs_position;
|
||||
|
||||
//#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse = texture(texture1, vs_st);
|
||||
|
||||
Fragment frag;
|
||||
|
||||
@@ -48,7 +48,7 @@ void main() {
|
||||
vs_normal = normalize(ModelTransform * vec4(in_normal,0));
|
||||
// vs_normal = vec4(in_normal, 0.0);
|
||||
|
||||
vec4 position = vec4(tmp.xyz * pow(10, tmp. w), 1.0);
|
||||
vec4 position = vec4(tmp.xyz * pow(10, tmp.w), 1.0);
|
||||
position = modelViewProjectionTransform * position;
|
||||
|
||||
vs_position = z_normalization(position);
|
||||
|
||||
@@ -37,9 +37,6 @@ uniform vec3 sunPosition;
|
||||
uniform float _nightFactor;
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
|
||||
// Moving the origin to the center
|
||||
vec2 st = (vs_st - vec2(0.5)) * 2.0;
|
||||
|
||||
@@ -85,7 +82,7 @@ Fragment getFragment() {
|
||||
|
||||
Fragment frag;
|
||||
frag.color = diffuse;
|
||||
frag.depth = depth;
|
||||
frag.depth = vs_position.w;
|
||||
return frag;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,22 +26,30 @@
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 0) in vec2 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
|
||||
out vec2 vs_st;
|
||||
out vec4 vs_position;
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform mat4 modelViewProjectionTransform;
|
||||
|
||||
void main() {
|
||||
vec4 tmp = in_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
vs_position = tmp;
|
||||
vs_st = in_st;
|
||||
|
||||
vs_position = z_normalization(
|
||||
modelViewProjectionTransform * vec4(in_position.xy, 0.0, 1.0)
|
||||
);
|
||||
gl_Position = vs_position;
|
||||
|
||||
// vec4 tmp = in_position;
|
||||
|
||||
|
||||
// vec4 tmp = in_position;
|
||||
// vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
// vs_position = tmp;
|
||||
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
// position = ViewProjection * position;
|
||||
// gl_Position = z_normalization(position);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* 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 __ISWADATAGROUP_H__
|
||||
#define __ISWADATAGROUP_H__
|
||||
|
||||
#include <modules/iswa/rendering/iswagroup.h>
|
||||
|
||||
namespace openspace{
|
||||
class IswaDataGroup : public IswaBaseGroup{
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class IswaDataGroup : public IswaBaseGroup {
|
||||
public:
|
||||
IswaDataGroup(std::string name, std::string type);
|
||||
~IswaDataGroup();
|
||||
|
||||
@@ -132,7 +132,7 @@ void RenderableCrawlingLine::render(const RenderData& data) {
|
||||
_program->setUniform("ModelTransform", transform);
|
||||
|
||||
int frame = _frameCounter % 60;
|
||||
float fadingFactor = static_cast<float>(sin((frame * pi_c()) / 60));
|
||||
float fadingFactor = static_cast<float>(sin((frame * 3.14159) / 60));
|
||||
float alpha = 0.6f + fadingFactor*0.4f;
|
||||
|
||||
glLineWidth(2.f);
|
||||
|
||||
@@ -265,7 +265,7 @@ psc RenderableFov::checkForIntercept(glm::dvec3 ray) {
|
||||
|
||||
ivec *= 0.9999;// because fov lands exactly on top of surface we need to move it out slightly
|
||||
_interceptVector = PowerScaledCoordinate::CreatePowerScaledCoordinate(ivec[0], ivec[1], ivec[2]);
|
||||
_interceptVector[3] += 3;
|
||||
//_interceptVector[3] += 3;
|
||||
|
||||
return _interceptVector;
|
||||
}
|
||||
@@ -519,7 +519,7 @@ void RenderableFov::computeIntercepts(const RenderData& data) {
|
||||
|
||||
if (_interceptTag[r]) {
|
||||
_interceptVector = PowerScaledCoordinate::CreatePowerScaledCoordinate(ivec[0], ivec[1], ivec[2]);
|
||||
_interceptVector[3] += 3;
|
||||
//_interceptVector[3] += 3;
|
||||
// INTERCEPTIONS
|
||||
insertPoint(_fovBounds, fovOrigin, col_start);
|
||||
insertPoint(_fovBounds, _interceptVector.vec4(), col_end);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/framebufferobject.h>
|
||||
#include <ghoul/opengl/textureconversion.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
#include <ghoul/systemcapabilities/openglcapabilitiescomponent.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <modules/onscreengui/include/guicomponent.h>
|
||||
|
||||
#include <ghoul/misc/sharedmemory.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ghoul {
|
||||
|
||||
@@ -72,16 +72,16 @@ void renderOptionProperty(Property* prop, const std::string& ownerName) {
|
||||
int value = *p;
|
||||
std::vector<OptionProperty::Option> options = p->options();
|
||||
switch (p->displayType()) {
|
||||
case OptionProperty::DisplayType::RADIO: {
|
||||
case OptionProperty::DisplayType::Radio: {
|
||||
ImGui::Text(name.c_str());
|
||||
ImGui::Separator();
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
ImGui::RadioButton(name.c_str(), &value, o.value);
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(o.description.c_str());
|
||||
ImGui::RadioButton(o.description.c_str(), &value, o.value);
|
||||
renderTooltip(prop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OptionProperty::DisplayType::DROPDOWN: {
|
||||
case OptionProperty::DisplayType::Dropdown: {
|
||||
std::string nodeNames = "";
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
nodeNames += o.description + '\0';
|
||||
|
||||
Reference in New Issue
Block a user