Ocean
RetiredTrianglesRenderer.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_RETIRED_TRIANGLES_RENDERER_H
9 #define META_OCEAN_TRACKING_MAPTEXTURING_RETIRED_TRIANGLES_RENDERER_H
10 
12 
13 #include "ocean/base/Frame.h"
14 
16 
17 #include "ocean/rendering/Engine.h"
22 
23 namespace Ocean
24 {
25 
26 namespace Tracking
27 {
28 
29 namespace MapTexturing
30 {
31 
32 /**
33  * This class implements a renderer for retired triangle allowing to determine whether they can be deleted.
34  * @ingroup trackingmaptexturing
35  */
36 class OCEAN_TRACKING_MAPTEXTURING_EXPORT RetiredTrianglesRenderer
37 {
38  public:
39 
40  /**
41  * Destructs this renderer and releases all resources.
42  */
44 
45  /**
46  * Renders all retired triangles to determine whether they can be deleted.
47  * @param engine The rendering engine to be used
48  * @param vertexSet The vertex set containing all triangle vertices, must be valid
49  * @param triangles The triangles to render, must be valid
50  * @param numberTriangles The number of triangles to render, with range [1, infinity)
51  * @param projectionMatrix The projection matrix to be used, must be valid
52  * @param world_T_camera The transformation between camera and world, must be valid
53  * @param trianglesStateFramebuffer The framebuffer holding the states of the individual triangles, must be valid
54  * @param downsampledDepthFramebuffer The down-sampled and filtered texture framebuffer holding the depth image, must be valid
55  * @param nearDistance The view's near distance, with range (0, infinity)
56  * @param farDistance the view's far distance, with range (nearDistance, infinity)
57  * @param deletedTriangleIds The resulting ids of all triangles which's states have changed from retired to deleted
58  * @return True, if succeeded
59  */
60  bool render(const Rendering::Engine& engine, const Rendering::VertexSetRef& vertexSet, const Rendering::TrianglesRef& triangles, const unsigned int numberTriangles, const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& world_T_camera, const Rendering::TextureFramebufferRef& trianglesStateFramebuffer, const Rendering::TextureFramebufferRef& downsampledDepthFramebuffer, const Scalar nearDistance, const Scalar farDistance, Indices32& deletedTriangleIds);
61 
62  /**
63  * Returns the current texture framebuffer of this renderer.
64  * @return The renderer's texture framebuffer
65  */
66  inline const Rendering::TextureFramebufferRef& textureFramebuffer() const;
67 
68  /**
69  * Explicitly releases this renderer and releases all resources.
70  */
71  void release();
72 
73  /**
74  * Returns whether this renderer has been initialized successfully.
75  * @return True, if succeeded
76  */
77  inline bool isValid() const;
78 
79  protected:
80 
81  /// The shader program to render the retired triangles.
83 
84  /// The texture framebuffer in which the triangles will be rendered.
86 
87  /// The intermediate state frame.
89 
90  /// The platform-specific shader part.
91  static const char* partPlatform_;
92 
93  /// The vertex shader part.
95 
96  /// The fragment shader part.
98 };
99 
101 {
102  return textureFramebuffer_;
103 }
104 
105 }
106 
107 }
108 
109 }
110 
111 #endif // META_OCEAN_TRACKING_MAPTEXTURING_RETIRED_TRIANGLES_RENDERER_H
This class implements Ocean's image class.
Definition: Frame.h:1792
This class is the base class for all rendering engines like.
Definition: Engine.h:46
This class implements a renderer for retired triangle allowing to determine whether they can be delet...
Definition: RetiredTrianglesRenderer.h:37
const Rendering::TextureFramebufferRef & textureFramebuffer() const
Returns the current texture framebuffer of this renderer.
Definition: RetiredTrianglesRenderer.h:100
static const char * programVertexShaderRetiredTriangles_
The vertex shader part.
Definition: RetiredTrianglesRenderer.h:94
Frame stateFrame_
The intermediate state frame.
Definition: RetiredTrianglesRenderer.h:88
static const char * programFragmentShaderRetiredTriangles_
The fragment shader part.
Definition: RetiredTrianglesRenderer.h:97
void release()
Explicitly releases this renderer and releases all resources.
~RetiredTrianglesRenderer()
Destructs this renderer and releases all resources.
bool render(const Rendering::Engine &engine, const Rendering::VertexSetRef &vertexSet, const Rendering::TrianglesRef &triangles, const unsigned int numberTriangles, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &world_T_camera, const Rendering::TextureFramebufferRef &trianglesStateFramebuffer, const Rendering::TextureFramebufferRef &downsampledDepthFramebuffer, const Scalar nearDistance, const Scalar farDistance, Indices32 &deletedTriangleIds)
Renders all retired triangles to determine whether they can be deleted.
Rendering::TextureFramebufferRef textureFramebuffer_
The texture framebuffer in which the triangles will be rendered.
Definition: RetiredTrianglesRenderer.h:85
static const char * partPlatform_
The platform-specific shader part.
Definition: RetiredTrianglesRenderer.h:91
bool isValid() const
Returns whether this renderer has been initialized successfully.
Rendering::ShaderProgramRef shaderProgramRetiredTriangles_
The shader program to render the retired triangles.
Definition: RetiredTrianglesRenderer.h:82
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition: Base.h:96
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15