Cogs.Core
ClipmapUpdater.h
1#pragma once
2
3#include "ClipmapUpsampler.h"
4
5#include "Rendering/VertexFormat.h"
6
7#include <vector>
8
9namespace Cogs
10{
11 class RasterSource;
12 struct RasterSourceSubscription;
13 struct RasterTileRegion;
14 struct RasterTile;
15 struct RasterTileIdentifier;
16
17 class NormalUpdater;
18 class ClipmapUpdate;
19 class ClipmapLevel;
20 struct Extent;
21
22 struct WorldOptions;
23
25 {
26 public:
27 void initialize(IGraphicsDevice * device, NormalUpdater * normalUpdater);
28 VertexFormatHandle initializeGeometry(IGraphicsDevice * device);
29 void initializeSamplerStates(IGraphicsDevice * device);
30 void initializeShaders(IGraphicsDevice * device, VertexFormatHandle positionFormat);
31 void initializeStateObjects(IGraphicsDevice * device);
32
33 void preloadTiles(ClipmapLevel & clipmapLevel, const Extent & extent);
34
35 void setupRenderingState(RenderContext & renderContext);
36
37 size_t applyNewData(RenderContext & context, const WorldOptions & worldOptions, RasterSourceSubscription & subscription, std::vector<ClipmapLevel> & levels, const size_t maxLevel);
38
39 void requestTileResidency(ClipmapLevel & level);
40
41 size_t updateRasterLevel(RenderContext & context, ClipmapUpdate * update, const size_t numUpdates);
42 InputLayoutHandle updateLayoutHandle;
43
44 private:
45 void requestTileLoad(RasterSource * rasterSource, ClipmapLevel & level, RasterTile * tile);
46
47 void applyNewTiles(RenderContext & context,
48 ClipmapLevel * level,
49 const RasterTile ** tile,
50 const size_t numTiles,
51 std::vector<const RasterTile *> & updatedTiles,
52 std::vector<ClipmapLevel *> & updatedLevels,
53 std::vector<ClipmapUpdate> & normalUpdates);
54
55 void applyIfNotLoaded(RenderContext & context, const WorldOptions & worldOptions, ClipmapLevel * level, const RasterTileIdentifier & tile, const size_t maxLevel);
56
57 void renderTilesToLevelTexture(RenderContext & context,
58 ClipmapLevel * level,
59 const RasterTileRegion ** regions,
60 const TextureHandle * tileTextures,
61 const size_t numRegions);
62
63 EffectHandle updateEffectHandle;
64
65 BufferHandle levelBufferHandle;
66 BufferHandle regionBufferHandle;
67
68 ConstantBufferBindingHandle levelBufferBinding;
69 ConstantBufferBindingHandle regionBufferBinding;
70
71 VertexBufferHandle vertexBufferHandle;
72 RasterizerStateHandle rasterizerStateHandle;
73 DepthStencilStateHandle depthStencilStateHandle;
74
75 SamplerStateHandle nearestClampStateHandle;
76
77 TextureBindingHandle textureBinding;
78 SamplerStateBindingHandle samplerStateBinding;
79
80 NormalUpdater * normalUpdater;
81 ClipmapUpsampler upsampler;
82 };
83}
Represents a graphics device used to manage graphics resources and issue drawing commands.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Raster index extent.
Definition: Extent.h:7