Cogs.Core
ClipmapDepthQuery.h
1#pragma once
2
3#include "ClipmapTerrainTypes.h"
4
5#include "Rendering/IGraphicsDevice.h"
6
7namespace Cogs
8{
9 struct ClipmapRenderer;
10
12 {
15
16 void initialize(IGraphicsDevice * device, ClipmapRenderer * clipmapRenderer);
17
18 void readBack();
19
20 bool getPositions(const Vector2 * mousePositions, const Matrix & inverseViewProjection, const size_t numPositions, Vector4 * worldPos, bool * positionValid, int rayPickId);
21
28 float getNearestTerrainSample(const Matrix & inverseProjection);
29
36 float getNearestTerrainSample2(const Matrix & inverseProjection, const Matrix & viewMatrix);
37
38 private:
39 IGraphicsDevice * device;
40 BufferHandle queryReadBackBuffer;
41 ClipmapRenderer * clipmapRenderer;
42 bool hasReadBack = false; //set to true when first readback is complete
43
44 Vector4 prevViewPos;
45 Matrix prevViewMatrix;
46 };
47}
Represents a graphics device used to manage graphics resources and issue drawing commands.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
float getNearestTerrainSample(const Matrix &inverseProjection)
Returns the nearest sample in the query readback buffer.
float getNearestTerrainSample2(const Matrix &inverseProjection, const Matrix &viewMatrix)
Returns the nearest sample in the query readback buffer for two frames.