Ocean
Loading...
Searching...
No Matches
TrianglesIdRenderer.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_TRIANGLES_ID_RENDERER_H
9#define META_OCEAN_TRACKING_MAPTEXTURING_TRIANGLES_ID_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 triangles with individual color ids.
35 * @ingroup trackingmaptexturing
36 */
37class OCEAN_TRACKING_MAPTEXTURING_EXPORT TrianglesIdRenderer
38{
39 public:
40
41 /**
42 * Destructs this renderer and releases all resources.
43 */
45
46 /**
47 * Initializes this renderer.
48 * @param engine The rendering engine to be used
49 * @return True, if succeeded
50 */
51 bool initialize(const Rendering::Engine& engine);
52
53 /**
54 * Renders triangles with individual ids.
55 * @param vertexSet The vertex set containing all triangle vertices, must be valid
56 * @param triangles The triangles to render, must be valid
57 * @param numberTriangles The number of triangles to render, with range [1, infinity)
58 * @param trianglesStateFramebuffer The framebuffer holding the states of the individual triangles, must be valid
59 * @param projectionMatrix The projection matrix to be used, must be valid
60 * @param world_T_camera The transformation between camera and world, must be valid
61 * @param width The width of the framebuffer in which the triangles will be rendered, in pixel, with range [1, infinity)
62 * @param height The width of the framebuffer in which the triangles will be rendered, in pixel, with range [1, infinity)
63 * @param minimalTriangleState The minimal state of a triangle to that it will be rendered, with range [0, 255]
64 * @param idFrame Optional resulting frame containing the color output (the id frame) of the renderer, nullptr if not of interest
65 * @param depthFrame Optional resulting frame containing the z-buffer of the renderer, nullptr if not of interest
66 * @return True, if succeeded
67 */
68 bool render(const Rendering::VertexSetRef& vertexSet, const Rendering::TrianglesRef& triangles, const unsigned int numberTriangles, const Rendering::TextureFramebufferRef& trianglesStateFramebuffer, const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& world_T_camera, const unsigned int width, const unsigned int height, const uint8_t minimalTriangleState, Frame* idFrame = nullptr, Frame* depthFrame = nullptr);
69
70 /**
71 * Returns the current texture framebuffer of this renderer.
72 * @return The renderer's texture framebuffer
73 */
74 inline const Rendering::TextureFramebufferRef& textureFramebuffer() const;
75
76 /**
77 * Explicitly releases this renderer and releases all resources.
78 */
79 void release();
80
81 /**
82 * Returns whether this renderer has been initialized successfully.
83 * @return True, if succeeded
84 */
85 inline bool isValid() const;
86
87 protected:
88
89 /// The shader program rendering individual triangles with individual color ids.
91
92 /// The texture framebuffer used when rendering the color ids.
94
95 /// The platform-specific shader part.
96 static const char* partPlatform_;
97
98 /// The vertex shader part.
99 static const char* programVertexShaderColorId_;
100
101 /// The fragment shader part.
103};
104
109
110}
111
112}
113
114}
115
116#endif // META_OCEAN_TRACKING_MAPTEXTURING_TRIANGLES_ID_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 triangles with individual color ids.
Definition TrianglesIdRenderer.h:38
static const char * programVertexShaderColorId_
The vertex shader part.
Definition TrianglesIdRenderer.h:99
Rendering::TextureFramebufferRef textureFramebuffer_
The texture framebuffer used when rendering the color ids.
Definition TrianglesIdRenderer.h:93
void release()
Explicitly releases this renderer and releases all resources.
Rendering::ShaderProgramRef shaderProgram_
The shader program rendering individual triangles with individual color ids.
Definition TrianglesIdRenderer.h:90
static const char * partPlatform_
The platform-specific shader part.
Definition TrianglesIdRenderer.h:96
bool initialize(const Rendering::Engine &engine)
Initializes this renderer.
static const char * programFragmentShaderColorId_
The fragment shader part.
Definition TrianglesIdRenderer.h:102
bool isValid() const
Returns whether this renderer has been initialized successfully.
const Rendering::TextureFramebufferRef & textureFramebuffer() const
Returns the current texture framebuffer of this renderer.
Definition TrianglesIdRenderer.h:105
bool render(const Rendering::VertexSetRef &vertexSet, const Rendering::TrianglesRef &triangles, const unsigned int numberTriangles, const Rendering::TextureFramebufferRef &trianglesStateFramebuffer, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &world_T_camera, const unsigned int width, const unsigned int height, const uint8_t minimalTriangleState, Frame *idFrame=nullptr, Frame *depthFrame=nullptr)
Renders triangles with individual ids.
~TrianglesIdRenderer()
Destructs this renderer and releases all resources.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15