mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-09 21:20:05 -06:00
123 lines
5.2 KiB
C++
123 lines
5.2 KiB
C++
/*****************************************************************************************
|
|
* *
|
|
* OpenSpace *
|
|
* *
|
|
* Copyright (c) 2014-2018 *
|
|
* *
|
|
* 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 __OPENSPACE_MODULE_SOLARBROWSING___RENDERABLESOLARIMAGERY___H__
|
|
#define __OPENSPACE_MODULE_SOLARBROWSING___RENDERABLESOLARIMAGERY___H__
|
|
|
|
#include <openspace/rendering/renderable.h>
|
|
|
|
#include <modules/solarbrowsing/util/spacecraftimagerymanager.h>
|
|
#include <openspace/properties/misc/optionproperty.h>
|
|
#include <openspace/properties/scalar/boolproperty.h>
|
|
#include <openspace/properties/scalar/doubleproperty.h>
|
|
#include <openspace/properties/scalar/floatproperty.h>
|
|
#include <openspace/properties/scalar/intproperty.h>
|
|
#include <openspace/util/timeline.h>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <chrono>
|
|
#include <unordered_set>
|
|
|
|
|
|
namespace ghoul::opengl { class Texture; }
|
|
|
|
namespace openspace {
|
|
|
|
namespace documentation { struct Documentation; }
|
|
|
|
class PixelBufferObject;
|
|
class SpacecraftCameraPlane;
|
|
class TransferFunction;
|
|
|
|
class RenderableSolarImagery : public Renderable {
|
|
public:
|
|
RenderableSolarImagery(const ghoul::Dictionary& dictionary);
|
|
|
|
void initializeGL() override;
|
|
void deinitializeGL() override;
|
|
|
|
bool isReady() const override;
|
|
|
|
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
|
void update(const UpdateData& data) override;
|
|
|
|
static documentation::Documentation Documentation();
|
|
|
|
TransferFunction* getTransferFunction();
|
|
const std::unique_ptr<ghoul::opengl::Texture>& getImageryTexture();
|
|
const SpacecraftCameraPlane& getCameraPlane();
|
|
float getContrastValue();
|
|
float getGammaValue();
|
|
unsigned int getImageResolutionFactor();
|
|
glm::vec2 getCenterPixel();
|
|
float getScale();
|
|
bool isCoronaGraph();
|
|
|
|
private:
|
|
properties::OptionProperty _activeInstruments;
|
|
properties::FloatProperty _contrastValue;
|
|
properties::BoolProperty _enableBorder;
|
|
properties::BoolProperty _enableFrustum;
|
|
properties::FloatProperty _gammaValue;
|
|
properties::DoubleProperty _moveFactor;
|
|
properties::FloatProperty _planeOpacity;
|
|
properties::IntProperty _downsamplingLevel;
|
|
properties::BoolProperty _verboseMode;
|
|
|
|
TransferFunction* _lut = nullptr;
|
|
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
|
|
|
float _imagePlaneOffset = 0.0;
|
|
//double _realTimeDiff; // @TODO: figure out if this is needed
|
|
|
|
bool _isWithinFrustum = false;
|
|
bool _isWithinFrustumLast = true;
|
|
unsigned int _bufferCountOffset = 1;
|
|
unsigned int _imageSize = 32;
|
|
|
|
float _currentScale = 0;
|
|
glm::vec2 _currentCenterPixel = glm::vec2(2.f);
|
|
bool _isCoronaGraph = false;
|
|
|
|
// For debugging
|
|
unsigned int _frameSkipCount = 0;
|
|
|
|
std::unordered_map<std::string, std::shared_ptr<TransferFunction>> _tfMap;
|
|
std::string _currentActiveInstrument;
|
|
ImageMetadata* _currentImage = nullptr;
|
|
std::unordered_map<std::string, Timeline<ImageMetadata>> _imageMetadataMap;
|
|
std::unique_ptr<SpacecraftCameraPlane> _spacecraftCameraPlane;
|
|
std::vector<unsigned char> _decodeBuffer;
|
|
|
|
void updateTextureGPU(bool asyncUpload = true, bool resChanged = false);
|
|
//void listen();
|
|
bool checkBoundaries(const RenderData& data);
|
|
|
|
void decode(unsigned char* buffer, const std::string& fileame);
|
|
};
|
|
|
|
} // namespace openspace
|
|
|
|
#endif // __OPENSPACE_MODULE_SOLARBROWSING___RENDERABLESOLARIMAGERY___H__
|