Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for detail and elevation layers to vsg::TileDatabase #1360

Merged
merged 19 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b4297b0
Updated version for multilayer TileDatabase work.
robertosfield Dec 17, 2024
9331e1b
Added support for {z+1} and {z-1} in path name parsing. Added TileDa…
robertosfield Dec 19, 2024
cda1273
Added TileDatabaseSetting::detailLayer support.
robertosfield Dec 23, 2024
899ffe9
Updated pbr, flat and phong ShaderSets
robertosfield Dec 23, 2024
e5d33cb
Added support for detail/terrain layer to root tile.
robertosfield Dec 23, 2024
743390f
Reverted to version 1.1.9 so that detail layer work can be merged wit…
robertosfield Dec 23, 2024
54c6c05
Renamed TileDataSettings::terrainLayer member to elevationLayer.
robertosfield Dec 23, 2024
ae983c7
Ran clang-format
robertosfield Dec 23, 2024
b468d4c
Merge branch 'master' into MultiLayerTileDatabase
robertosfield Dec 24, 2024
4c7ea0f
Added support for signed variants of Array2D and Array3D.
robertosfield Dec 26, 2024
f02c943
Added vsg::TileDatabase::elevationLayer support.
robertosfield Jan 3, 2025
36c1171
Added fenceHeightRatio in prep for adding fences to tile geometries.
robertosfield Jan 5, 2025
9d3099b
Added skirt generation for tiles to avoid visual cracks between tiles…
robertosfield Jan 7, 2025
72e5c30
cppcheck fixes
robertosfield Jan 8, 2025
565b539
Changed to using a desriptor for the displacementMapScale.
robertosfield Jan 9, 2025
c31c982
Added maxTileDimensions setting to enable geometry of tiles to be lim…
robertosfield Jan 9, 2025
896c634
Ran clang-format.
robertosfield Jan 9, 2025
0510346
Merge branch 'master' into MultiLayerTileDatabase
robertosfield Jan 9, 2025
e75d3f7
Added displacement map to built in ShaderSets.
robertosfield Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,26 @@ set(PBR_DEFINES
-v "VSG_DIFFUSE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_WORKFLOW_SPECGLOSS"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_LIGHTMAP_MAP VSG_METALLROUGHNESS_MAP VSG_NORMAL_MAP VSG_TWO_SIDED_LIGHTING"
-v "VSG_DIFFUSE_MAP VSG_EMISSIVE_MAP VSG_LIGHTMAP_MAP VSG_NORMAL_MAP VSG_SPECULAR_MAP VSG_WORKFLOW_SPECGLOSS"
-v "VSG_DISPLACEMENT_MAP VSG_DIFFUSE_MAP"
-v "VSG_DISPLACEMENT_MAP VSG_DETAIL_MAP VSG_DIFFUSE_MAP"
)

set(PHONG_DEFINES
-v \"\"
-v "VSG_BILLBOARD"
-v "VSG_DIFFUSE_MAP"
-v "VSG_BILLBOARD VSG_DIFFUSE_MAP"
-v "VSG_DISPLACEMENT_MAP VSG_DIFFUSE_MAP"
-v "VSG_DISPLACEMENT_MAP VSG_DETAIL_MAP VSG_DIFFUSE_MAP"
)

set(FLAT_DEFINES
-v \"\"
-v "VSG_BILLBOARD"
-v "VSG_DIFFUSE_MAP"
-v "VSG_BILLBOARD VSG_DIFFUSE_MAP"
-v "VSG_DISPLACEMENT_MAP VSG_DIFFUSE_MAP"
-v "VSG_DISPLACEMENT_MAP VSG_DETAIL_MAP VSG_DIFFUSE_MAP"
)

set(TEXT_DEFINES
Expand Down
6 changes: 6 additions & 0 deletions include/vsg/core/ConstVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ namespace vsg
virtual void apply(const block128Array&);

// Array2Ds
virtual void apply(const byteArray2D&);
virtual void apply(const ubyteArray2D&);
virtual void apply(const shortArray2D&);
virtual void apply(const ushortArray2D&);
virtual void apply(const intArray2D&);
virtual void apply(const uintArray2D&);
virtual void apply(const floatArray2D&);
virtual void apply(const doubleArray2D&);
Expand Down Expand Up @@ -298,8 +301,11 @@ namespace vsg
virtual void apply(const block128Array2D&);

// Array3Ds
virtual void apply(const byteArray3D&);
virtual void apply(const ubyteArray3D&);
virtual void apply(const shortArray3D&);
virtual void apply(const ushortArray3D&);
virtual void apply(const intArray3D&);
virtual void apply(const uintArray3D&);
virtual void apply(const floatArray3D&);
virtual void apply(const doubleArray3D&);
Expand Down
6 changes: 6 additions & 0 deletions include/vsg/core/Visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ namespace vsg
virtual void apply(block128Array&);

// Array2Ds
virtual void apply(byteArray2D&);
virtual void apply(ubyteArray2D&);
virtual void apply(shortArray2D&);
virtual void apply(ushortArray2D&);
virtual void apply(intArray2D&);
virtual void apply(uintArray2D&);
virtual void apply(floatArray2D&);
virtual void apply(doubleArray2D&);
Expand Down Expand Up @@ -298,8 +301,11 @@ namespace vsg
virtual void apply(block128Array2D&);

// Array3Ds
virtual void apply(byteArray3D&);
virtual void apply(ubyteArray3D&);
virtual void apply(shortArray3D&);
virtual void apply(ushortArray3D&);
virtual void apply(intArray3D&);
virtual void apply(uintArray3D&);
virtual void apply(floatArray3D&);
virtual void apply(doubleArray3D&);
Expand Down
16 changes: 13 additions & 3 deletions include/vsg/io/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

#include <vsg/io/ReaderWriter.h>
#include <vsg/nodes/TileDatabase.h>
#include <vsg/nodes/VertexIndexDraw.h>
#include <vsg/state/GraphicsPipeline.h>
#include <vsg/utils/GraphicsPipelineConfigurator.h>
#include <vsg/utils/ShaderSet.h>
Expand Down Expand Up @@ -52,9 +53,11 @@ namespace vsg
ref_ptr<Object> read_root(ref_ptr<const Options> options = {}) const;
ref_ptr<Object> read_subtile(uint32_t x, uint32_t y, uint32_t lod, ref_ptr<const Options> options = {}) const;

ref_ptr<Node> createTile(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
ref_ptr<Node> createECEFTile(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
ref_ptr<Node> createTextureQuad(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
ref_ptr<BindDescriptorSet> createBindDescriptorSet(ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData, Origin& origin, const vec3& displacementMapScale) const;

ref_ptr<Node> createTile(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;
ref_ptr<Node> createECEFTile(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;
ref_ptr<Node> createTextureQuad(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;

ref_ptr<StateGroup> createRoot() const;

Expand All @@ -63,6 +66,13 @@ namespace vsg
uint32_t _materialSetIndex = 1;
ref_ptr<Sampler> _sampler;
ref_ptr<DescriptorBuffer> _material;

ref_ptr<DescriptorImage> _imageFallback;
ref_ptr<DescriptorImage> _detailFallback;
ref_ptr<DescriptorImage> _elevationFallback;

mutable std::mutex _geometryMapMutex;
mutable std::map<dvec4, ref_ptr<VertexIndexDraw>> _geometryMap;
};
VSG_type_name(vsg::tile);

Expand Down
15 changes: 14 additions & 1 deletion include/vsg/nodes/TileDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,21 @@ namespace vsg
std::string projection;
ref_ptr<EllipsoidModel> ellipsoidModel = EllipsoidModel::create();

// callback for post processing loading image, detail or terrain layers data after the source data is loaded.
using ProcessCallback = std::function<ref_ptr<Data>(ref_ptr<Data>)>;

Path imageLayer;
Path terrainLayer;
ProcessCallback imageLayerCallback;

Path detailLayer;
ProcessCallback detailLayerCallback;

Path elevationLayer;
ProcessCallback elevationLayerCallback;
double elevationScale = 32868.0;
double skirtRatio = 0.02;
uint32_t maxTileDimension = 1024;

uint32_t mipmapLevelsHint = 16;

/// hint of whether to use flat shaded shaders or with lighting enabled.
Expand Down
24 changes: 24 additions & 0 deletions src/vsg/core/ConstVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,26 @@ void ConstVisitor::apply(const block128Array& value)
//
// Array2Ds
//
void ConstVisitor::apply(const byteArray2D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const ubyteArray2D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const shortArray2D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const ushortArray2D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const intArray2D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const uintArray2D& value)
{
apply(static_cast<const Data&>(value));
Expand Down Expand Up @@ -456,14 +468,26 @@ void ConstVisitor::apply(const block128Array2D& value)
//
// Array3Ds
//
void ConstVisitor::apply(const byteArray3D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const ubyteArray3D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const shortArray3D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const ushortArray3D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const intArray3D& value)
{
apply(static_cast<const Data&>(value));
}
void ConstVisitor::apply(const uintArray3D& value)
{
apply(static_cast<const Data&>(value));
Expand Down
24 changes: 24 additions & 0 deletions src/vsg/core/Visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,26 @@ void Visitor::apply(block128Array& value)
//
// Array2Ds
//
void Visitor::apply(byteArray2D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(ubyteArray2D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(shortArray2D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(ushortArray2D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(intArray2D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(uintArray2D& value)
{
apply(static_cast<Data&>(value));
Expand Down Expand Up @@ -456,14 +468,26 @@ void Visitor::apply(block128Array2D& value)
//
// Array3Ds
//
void Visitor::apply(byteArray3D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(ubyteArray3D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(shortArray3D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(ushortArray3D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(intArray3D& value)
{
apply(static_cast<Data&>(value));
}
void Visitor::apply(uintArray3D& value)
{
apply(static_cast<Data&>(value));
Expand Down
Loading
Loading