vsg  1.1.0
VulkanSceneGraph library
tile.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2022 Robert Osfield
6 
7 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:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 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.
12 
13 </editor-fold> */
14 
15 #include <vsg/io/ReaderWriter.h>
16 #include <vsg/nodes/TileDatabase.h>
17 #include <vsg/state/GraphicsPipeline.h>
18 #include <vsg/utils/GraphicsPipelineConfigurator.h>
19 #include <vsg/utils/ShaderSet.h>
20 
21 namespace vsg
22 {
23 
25  class VSG_DECLSPEC tile : public Inherit<ReaderWriter, tile>
26  {
27  public:
29 
30  tile(const tile&) = delete;
31  tile& operator=(const tile&) = delete;
32 
35 
37  ref_ptr<Object> read(const Path& filename, ref_ptr<const Options> options = {}) const override;
38 
39  // timing stats
40  mutable std::mutex statsMutex;
41  mutable uint64_t numTilesRead{0};
42  mutable double totalTimeReadingTiles{0.0};
43 
44  protected:
47 
48  dvec3 computeLatitudeLongitudeAltitude(const dvec3& src) const;
49  dbox computeTileExtents(uint32_t x, uint32_t y, uint32_t level) const;
50  Path getTilePath(const Path& src, uint32_t x, uint32_t y, uint32_t level) const;
51 
52  ref_ptr<Object> read_root(ref_ptr<const Options> options = {}) const;
53  ref_ptr<Object> read_subtile(uint32_t x, uint32_t y, uint32_t lod, ref_ptr<const Options> options = {}) const;
54 
55  ref_ptr<Node> createTile(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
56  ref_ptr<Node> createECEFTile(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
57  ref_ptr<Node> createTextureQuad(const dbox& tile_extents, ref_ptr<Data> sourceData) const;
58 
59  ref_ptr<StateGroup> createRoot() const;
60 
61  ref_ptr<ShaderSet> _shaderSet;
62  ref_ptr<GraphicsPipelineConfigurator> _graphicsPipelineConfig;
63  uint32_t _materialSetIndex = 1;
64  ref_ptr<Sampler> _sampler;
65  ref_ptr<DescriptorBuffer> _material;
66  };
67  VSG_type_name(vsg::tile);
68 
69 } // namespace vsg
Definition: Inherit.h:28
Definition: Path.h:32
Definition: ref_ptr.h:22
tile reader that is used by the vsg::TileDatabase node to implement the reading of external tiles
Definition: tile.h:26
void init(ref_ptr< const Options > options)
initialize internal data structures
ref_ptr< Object > read(const Path &filename, ref_ptr< const Options > options={}) const override
read the tile
ref_ptr< TileDatabaseSettings > settings
settings provided by the vsg::TileDatabase node
Definition: tile.h:34