mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-28 23:09:32 -05:00
Update RenderableGlobe to use transformation from SceneGraphnNode and fix bug in SpiceRotation.
This commit is contained in:
@@ -155,15 +155,6 @@ namespace openspace {
|
||||
stats.startNewRecord();
|
||||
|
||||
int j2000s = Time::now().unsyncedJ2000Seconds();
|
||||
/*
|
||||
int lastJ2000s = stats.i.previous("time");
|
||||
if (j2000s == lastJ2000s) {
|
||||
stats.disable();
|
||||
}
|
||||
else {
|
||||
stats.enable();
|
||||
}
|
||||
*/
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
|
||||
@@ -197,11 +188,9 @@ namespace openspace {
|
||||
_leftRoot->reverseBreadthFirst(renderJob);
|
||||
_rightRoot->reverseBreadthFirst(renderJob);
|
||||
|
||||
|
||||
if (_savedCamera != nullptr) {
|
||||
DebugRenderer::ref().renderCameraFrustum(data, *_savedCamera);
|
||||
}
|
||||
|
||||
|
||||
//LDEBUG("min distnace to camera: " << minDistToCamera);
|
||||
|
||||
@@ -242,24 +231,16 @@ namespace openspace {
|
||||
}
|
||||
|
||||
void ChunkedLodGlobe::update(const UpdateData& data) {
|
||||
_modelTransform =
|
||||
translate(dmat4(1), data.position) * // Translation
|
||||
dmat4(stateMatrix()); // Rotation
|
||||
glm::dmat4 translation = glm::translate(glm::dmat4(1.0), data.position);
|
||||
glm::dmat4 rotation = glm::dmat4(data.rotation);
|
||||
glm::dmat4 scaling = glm::scale(glm::dmat4(1.0), glm::dvec3(data.scale, data.scale, data.scale));
|
||||
|
||||
_modelTransform = translation * rotation * scaling;
|
||||
_inverseModelTransform = glm::inverse(_modelTransform);
|
||||
|
||||
_renderer->update();
|
||||
}
|
||||
|
||||
void ChunkedLodGlobe::setStateMatrix(const glm::dmat3& stateMatrix)
|
||||
{
|
||||
_stateMatrix = stateMatrix;
|
||||
}
|
||||
|
||||
const glm::dmat3& ChunkedLodGlobe::stateMatrix()
|
||||
{
|
||||
return _stateMatrix;
|
||||
}
|
||||
|
||||
const glm::dmat4& ChunkedLodGlobe::modelTransform() {
|
||||
return _modelTransform;
|
||||
}
|
||||
|
||||
@@ -76,16 +76,12 @@ namespace openspace {
|
||||
const ChunkNode& findChunkNode(const Geodetic2 location) const;
|
||||
ChunkNode& findChunkNode(const Geodetic2 location);
|
||||
|
||||
void setStateMatrix(const glm::dmat3& stateMatrix);
|
||||
|
||||
bool testIfCullable(const Chunk& chunk, const RenderData& renderData) const;
|
||||
int getDesiredLevel(const Chunk& chunk, const RenderData& renderData) const;
|
||||
|
||||
double minDistToCamera;
|
||||
|
||||
//Scalar globeRadius;
|
||||
const Ellipsoid& ellipsoid() const;
|
||||
const glm::dmat3& stateMatrix();
|
||||
const glm::dmat4& modelTransform();
|
||||
const glm::dmat4& inverseModelTransform();
|
||||
|
||||
@@ -145,7 +141,6 @@ namespace openspace {
|
||||
std::unique_ptr<ChunkLevelEvaluator> _chunkEvaluatorByDistance;
|
||||
|
||||
const Ellipsoid& _ellipsoid;
|
||||
glm::dmat3 _stateMatrix;
|
||||
glm::dmat4 _modelTransform;
|
||||
glm::dmat4 _inverseModelTransform;
|
||||
|
||||
|
||||
@@ -370,7 +370,6 @@ namespace openspace {
|
||||
Geodetic2 swCorner = chunk.surfacePatch().getCorner(Quad::SOUTH_WEST);
|
||||
auto patchSize = chunk.surfacePatch().size();
|
||||
|
||||
// TODO : Model transform should be fetched as a matrix directly.
|
||||
dmat4 modelTransform = chunk.owner()->modelTransform();
|
||||
dmat4 viewTransform = data.camera.combinedViewMatrix();
|
||||
mat4 modelViewTransform = mat4(viewTransform * modelTransform);
|
||||
|
||||
Reference in New Issue
Block a user