Ocean
Loading...
Searching...
No Matches
VisibleTrianglesRenderer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TRACKING_MAPTEXTURING_VISIBLE_TRIANGLES_RENDERER_H
9#define META_OCEAN_TRACKING_MAPTEXTURING_VISIBLE_TRIANGLES_RENDERER_H
10
12
13#include "ocean/base/Frame.h"
14
16
23
24namespace Ocean
25{
26
27namespace Tracking
28{
29
30namespace MapTexturing
31{
32
33/**
34 * This class implements a renderer for all visible triangles.
35 * @ingroup trackingmaptexturing
36 */
37class OCEAN_TRACKING_MAPTEXTURING_EXPORT VisibleTrianglesRenderer
38{
39 public:
40
41 /**
42 * Destructs this renderer and releases all resources.
43 */
45
46 /**
47 * Extracts the visible triangles out of a framebuffer in which all triangles have been rendered.
48 * @param engine The rendering engine to be used
49 * @param trianglesIdFramebuffer The texture framebuffer holding in which all triangles have been rendered, must be valid
50 * @param downsampledDepthFramebuffer The down-sampled and filtered depth buffer of the framebuffer with triangle ids, must be valid
51 * @param nearDistance The view's near distance, with range (0, infinity)
52 * @param farDistance the view's far distance, with range (nearDistance, infinity)
53 * @return True, if succeeded
54 */
55 bool render(const Rendering::Engine& engine, const Rendering::TextureFramebufferRef& trianglesIdFramebuffer, const Rendering::TextureFramebufferRef& downsampledDepthFramebuffer, const Scalar nearDistance, const Scalar farDistance);
56
57 /**
58 * Returns the current texture framebuffer of this renderer.
59 * @return The renderer's texture framebuffer
60 */
61 inline const Rendering::TextureFramebufferRef& textureFramebuffer() const;
62
63 /**
64 * Explicitly releases this renderer and releases all resources.
65 */
66 void release();
67
68 /**
69 * Returns whether this renderer has been initialized successfully.
70 * @return True, if succeeded
71 */
72 inline bool isValid() const;
73
74 protected:
75
76 /// The shader program rendering the ids of visible triangles.
78
79 /// The shader program removing the ids of (partially) occluded triangles.
81
82 /// The texture framebuffer used when rendering the color ids.
84
85 /// The vertex set holding the vertices to be rendered.
87
88 /// The triangle object which will be used to render the triangles.
90
91 /// The intermediate frame holding the ids of all visible triangles.
93
94 /// The platform-specific shader part.
95 static const char* partPlatform_;
96
97 /// The vertex shader part.
99
100 /// The vertex shader part.
102
103 /// The fragment shader part.
105
106 /// The fragment shader part.
108};
109
114
115}
116
117}
118
119}
120
121#endif // META_OCEAN_TRACKING_MAPTEXTURING_VISIBLE_TRIANGLES_RENDERER_H
This class implements Ocean's image class.
Definition Frame.h:1808
This class is the base class for all rendering engines like.
Definition Engine.h:46
This class implements a renderer for all visible triangles.
Definition VisibleTrianglesRenderer.h:38
Rendering::TextureFramebufferRef textureFramebuffer_
The texture framebuffer used when rendering the color ids.
Definition VisibleTrianglesRenderer.h:83
static const char * partPlatform_
The platform-specific shader part.
Definition VisibleTrianglesRenderer.h:95
bool isValid() const
Returns whether this renderer has been initialized successfully.
static const char * programFragmentShaderVisibleTriangles_
The fragment shader part.
Definition VisibleTrianglesRenderer.h:104
Rendering::VertexSetRef vertexSet_
The vertex set holding the vertices to be rendered.
Definition VisibleTrianglesRenderer.h:86
void release()
Explicitly releases this renderer and releases all resources.
Rendering::ShaderProgramRef shaderProgramOccludedTriangles_
The shader program removing the ids of (partially) occluded triangles.
Definition VisibleTrianglesRenderer.h:80
~VisibleTrianglesRenderer()
Destructs this renderer and releases all resources.
const Rendering::TextureFramebufferRef & textureFramebuffer() const
Returns the current texture framebuffer of this renderer.
Definition VisibleTrianglesRenderer.h:110
static const char * programFragmentShaderOccludedTriangles_
The fragment shader part.
Definition VisibleTrianglesRenderer.h:107
static const char * programVertexShaderOccludedTriangles_
The vertex shader part.
Definition VisibleTrianglesRenderer.h:101
Rendering::ShaderProgramRef shaderProgramVisibleTriangles_
The shader program rendering the ids of visible triangles.
Definition VisibleTrianglesRenderer.h:77
bool render(const Rendering::Engine &engine, const Rendering::TextureFramebufferRef &trianglesIdFramebuffer, const Rendering::TextureFramebufferRef &downsampledDepthFramebuffer, const Scalar nearDistance, const Scalar farDistance)
Extracts the visible triangles out of a framebuffer in which all triangles have been rendered.
static const char * programVertexShaderVisibleTriangles_
The vertex shader part.
Definition VisibleTrianglesRenderer.h:98
Frame idFrame_
The intermediate frame holding the ids of all visible triangles.
Definition VisibleTrianglesRenderer.h:92
Rendering::PointsRef points_
The triangle object which will be used to render the triangles.
Definition VisibleTrianglesRenderer.h:89
float Scalar
Definition of a scalar type.
Definition Math.h:129
The namespace covering the entire Ocean framework.
Definition Accessor.h:15