mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 01:09:34 -05:00
Cleanup for coding style
Add strict mode to check_style_guide script
This commit is contained in:
@@ -93,7 +93,7 @@ ChunkedLodGlobe::ChunkedLodGlobe(const RenderableGlobe& owner, size_t segmentsPe
|
||||
// The destructor is defined here to make it feasiable to use a unique_ptr
|
||||
// with a forward declaration
|
||||
ChunkedLodGlobe::~ChunkedLodGlobe() {}
|
||||
|
||||
|
||||
bool ChunkedLodGlobe::isReady() const {
|
||||
return true;
|
||||
}
|
||||
@@ -144,14 +144,14 @@ int ChunkedLodGlobe::getDesiredLevel(
|
||||
desiredLevel = glm::clamp(desiredLevel, minSplitDepth, maxSplitDepth);
|
||||
return desiredLevel;
|
||||
}
|
||||
|
||||
|
||||
float ChunkedLodGlobe::getHeight(glm::dvec3 position) const {
|
||||
float height = 0;
|
||||
|
||||
|
||||
// Get the uv coordinates to sample from
|
||||
Geodetic2 geodeticPosition = _owner.ellipsoid().cartesianToGeodetic2(position);
|
||||
int chunkLevel = findChunkNode(geodeticPosition).getChunk().tileIndex().level;
|
||||
|
||||
|
||||
TileIndex tileIndex = TileIndex(geodeticPosition, chunkLevel);
|
||||
GeodeticPatch patch = GeodeticPatch(tileIndex);
|
||||
|
||||
@@ -167,7 +167,7 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const {
|
||||
// Get the tile providers for the height maps
|
||||
const std::vector<std::shared_ptr<Layer>>& heightMapLayers =
|
||||
_layerManager->layerGroup(layergroupid::GroupID::HeightLayers).activeLayers();
|
||||
|
||||
|
||||
for (const std::shared_ptr<Layer>& layer : heightMapLayers) {
|
||||
tileprovider::TileProvider* tileProvider = layer->tileProvider();
|
||||
if (!tileProvider) {
|
||||
@@ -199,7 +199,7 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const {
|
||||
// in range [0,1] and uses the set interpolation method and clamping.
|
||||
|
||||
glm::uvec3 dimensions = tileTexture->dimensions();
|
||||
|
||||
|
||||
glm::vec2 samplePos = transformedUv * glm::vec2(dimensions);
|
||||
glm::uvec2 samplePos00 = samplePos;
|
||||
samplePos00 = glm::clamp(
|
||||
@@ -239,7 +239,7 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const {
|
||||
sample01 == tileProvider->noDataValueAsFloat() ||
|
||||
sample10 == tileProvider->noDataValueAsFloat() ||
|
||||
sample11 == tileProvider->noDataValueAsFloat();
|
||||
|
||||
|
||||
if (anySampleIsNaN || anySampleIsNoData) {
|
||||
continue;
|
||||
}
|
||||
@@ -253,8 +253,7 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const {
|
||||
// if the sample is actually a no-data-value (min_float) the interpolated
|
||||
// value might not be. Therefore we have a cut-off. Assuming no data value
|
||||
// is smaller than -100000
|
||||
if (sample > -100000)
|
||||
{
|
||||
if (sample > -100000) {
|
||||
// Perform depth transform to get the value in meters
|
||||
height = depthTransform.depthOffset + depthTransform.depthScale * sample;
|
||||
// Make sure that the height value follows the layer settings.
|
||||
@@ -282,7 +281,7 @@ void ChunkedLodGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
_renderer->recompileShaders(_owner);
|
||||
_shadersNeedRecompilation = false;
|
||||
}
|
||||
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
|
||||
stats.i["time"] = millis;
|
||||
@@ -311,7 +310,7 @@ void ChunkedLodGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_leftRoot->breadthFirst(renderJob);
|
||||
_rightRoot->breadthFirst(renderJob);
|
||||
|
||||
|
||||
//_leftRoot->reverseBreadthFirst(renderJob);
|
||||
//_rightRoot->reverseBreadthFirst(renderJob);
|
||||
|
||||
@@ -328,7 +327,7 @@ void ChunkedLodGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp
|
||||
chunk.getBoundingPolyhedronCorners();
|
||||
std::vector<glm::vec4> clippingSpaceCorners(8);
|
||||
AABB3 screenSpaceBounds;
|
||||
|
||||
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
const glm::vec4& clippingSpaceCorner = mvp * modelSpaceCorners[i];
|
||||
clippingSpaceCorners[i] = clippingSpaceCorner;
|
||||
@@ -359,5 +358,5 @@ void ChunkedLodGlobe::update(const UpdateData& data) {
|
||||
));
|
||||
_renderer->update();
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
namespace chunklevelevaluator { class Evaluator; }
|
||||
|
||||
|
||||
namespace culling { class ChunkCuller; }
|
||||
|
||||
class Chunk;
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
ChunkedLodGlobe(const RenderableGlobe& owner, size_t segmentsPerPatch,
|
||||
std::shared_ptr<LayerManager> layerManager);
|
||||
~ChunkedLodGlobe();
|
||||
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
* its siblings.
|
||||
*/
|
||||
int getDesiredLevel(const Chunk& chunk, const RenderData& renderData) const;
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the height from the surface of the reference ellipsoid to the
|
||||
* heigh mapped surface.
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
std::shared_ptr<LayerManager> layerManager() const;
|
||||
|
||||
StatsCollector stats;
|
||||
|
||||
|
||||
private:
|
||||
void debugRenderChunk(const Chunk& chunk, const glm::dmat4& data) const;
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
static const TileIndex RIGHT_HEMISPHERE_INDEX;
|
||||
|
||||
const RenderableGlobe& _owner;
|
||||
|
||||
|
||||
// Covers all negative longitudes
|
||||
std::unique_ptr<ChunkNode> _leftRoot;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void PointGlobe::initialize() {
|
||||
glm::vec2(1.0f, -1.0f),
|
||||
glm::vec2(1.0f, 1.0f)
|
||||
}};
|
||||
|
||||
|
||||
// Vertex buffer
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferID);
|
||||
glBufferData(
|
||||
@@ -108,7 +108,7 @@ void PointGlobe::deinitialize() {
|
||||
bool PointGlobe::isReady() const {
|
||||
return (_vaoID != 0) && (_vertexBufferID != 0);
|
||||
}
|
||||
|
||||
|
||||
void PointGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
|
||||
@@ -119,7 +119,7 @@ void PointGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
glm::dvec3(0.0f),
|
||||
data.camera.positionVec3() - bodyPosition,
|
||||
glm::normalize(glm::dvec3(1000000.0f) - bodyPosition));
|
||||
|
||||
|
||||
glm::dvec3 camToBody = bodyPosition - data.camera.positionVec3();
|
||||
float distanceToBody = static_cast<float>(glm::length(camToBody));
|
||||
|
||||
@@ -132,7 +132,7 @@ void PointGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
float billboardRadius = lightIntensityClamped * distanceToBody;
|
||||
glm::dmat4 scaleTransform = glm::scale(glm::dmat4(1.0), glm::dvec3(billboardRadius));
|
||||
|
||||
|
||||
setBoundingSphere(billboardRadius);
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
@@ -143,29 +143,29 @@ void PointGlobe::render(const RenderData& data, RendererTasks&) {
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
//glm::vec3 directionToSun = glm::normalize(glm::vec3(0) - glm::vec3(bodyPosition));
|
||||
//glm::vec3 directionToSunViewSpace = glm::mat3(data.camera.combinedViewMatrix()) * directionToSun;
|
||||
|
||||
|
||||
|
||||
|
||||
_programObject->setUniform("lightIntensityClamped", lightIntensityClamped);
|
||||
//_programObject->setUniform("lightOverflow", lightOverflow);
|
||||
//_programObject->setUniform("directionToSunViewSpace", directionToSunViewSpace);
|
||||
_programObject->setUniform("modelViewTransform", glm::mat4(modelViewTransform));
|
||||
_programObject->setUniform("projectionTransform", data.camera.sgctInternal.projectionMatrix());
|
||||
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vertexBufferID);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glBindVertexArray(0);
|
||||
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
|
||||
|
||||
private:
|
||||
const RenderableGlobe& _owner;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/globes/renderableglobe.h>
|
||||
|
||||
|
||||
#include <modules/debugging/rendering/debugrenderer.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
#include <modules/globebrowsing/globes/pointglobe.h>
|
||||
@@ -182,7 +182,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
, _debugPropertyOwner({ "Debug" })
|
||||
{
|
||||
setName("RenderableGlobe");
|
||||
|
||||
|
||||
dictionary.getValue(keyFrame, _frame);
|
||||
|
||||
// Read the radii in to its own dictionary
|
||||
@@ -216,17 +216,17 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
_layerManager
|
||||
);
|
||||
//_pointGlobe = std::make_shared<PointGlobe>(*this);
|
||||
|
||||
|
||||
_distanceSwitch.addSwitchValue(_chunkedLodGlobe);
|
||||
//_distanceSwitch.addSwitchValue(_pointGlobe);
|
||||
|
||||
|
||||
addProperty(_generalProperties.atmosphereEnabled);
|
||||
addProperty(_generalProperties.performShading);
|
||||
addProperty(_generalProperties.useAccurateNormals);
|
||||
addProperty(_generalProperties.lodScaleFactor);
|
||||
addProperty(_generalProperties.cameraMinHeight);
|
||||
addProperty(_generalProperties.orenNayarRoughness);
|
||||
|
||||
|
||||
_debugPropertyOwner.addProperty(_debugProperties.saveOrThrowCamera);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.showChunkEdges);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.showChunkBounds);
|
||||
@@ -242,7 +242,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
_debugPropertyOwner.addProperty(_debugProperties.collectStats);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.limitLevelByAvailableData);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.modelSpaceRenderingCutoffLevel);
|
||||
|
||||
|
||||
auto notifyShaderRecompilation = [&](){
|
||||
_chunkedLodGlobe->notifyShaderRecompilation();
|
||||
};
|
||||
@@ -357,7 +357,7 @@ const RenderableGlobe::DebugProperties&
|
||||
RenderableGlobe::debugProperties() const{
|
||||
return _debugProperties;
|
||||
}
|
||||
|
||||
|
||||
const RenderableGlobe::GeneralProperties&
|
||||
RenderableGlobe::generalProperties() const{
|
||||
return _generalProperties;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
properties::BoolProperty limitLevelByAvailableData;
|
||||
properties::IntProperty modelSpaceRenderingCutoffLevel;
|
||||
};
|
||||
|
||||
|
||||
struct GeneralProperties {
|
||||
properties::BoolProperty performShading;
|
||||
properties::BoolProperty atmosphereEnabled;
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
properties::FloatProperty cameraMinHeight;
|
||||
properties::FloatProperty orenNayarRoughness;
|
||||
};
|
||||
|
||||
|
||||
RenderableGlobe(const ghoul::Dictionary& dictionary);
|
||||
~RenderableGlobe() = default;
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
// Getters that perform calculations
|
||||
glm::dvec3 projectOnEllipsoid(glm::dvec3 position);
|
||||
float getHeight(glm::dvec3 position);
|
||||
|
||||
|
||||
// Getters
|
||||
std::shared_ptr<ChunkedLodGlobe> chunkedLodGlobe() const;
|
||||
LayerManager* layerManager() const;
|
||||
@@ -119,7 +119,7 @@ private:
|
||||
std::shared_ptr<LayerManager> _layerManager;
|
||||
DistanceSwitch _distanceSwitch;
|
||||
std::shared_ptr<Camera> _savedCamera;
|
||||
|
||||
|
||||
std::string _frame;
|
||||
double _time;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user