vsg: include/vsg/io/tile.h Source File

vsg 1.1.10 VulkanSceneGraph library |

Loading...
Searching...
No Matches
tile.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2022 Robert Osfield
6
7Permission 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:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE 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.
12
13</editor-fold> */
14
15#include <vsg/io/ReaderWriter.h>
16#include <vsg/nodes/TileDatabase.h>
17#include <vsg/nodes/VertexIndexDraw.h>
18#include <vsg/state/GraphicsPipeline.h>
19#include <vsg/utils/GraphicsPipelineConfigurator.h>
20#include <vsg/utils/ShaderSet.h>
21
22namespace vsg
23{
24
26 class VSG_DECLSPEC tile : public Inherit<ReaderWriter, tile>
27 {
28 public:
29 tile(ref_ptr<TileDatabaseSettings> in_settings, ref_ptr<const Options> in_options);
30
31 tile(const tile&) = delete;
32 tile& operator=(const tile&) = delete;
33
35 ref_ptr<TileDatabaseSettings> settings;
36
38 ref_ptr<Object> read(const Path& filename, ref_ptr<const Options> options = {}) const override;
39
40 // timing stats
41 mutable std::mutex statsMutex;
42 mutable uint64_t numTilesRead{0};
43 mutable double totalTimeReadingTiles{0.0};
44
45 protected:
47 void init(ref_ptr<const Options> options);
48
49 dvec3 computeLatitudeLongitudeAltitude(const dvec3& src) const;
50 dbox computeTileExtents(uint32_t x, uint32_t y, uint32_t level) const;
51 Path getTilePath(const Path& src, uint32_t x, uint32_t y, uint32_t level) const;
52
53 ref_ptr<Object> read_root(ref_ptr<const Options> options = {}) const;
54 ref_ptr<Object> read_subtile(uint32_t x, uint32_t y, uint32_t lod, ref_ptr<const Options> options = {}) const;
55
56 ref_ptr<BindDescriptorSet> createBindDescriptorSet(ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData, Origin& origin, const vec3& displacementMapScale) const;
57
58 ref_ptr<Node> createTile(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;
59 ref_ptr<Node> createECEFTile(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;
60 ref_ptr<Node> createTextureQuad(const dbox& tile_extents, ref_ptr<Data> imageData, ref_ptr<Data> detailData, ref_ptr<Data> elevationData) const;
61
62 ref_ptr<StateGroup> createRoot() const;
63
64 ref_ptr<ShaderSet> _shaderSet;
65 ref_ptr<GraphicsPipelineConfigurator> _graphicsPipelineConfig;
66 uint32_t _materialSetIndex = 1;
67 ref_ptr<Sampler> _sampler;
68 ref_ptr<DescriptorBuffer> _material;
69
70 ref_ptr<DescriptorImage> _imageFallback;
71 ref_ptr<DescriptorImage> _detailFallback;
72 ref_ptr<DescriptorImage> _elevationFallback;
73
74 mutable std::mutex _geometryMapMutex;
75 mutable std::map<dvec4, ref_ptr<VertexIndexDraw>> _geometryMap;
76 };
77 VSG_type_name(vsg::tile);
78
79} // namespace vsg
vsg::Path
Definition Path.h:34
vsg::ref_ptr
Definition ref_ptr.h:22
vsg::tile::read
ref_ptr< Object > read(const Path &filename, ref_ptr< const Options > options={}) const override
read the tile
vsg::tile::init
void init(ref_ptr< const Options > options)
initialize internal data structures
vsg::tile::settings
ref_ptr< TileDatabaseSettings > settings
settings provided by the vsg::TileDatabase node
Definition tile.h:35