mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-01 09:08:49 -06:00
Feature/geojson (#2595)
Add the option to add geojson components to globes, from geojson files. One geojson file creates one GeoJsonComponent, which in turn may contain multiple GlobeGeometryFeatures
Geojson is a format that supports points, lines, and polygons. In addition to the basic functionality, extra features have been added that will long-term allow rendering the geometry needed to represent KML files (another format for geospatial geometry data). Here are links to references for both formats:
Geojson: https://geojson.org/
KML: https://developers.google.com/kml/documentation/kmlreference
data/assets/examples/geojson includes some example files that I have used for testing. Any geojson file can also be added through drag-n-drop. Note however that you might need to change the AltitudeMode or HeightOffset properties for the feature to be visible.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
/**
|
||||
* This class is an interface for all things fadeable in the software; things that need
|
||||
* a fade and opacity property, which will be combined into a final opacity value
|
||||
*
|
||||
*
|
||||
* A Fadeable can also be dependent on the fade value from a specified parent fadeable,
|
||||
* so that it fades out together with the parent
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,11 @@ namespace ghoul::opengl {
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
class LightSource;
|
||||
struct RenderData;
|
||||
} // namespace openspace
|
||||
|
||||
namespace openspace::rendering::helper {
|
||||
|
||||
enum class Anchor {
|
||||
@@ -109,6 +114,11 @@ struct VertexXYZ {
|
||||
GLfloat xyz[3];
|
||||
};
|
||||
|
||||
struct VertexXYZNormal {
|
||||
GLfloat xyz[3];
|
||||
GLfloat normal[3];
|
||||
};
|
||||
|
||||
VertexXYZ convertToXYZ(const Vertex& v);
|
||||
|
||||
std::vector<VertexXYZ> convert(std::vector<Vertex> v);
|
||||
@@ -119,6 +129,20 @@ std::vector<Vertex> createRing(int nSegments, float radius,
|
||||
std::pair<std::vector<Vertex>, std::vector<GLushort>>
|
||||
createSphere(int nSegments, glm::vec3 radii, glm::vec4 colors = glm::vec4(1.f));
|
||||
|
||||
/**
|
||||
* Data structure that can be used for rendering using multiple light directions
|
||||
*/
|
||||
struct LightSourceRenderData {
|
||||
unsigned int nLightSources = 0;
|
||||
|
||||
// Buffers for uniform uploading
|
||||
std::vector<float> intensitiesBuffer;
|
||||
std::vector<glm::vec3> directionsViewSpaceBuffer;
|
||||
|
||||
void updateBasedOnLightSources(const RenderData& renderData,
|
||||
const std::vector<std::unique_ptr<LightSource>>& sources);
|
||||
};
|
||||
|
||||
} // namespace openspace::rendering::helper
|
||||
|
||||
#endif // __OPENSPACE_CORE___HELPER___H__
|
||||
|
||||
Reference in New Issue
Block a user