mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Remove explicit coordinate transformation from RenderableConstellationBounds (closes #300)
This commit is contained in:
@@ -6,8 +6,14 @@ return {
|
||||
Renderable = {
|
||||
Type = "RenderableConstellationBounds",
|
||||
File = "${OPENSPACE_DATA}/scene/constellationbounds/data/bound_20.dat",
|
||||
ConstellationFile = "${OPENSPACE_DATA}/scene/constellationbounds/data/constellations.dat",
|
||||
ReferenceFrame = "J2000"
|
||||
ConstellationFile = "${OPENSPACE_DATA}/scene/constellationbounds/data/constellations.dat"
|
||||
},
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "J2000",
|
||||
DestinationFrame = "GALACTIC"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,13 +79,6 @@ documentation::Documentation RenderableConstellationBounds::Documentation() {
|
||||
"abbreviations and full name of the constellation. If the file is "
|
||||
"omitted, the abbreviations are used as the full names.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyReferenceFrame,
|
||||
new StringVerifier,
|
||||
"The reference frame in which the constellation points are stored in. "
|
||||
"Defaults to <code>J2000< / code>",
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -99,7 +92,6 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
, _constellationFilename("")
|
||||
, _distance("distance", "Distance to the celestial Sphere", 15.f, 0.f, 30.f)
|
||||
, _constellationSelection("constellationSelection", "Constellation Selection")
|
||||
, _originReferenceFrame("")
|
||||
, _vao(0)
|
||||
, _vbo(0)
|
||||
{
|
||||
@@ -115,13 +107,6 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
_constellationFilename = dictionary.value<std::string>(KeyConstellationFile);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(KeyReferenceFrame)) {
|
||||
_originReferenceFrame = dictionary.value<std::string>(KeyReferenceFrame);
|
||||
}
|
||||
else {
|
||||
_originReferenceFrame = DefaultReferenceFrame;
|
||||
}
|
||||
|
||||
addProperty(_distance);
|
||||
addProperty(_constellationSelection);
|
||||
_constellationSelection.onChange(
|
||||
@@ -189,9 +174,15 @@ void RenderableConstellationBounds::render(const RenderData& data) {
|
||||
|
||||
setPscUniforms(*_program.get(), data.camera, data.position);
|
||||
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) *
|
||||
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
|
||||
|
||||
|
||||
_program->setUniform("exponent", _distance);
|
||||
_program->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_program->setUniform("ModelTransform", glm::mat4(glm::dmat4(_stateMatrix)));
|
||||
_program->setUniform("ModelTransform", glm::mat4(modelTransform));
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
for (const ConstellationBound& bound : _constellationBounds) {
|
||||
@@ -207,14 +198,6 @@ void RenderableConstellationBounds::render(const RenderData& data) {
|
||||
_program->deactivate();
|
||||
}
|
||||
|
||||
void RenderableConstellationBounds::update(const UpdateData& data) {
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(
|
||||
_originReferenceFrame,
|
||||
"GALACTIC",
|
||||
data.time.j2000Seconds()
|
||||
);
|
||||
}
|
||||
|
||||
bool RenderableConstellationBounds::loadVertexFile() {
|
||||
if (_vertexFilename.empty()) {
|
||||
return false;
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
@@ -111,11 +110,6 @@ private:
|
||||
/// The property that stores all indices of constellations that should be drawn
|
||||
properties::SelectionProperty _constellationSelection;
|
||||
|
||||
std::string _originReferenceFrame; ///< Reference frame in which bounds are defined
|
||||
|
||||
/// Used to translate between the origin reference frame and the target frame
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user