Ocean
Loading...
Searching...
No Matches
GLESAttribute.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_RENDERING_GLES_ATTRIBUTE_H
9#define META_OCEAN_RENDERING_GLES_ATTRIBUTE_H
10
13
15
16namespace Ocean
17{
18
19namespace Rendering
20{
21
22namespace GLESceneGraph
23{
24
25// Forward declaration.
26class GLESFramebuffer;
28
29/**
30 * This class wraps a GLESceneGraph attribute object.
31 * @ingroup renderinggles
32 */
33class OCEAN_RENDERING_GLES_EXPORT GLESAttribute :
34 virtual public GLESObject,
35 virtual public Attribute
36{
37 public:
38
39 /**
40 * Definition of different shader functionalities.
41 */
42 enum ProgramType : uint32_t
43 {
44 /// Not specified shader program.
46 /// Shader using a static color.
47 PT_STATIC_COLOR = (1u << 0u),
48 /// Shader using a static color and rendering points.
49 PT_POINTS = (1u << 1u),
50 /// Shader using a default gray material color.
51 PI_DEBUG_GRAY = (1u << 2u),
52 /// Shader using material.
53 PT_MATERIAL = (1u << 3u),
54 /// Shader using light.
55 PT_LIGHT = (1u << 4u),
56 /// Shader using one lower left oriented texture.
58 /// Shader using one upper left oriented texture.
60 /// Shader using one Y texture.
61 PT_TEXTURE_Y = (1u << 7u),
62 /// Shader using one RGBA texture.
63 PT_TEXTURE_RGBA = (1u << 8u),
64 /// Shader using one BGRA texture.
65 PT_TEXTURE_BGRA = (1u << 9u),
66 /// Shader using one YUV24 texture.
67 PT_TEXTURE_YUV24 = (1u << 10u),
68 /// Shader using one YVU24 texture.
69 PT_TEXTURE_YVU24 = (1u << 11u),
70 /// Shader using one Y_UV12 texture.
71 PT_TEXTURE_Y_UV12 = (1u << 12u),
72 /// Shader using one Y_VU12 texture.
73 PT_TEXTURE_Y_VU12 = (1u << 13u),
74 /// Shader using one Y_U_V12 texture.
75 PT_TEXTURE_Y_U_V12 = (1u << 14u),
76 /// Shader using multiple textures only.
77 PT_TEXTURES = (1u << 15u),
78 /// The texture holds a pixel format with a limited value range, a pixel format has a full value range by default.
80 /// Shader for phantom objects using video see-through Augmented Reality.
81 PT_PHANTOM_VIDEO_FAST = (1u << 17u),
82 /// Shader for phantom video textures used in video see-through Augmented Reality.
84 /// Shader for text using a transparent grayscale texture.
85 PT_TEXT_TRANSPARENT_Y = (1u << 19u),
86 /// Shader for text using an opaque grayscale texture.
87 PT_TEXT_OPAQUE_Y = (1u << 20u),
88 /// Shader for color ids.
89 PT_COLOR_ID = (1u << 21u),
90 /// Shader waiting for more specific information.
91 PT_PENDING = (1u << 22u),
92 /// The shader is a custom shader.
93 PT_CUSTOM = (1u << 23u)
94 };
95
96 public:
97
98 /**
99 * Binds this attribute.
100 * @param framebuffer Framebuffer initiated the rendering process
101 * @param shaderProgram Shader program to be applied
102 */
103 virtual void bindAttribute(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram) = 0;
104
105 /**
106 * Unbinds this attribute.
107 */
108 virtual void unbindAttribute();
109
110 /**
111 * Returns the shader type necessary to render an object with this attribute.
112 * @return Shader program type
113 */
115
116 /**
117 * Translates the program value type into a string containing the individual sub program type.
118 * @param type The program type(s) to translate
119 * @return The program type as string
120 */
122
123 protected:
124
125 /**
126 * Creates a new GLESceneGraph attribute object.
127 */
129
130 /**
131 * Destructs a GLESceneGraph attribute object.
132 */
133 ~GLESAttribute() override;
134};
135
136}
137
138}
139
140}
141
142#endif // META_OCEAN_RENDERING_GLES_ATTRIBUTE_H
Attribute()
Creates a new attribute object.
ObjectType type() const override
Returns the type of this object.
static std::string translateProgramType(const GLESAttribute::ProgramType type)
Translates the program value type into a string containing the individual sub program type.
virtual ProgramType necessaryShader() const
Returns the shader type necessary to render an object with this attribute.
~GLESAttribute() override
Destructs a GLESceneGraph attribute object.
ProgramType
Definition of different shader functionalities.
Definition GLESAttribute.h:43
@ PT_TEXTURE_RGBA
Shader using one RGBA texture.
Definition GLESAttribute.h:63
@ PT_TEXT_TRANSPARENT_Y
Shader for text using a transparent grayscale texture.
Definition GLESAttribute.h:85
@ PT_TEXTURE_LIMITED_RANGE
The texture holds a pixel format with a limited value range, a pixel format has a full value range by...
Definition GLESAttribute.h:79
@ PT_CUSTOM
The shader is a custom shader.
Definition GLESAttribute.h:93
@ PT_UNKNOWN
Not specified shader program.
Definition GLESAttribute.h:45
@ PT_TEXTURES
Shader using multiple textures only.
Definition GLESAttribute.h:77
@ PT_TEXTURE_Y_VU12
Shader using one Y_VU12 texture.
Definition GLESAttribute.h:73
@ PT_TEXTURE_LOWER_LEFT
Shader using one lower left oriented texture.
Definition GLESAttribute.h:57
@ PT_POINTS
Shader using a static color and rendering points.
Definition GLESAttribute.h:49
@ PT_TEXTURE_Y
Shader using one Y texture.
Definition GLESAttribute.h:61
@ PT_PHANTOM_VIDEO_TEXTURE_COORDINATES_FAST
Shader for phantom video textures used in video see-through Augmented Reality.
Definition GLESAttribute.h:83
@ PT_TEXTURE_Y_U_V12
Shader using one Y_U_V12 texture.
Definition GLESAttribute.h:75
@ PI_DEBUG_GRAY
Shader using a default gray material color.
Definition GLESAttribute.h:51
@ PT_MATERIAL
Shader using material.
Definition GLESAttribute.h:53
@ PT_PHANTOM_VIDEO_FAST
Shader for phantom objects using video see-through Augmented Reality.
Definition GLESAttribute.h:81
@ PT_STATIC_COLOR
Shader using a static color.
Definition GLESAttribute.h:47
@ PT_TEXTURE_YVU24
Shader using one YVU24 texture.
Definition GLESAttribute.h:69
@ PT_TEXTURE_UPPER_LEFT
Shader using one upper left oriented texture.
Definition GLESAttribute.h:59
@ PT_TEXTURE_Y_UV12
Shader using one Y_UV12 texture.
Definition GLESAttribute.h:71
@ PT_PENDING
Shader waiting for more specific information.
Definition GLESAttribute.h:91
@ PT_TEXT_OPAQUE_Y
Shader for text using an opaque grayscale texture.
Definition GLESAttribute.h:87
@ PT_TEXTURE_BGRA
Shader using one BGRA texture.
Definition GLESAttribute.h:65
@ PT_LIGHT
Shader using light.
Definition GLESAttribute.h:55
@ PT_TEXTURE_YUV24
Shader using one YUV24 texture.
Definition GLESAttribute.h:67
@ PT_COLOR_ID
Shader for color ids.
Definition GLESAttribute.h:89
virtual void bindAttribute(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram)=0
Binds this attribute.
GLESAttribute()
Creates a new GLESceneGraph attribute object.
virtual void unbindAttribute()
Unbinds this attribute.
This class implements a base for all GLESceneGraph framebuffers.
Definition rendering/glescenegraph/GLESFramebuffer.h:34
GLESObject()
Creates a new GLESceneGraph object.
This class implements a container for an OpenGL ES shader program.
Definition GLESShaderProgram.h:53
Namespace of the Rendering GLESceneGraph library.
Definition rendering/glescenegraph/android/Android.h:20
Namespace of the Rendering library.
Definition AbsoluteTransform.h:18
The namespace covering the entire Ocean framework.
Definition Accessor.h:15