mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-02 01:30:34 -06:00
* Start refactoring billboardscloud renderable * Remove extra unit computation in geometry shader * More refactor and fix size parameter not working without colormap (it never did) * Remove redundant bool in shader * Divide settings into property owners * Refactor colormap * More refactoring (utilize properties for visiblity) * Remove redundant extra data structures for options * Move data logic to the colormap settings structure * Remove confusing correction size properties * Separate polygon cloud into its own renderable * Clean up some unused code * Update some property descriptions * Split some more code out into functions * Remove odd and unused "linear filtering" Should be reimplemented ina better way in a general color map overhaul * Start refactoring some more properties * Make color optional and remove redundant color assignments in assets * Refactor color-parameter input and make range mapping work correctly * Code cleanup (unused code and fix data types) * Rename ScaleFactor to ScaleExponent * Add a scale factor as well, as they're easier to use, and clarify documentation * Fix faultily renamed scale factors * Remove confusing multiplication for scale exponent * Fix problem with points not appearing when _drawElements was set to true * Move all colormapsettings into its own table in the asset files * Move scaling/sizing into its own table as well * Group sizing properties and remove min pixel size limit (was always zero) * Add some docs and rename a parameter to avoid repetition * Remove IsExact colormap and add an option to hide outliers OBS! Still need to update the actual cmap files * Add property to disable size mapping * Increase pixel size of polyon texture - reduces jagged edges * Remove unused points class * Rename files and billboard class, to make it clearer that it is a point cloud * Move size mapping into size settings * Move color map properties out into its own component * Move color map related computations into the new component * Add outlier colors, to cover some specific color mapping issues * Automatically fill parameter options if no colormap parameters were defined * Move all color-related parameters to under one property owner * Inlcude changes from matrix maintenance * Add a checkbox to disable additive blending * Remove a unused variable in shader * DO color maping on the graphics card instead of CPU, using a texture * WIP remove old "Outliers" and start introducing concept of no data colors instead * Move speck loader to core and divide into a general data loader and a speck specific loader (In preparation for adding CSV support) * More labelscomponent to core * Fix a faulty header * Handle NaN values * Rename color map component property owner It's not just the color map, but the settings for the entire mapping * Hide point with nan value is show missing data is not selected * Fix labels component documentation after move * Add option to not provide any texture, and use a sphere generated form the shader * Don't crash when loading unsupported data formats :) * Add some TODO comments that should be addressed before merge * Move renderables from DU module to base, and do some header cleanup * Move colormapping component to core ad rename it to make it clear that it is not the color map itself * Add above, below and nan color values to cmap loading * Remove missing Data value specs in asset (and use belowRange in cmap instead) * Make warning about wrong color number more verbose * Add TODO comment about colormap, and actually used color in prev version, to localdwarfs * WIP: Load CSV files * Update some property visbility * Check if chosen parameter options actually exist * Fix fault column check * Update example asset to cover more different cases * Use new asset.resource loading * Update asset versions (major update) * Add parent documentation for RenderablePolygonCloud * Add point cloud example with size scaling and add TODO comment * Add example with textured points * Don't blend textured points * Fix problem with shaders being confused about texture units * Bring back deepsky points color * Start implementing more sophisticated datamapping for point data files * Allow reading datamapping from input dictionary * Load dataset in constructor instead Solves problem with color map columns not loading for big datasets when loaded the first time * Fix crash from reading column value that is interpreted as inf * Inlcude information about data mapping when caching dataset Updating the parameters now leads to an updated caching of the data file * Adapt to tolower update * Add option to specify columns to exclude in load (for CSV files) * Start updating some docs * Add a readonly property that shows the number of data points * Rename example asset to shorter name * Add option for not using cache when loading dataset * Fix some errors in example asset * Set scaleExponent from max position if not specified That way the points are always visible, even when no exponent is given * Restructure and add explanations in example asset * Add option to not cache labels component data file * Add example file with labels and units * Compute fade distances in model coordinates instead of world space (issue #1746) * Add possiblity to invert fading and add exmaple asset * Make a separate propertyowner for fading settings * Update docs * Add example asset with custom data mapping * Address some of my own review comments * Read provided Parameter from asset * Read ValueRange from asset * Add example asset for more advanced color mapping settings * Allow using the same column for two position coordinate axes * Update src/rendering/colormappingcomponent.cpp Co-authored-by: Alexander Bock <alexander.bock@liu.se> * Update src/data/datamapping.cpp * Use helper function for tolowercase * Simplify some std::optional handling, and fix broken assignment from code review fix * Update data file versions to get updated cmap files * Include a progress bar to show progress of CSV data loading * Update csv data-to-float parsing for clang * Add a description about why `openspace.absPath` is used in the file instead of `asset.resource` * Apply suggestions from code review * Apply suggestions from code review * Add some missing info in documentation * Place size-related property descriptions next to each other * Remove the explicitly set renderbin * Fix overly complicated description * Fix polygon texture not being used * Add polygon cloud example * only bind texture and activate texture unit when required * Rename alpha to opacity in shader * Fix value range not loading, and make first parameter in list the default * Rename Pixel Size property * Use base 10 for scale exponent instead of base e * Update src/data/datamapping.cpp * Update modules/base/shaders/billboardpoint_gs.glsl * Remove some redundant asset settings (Home label) * Review comments * Add TODO comment for localdwarfs asset (Speck file reading problems) * Oops, forgot part of the comment * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> * More code review fixes * Fix faulty isReady check when labels are included * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> * More code review updates --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
284 lines
14 KiB
C++
284 lines
14 KiB
C++
/*****************************************************************************************
|
|
* *
|
|
* OpenSpace *
|
|
* *
|
|
* Copyright (c) 2014-2023 *
|
|
* *
|
|
* 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. *
|
|
****************************************************************************************/
|
|
|
|
#include <modules/base/basemodule.h>
|
|
|
|
#include <modules/base/dashboard/dashboarditemangle.h>
|
|
#include <modules/base/dashboard/dashboarditemdate.h>
|
|
#include <modules/base/dashboard/dashboarditemdistance.h>
|
|
#include <modules/base/dashboard/dashboarditemelapsedtime.h>
|
|
#include <modules/base/dashboard/dashboarditemframerate.h>
|
|
#include <modules/base/dashboard/dashboarditeminputstate.h>
|
|
#include <modules/base/dashboard/dashboarditemmission.h>
|
|
#include <modules/base/dashboard/dashboarditemparallelconnection.h>
|
|
#include <modules/base/dashboard/dashboarditempropertyvalue.h>
|
|
#include <modules/base/dashboard/dashboarditemsimulationincrement.h>
|
|
#include <modules/base/dashboard/dashboarditemspacing.h>
|
|
#include <modules/base/dashboard/dashboarditemtext.h>
|
|
#include <modules/base/dashboard/dashboarditemvelocity.h>
|
|
#include <modules/base/lightsource/cameralightsource.h>
|
|
#include <modules/base/lightsource/scenegraphlightsource.h>
|
|
#include <modules/base/rendering/grids/renderableboxgrid.h>
|
|
#include <modules/base/rendering/grids/renderablegrid.h>
|
|
#include <modules/base/rendering/grids/renderableradialgrid.h>
|
|
#include <modules/base/rendering/grids/renderablesphericalgrid.h>
|
|
#include <modules/base/rendering/pointcloud/renderablepointcloud.h>
|
|
#include <modules/base/rendering/pointcloud/renderablepolygoncloud.h>
|
|
#include <modules/base/rendering/renderablecartesianaxes.h>
|
|
#include <modules/base/rendering/renderabledisc.h>
|
|
#include <modules/base/rendering/renderablelabel.h>
|
|
#include <modules/base/rendering/renderablemodel.h>
|
|
#include <modules/base/rendering/renderablenodearrow.h>
|
|
#include <modules/base/rendering/renderablenodeline.h>
|
|
#include <modules/base/rendering/renderablesphereimagelocal.h>
|
|
#include <modules/base/rendering/renderablesphereimageonline.h>
|
|
#include <modules/base/rendering/renderabletrailorbit.h>
|
|
#include <modules/base/rendering/renderabletrailtrajectory.h>
|
|
#include <modules/base/rendering/renderableplaneimagelocal.h>
|
|
#include <modules/base/rendering/renderableplaneimageonline.h>
|
|
#include <modules/base/rendering/renderableplanetimevaryingimage.h>
|
|
#include <modules/base/rendering/renderableprism.h>
|
|
#include <modules/base/rendering/renderabletimevaryingsphere.h>
|
|
#include <modules/base/rendering/screenspacedashboard.h>
|
|
#include <modules/base/rendering/screenspaceimagelocal.h>
|
|
#include <modules/base/rendering/screenspaceimageonline.h>
|
|
#include <modules/base/rendering/screenspaceframebuffer.h>
|
|
#include <modules/base/rotation/constantrotation.h>
|
|
#include <modules/base/rotation/fixedrotation.h>
|
|
#include <modules/base/rotation/luarotation.h>
|
|
#include <modules/base/rotation/staticrotation.h>
|
|
#include <modules/base/rotation/timelinerotation.h>
|
|
#include <modules/base/scale/luascale.h>
|
|
#include <modules/base/scale/nonuniformstaticscale.h>
|
|
#include <modules/base/scale/staticscale.h>
|
|
#include <modules/base/scale/timedependentscale.h>
|
|
#include <modules/base/translation/timelinetranslation.h>
|
|
#include <modules/base/translation/luatranslation.h>
|
|
#include <modules/base/translation/statictranslation.h>
|
|
#include <modules/base/timeframe/timeframeinterval.h>
|
|
#include <modules/base/timeframe/timeframeunion.h>
|
|
#include <openspace/documentation/documentation.h>
|
|
#include <openspace/rendering/renderable.h>
|
|
#include <openspace/rendering/screenspacerenderable.h>
|
|
#include <openspace/scripting/lualibrary.h>
|
|
#include <openspace/util/factorymanager.h>
|
|
#include <ghoul/misc/assert.h>
|
|
#include <ghoul/misc/templatefactory.h>
|
|
|
|
namespace openspace {
|
|
|
|
ghoul::opengl::ProgramObjectManager BaseModule::ProgramObjectManager;
|
|
ghoul::opengl::TextureManager BaseModule::TextureManager;
|
|
|
|
BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {}
|
|
|
|
void BaseModule::internalInitialize(const ghoul::Dictionary&) {
|
|
FactoryManager::ref().addFactory<ScreenSpaceRenderable>("ScreenSpaceRenderable");
|
|
|
|
ghoul::TemplateFactory<ScreenSpaceRenderable>* fSsRenderable =
|
|
FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
|
ghoul_assert(fSsRenderable, "ScreenSpaceRenderable factory was not created");
|
|
|
|
fSsRenderable->registerClass<ScreenSpaceDashboard>("ScreenSpaceDashboard");
|
|
fSsRenderable->registerClass<ScreenSpaceImageLocal>("ScreenSpaceImageLocal");
|
|
fSsRenderable->registerClass<ScreenSpaceImageOnline>("ScreenSpaceImageOnline");
|
|
fSsRenderable->registerClass<ScreenSpaceFramebuffer>("ScreenSpaceFramebuffer");
|
|
|
|
ghoul::TemplateFactory<DashboardItem>* fDashboard =
|
|
FactoryManager::ref().factory<DashboardItem>();
|
|
ghoul_assert(fDashboard, "Dashboard factory was not created");
|
|
|
|
fDashboard->registerClass<DashboardItemAngle>("DashboardItemAngle");
|
|
fDashboard->registerClass<DashboardItemDate>("DashboardItemDate");
|
|
fDashboard->registerClass<DashboardItemDistance>("DashboardItemDistance");
|
|
fDashboard->registerClass<DashboardItemElapsedTime>("DashboardItemElapsedTime");
|
|
fDashboard->registerClass<DashboardItemFramerate>("DashboardItemFramerate");
|
|
fDashboard->registerClass<DashboardItemInputState>("DashboardItemInputState");
|
|
fDashboard->registerClass<DashboardItemMission>("DashboardItemMission");
|
|
fDashboard->registerClass<DashboardItemParallelConnection>(
|
|
"DashboardItemParallelConnection"
|
|
);
|
|
fDashboard->registerClass<DashboardItemPropertyValue>(
|
|
"DashboardItemPropertyValue"
|
|
);
|
|
fDashboard->registerClass<DashboardItemSimulationIncrement>(
|
|
"DashboardItemSimulationIncrement"
|
|
);
|
|
fDashboard->registerClass<DashboardItemSpacing>("DashboardItemSpacing");
|
|
fDashboard->registerClass<DashboardItemText>("DashboardItemText");
|
|
fDashboard->registerClass<DashboardItemVelocity>("DashboardItemVelocity");
|
|
|
|
ghoul::TemplateFactory<Renderable>* fRenderable =
|
|
FactoryManager::ref().factory<Renderable>();
|
|
ghoul_assert(fRenderable, "Renderable factory was not created");
|
|
|
|
fRenderable->registerClass<RenderableBoxGrid>("RenderableBoxGrid");
|
|
fRenderable->registerClass<RenderableCartesianAxes>("RenderableCartesianAxes");
|
|
fRenderable->registerClass<RenderableDisc>("RenderableDisc");
|
|
fRenderable->registerClass<RenderableGrid>("RenderableGrid");
|
|
fRenderable->registerClass<RenderableLabel>("RenderableLabel");
|
|
fRenderable->registerClass<RenderableModel>("RenderableModel");
|
|
fRenderable->registerClass<RenderableNodeArrow>("RenderableNodeArrow");
|
|
fRenderable->registerClass<RenderableNodeLine>("RenderableNodeLine");
|
|
fRenderable->registerClass<RenderablePlaneImageLocal>("RenderablePlaneImageLocal");
|
|
fRenderable->registerClass<RenderablePlaneImageOnline>("RenderablePlaneImageOnline");
|
|
fRenderable->registerClass<RenderablePlaneTimeVaryingImage>(
|
|
"RenderablePlaneTimeVaryingImage"
|
|
);
|
|
fRenderable->registerClass<RenderablePointCloud>("RenderablePointCloud");
|
|
fRenderable->registerClass<RenderablePolygonCloud>("RenderablePolygonCloud");
|
|
fRenderable->registerClass<RenderablePrism>("RenderablePrism");
|
|
fRenderable->registerClass<RenderableTimeVaryingSphere>(
|
|
"RenderableTimeVaryingSphere"
|
|
);
|
|
fRenderable->registerClass<RenderableRadialGrid>("RenderableRadialGrid");
|
|
fRenderable->registerClass<RenderableSphereImageLocal>("RenderableSphereImageLocal");
|
|
fRenderable->registerClass<RenderableSphereImageOnline>(
|
|
"RenderableSphereImageOnline"
|
|
);
|
|
fRenderable->registerClass<RenderableSphericalGrid>("RenderableSphericalGrid");
|
|
fRenderable->registerClass<RenderableTrailOrbit>("RenderableTrailOrbit");
|
|
fRenderable->registerClass<RenderableTrailTrajectory>("RenderableTrailTrajectory");
|
|
|
|
ghoul::TemplateFactory<Translation>* fTranslation =
|
|
FactoryManager::ref().factory<Translation>();
|
|
ghoul_assert(fTranslation, "Ephemeris factory was not created");
|
|
|
|
fTranslation->registerClass<TimelineTranslation>("TimelineTranslation");
|
|
fTranslation->registerClass<LuaTranslation>("LuaTranslation");
|
|
fTranslation->registerClass<StaticTranslation>("StaticTranslation");
|
|
|
|
ghoul::TemplateFactory<Rotation>* fRotation =
|
|
FactoryManager::ref().factory<Rotation>();
|
|
ghoul_assert(fRotation, "Rotation factory was not created");
|
|
|
|
fRotation->registerClass<ConstantRotation>("ConstantRotation");
|
|
fRotation->registerClass<FixedRotation>("FixedRotation");
|
|
fRotation->registerClass<LuaRotation>("LuaRotation");
|
|
fRotation->registerClass<StaticRotation>("StaticRotation");
|
|
fRotation->registerClass<TimelineRotation>("TimelineRotation");
|
|
|
|
|
|
ghoul::TemplateFactory<Scale>* fScale = FactoryManager::ref().factory<Scale>();
|
|
ghoul_assert(fScale, "Scale factory was not created");
|
|
|
|
fScale->registerClass<LuaScale>("LuaScale");
|
|
fScale->registerClass<NonUniformStaticScale>("NonUniformStaticScale");
|
|
fScale->registerClass<StaticScale>("StaticScale");
|
|
fScale->registerClass<TimeDependentScale>("TimeDependentScale");
|
|
|
|
ghoul::TemplateFactory<TimeFrame>* fTimeFrame =
|
|
FactoryManager::ref().factory<TimeFrame>();
|
|
ghoul_assert(fTimeFrame, "Scale factory was not created");
|
|
|
|
fTimeFrame->registerClass<TimeFrameInterval>("TimeFrameInterval");
|
|
fTimeFrame->registerClass<TimeFrameUnion>("TimeFrameUnion");
|
|
|
|
ghoul::TemplateFactory<LightSource>* fLightSource =
|
|
FactoryManager::ref().factory<LightSource>();
|
|
ghoul_assert(fLightSource, "Light Source factory was not created");
|
|
|
|
fLightSource->registerClass<CameraLightSource>("CameraLightSource");
|
|
fLightSource->registerClass<SceneGraphLightSource>("SceneGraphLightSource");
|
|
}
|
|
|
|
void BaseModule::internalDeinitializeGL() {
|
|
ProgramObjectManager.releaseAll(ghoul::opengl::ProgramObjectManager::Warnings::Yes);
|
|
TextureManager.releaseAll(ghoul::opengl::TextureManager::Warnings::Yes);
|
|
}
|
|
|
|
std::vector<documentation::Documentation> BaseModule::documentations() const {
|
|
return {
|
|
DashboardItemAngle::Documentation(),
|
|
DashboardItemDate::Documentation(),
|
|
DashboardItemDistance::Documentation(),
|
|
DashboardItemFramerate::Documentation(),
|
|
DashboardItemMission::Documentation(),
|
|
DashboardItemParallelConnection::Documentation(),
|
|
DashboardItemPropertyValue::Documentation(),
|
|
DashboardItemSimulationIncrement::Documentation(),
|
|
DashboardItemSpacing::Documentation(),
|
|
DashboardItemText::Documentation(),
|
|
DashboardItemVelocity::Documentation(),
|
|
|
|
RenderableBoxGrid::Documentation(),
|
|
RenderableCartesianAxes::Documentation(),
|
|
RenderableDisc::Documentation(),
|
|
RenderableGrid::Documentation(),
|
|
RenderableLabel::Documentation(),
|
|
RenderableModel::Documentation(),
|
|
RenderableNodeArrow::Documentation(),
|
|
RenderableNodeLine::Documentation(),
|
|
RenderablePlane::Documentation(),
|
|
RenderablePlaneImageLocal::Documentation(),
|
|
RenderablePlaneImageOnline::Documentation(),
|
|
RenderablePlaneTimeVaryingImage::Documentation(),
|
|
RenderablePointCloud::Documentation(),
|
|
RenderablePolygonCloud::Documentation(),
|
|
RenderablePrism::Documentation(),
|
|
RenderableRadialGrid::Documentation(),
|
|
RenderableSphere::Documentation(),
|
|
RenderableSphereImageLocal::Documentation(),
|
|
RenderableSphereImageOnline::Documentation(),
|
|
RenderableSphericalGrid::Documentation(),
|
|
RenderableTimeVaryingSphere::Documentation(),
|
|
RenderableTrailOrbit::Documentation(),
|
|
RenderableTrailTrajectory::Documentation(),
|
|
|
|
ScreenSpaceDashboard::Documentation(),
|
|
ScreenSpaceFramebuffer::Documentation(),
|
|
ScreenSpaceImageLocal::Documentation(),
|
|
ScreenSpaceImageOnline::Documentation(),
|
|
|
|
ConstantRotation::Documentation(),
|
|
FixedRotation::Documentation(),
|
|
LuaRotation::Documentation(),
|
|
StaticRotation::Documentation(),
|
|
TimelineRotation::Documentation(),
|
|
|
|
LuaScale::Documentation(),
|
|
NonUniformStaticScale::Documentation(),
|
|
StaticScale::Documentation(),
|
|
TimeDependentScale::Documentation(),
|
|
|
|
LuaTranslation::Documentation(),
|
|
StaticTranslation::Documentation(),
|
|
TimelineTranslation::Documentation(),
|
|
|
|
TimeFrameInterval::Documentation(),
|
|
TimeFrameUnion::Documentation(),
|
|
|
|
CameraLightSource::Documentation(),
|
|
SceneGraphLightSource::Documentation()
|
|
};
|
|
}
|
|
|
|
std::vector<scripting::LuaLibrary> BaseModule::luaLibraries() const {
|
|
return {
|
|
ScreenSpaceDashboard::luaLibrary()
|
|
};
|
|
}
|
|
|
|
} // namespace openspace
|