Skip to content

Commit 6ec8ece

Browse files
committed
Add Doxygen documentation, plus a few small fixes.
1 parent 24982a6 commit 6ec8ece

File tree

13 files changed

+485
-43
lines changed

13 files changed

+485
-43
lines changed

src/libprojectM/MilkdropPreset/FinalComposite.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ class FinalComposite
8787
static constexpr int vertexCount{compositeGridWidth * compositeGridHeight};
8888
static constexpr int indexCount{(compositeGridWidth - 2) * (compositeGridHeight - 2) * 6};
8989

90-
Renderer::Mesh m_compositeMesh; //!< The composite shader mesh.
91-
Renderer::VertexBuffer<Renderer::Point> m_radiusAngle; //!< Additional vertex attribute array for radius and angle.
90+
Renderer::Mesh m_compositeMesh; //!< The composite shader mesh.
91+
Renderer::VertexBuffer<Renderer::Point> m_radiusAngle{Renderer::VertexBufferUsage::StreamDraw}; //!< Additional vertex attribute array for radius and angle.
9292

9393
int m_viewportWidth{}; //!< Last known viewport width.
9494
int m_viewportHeight{}; //!< Last known viewport height.
9595

9696
std::unique_ptr<MilkdropShader> m_compositeShader; //!< The composite shader. Either preset-defined or empty.
97-
std::unique_ptr<VideoEcho> m_videoEcho; //!< Video echo effect. Used if no composite shader is loaded and video echo is enabled.
98-
std::unique_ptr<Filters> m_filters; //!< Color post-processing filters. Used if no composite shader is loaded.
97+
std::unique_ptr<VideoEcho> m_videoEcho; //!< Video echo effect. Used if no composite shader is loaded and video echo is enabled.
98+
std::unique_ptr<Filters> m_filters; //!< Color post-processing filters. Used if no composite shader is loaded.
9999
};
100100

101101
} // namespace MilkdropPreset

src/libprojectM/MilkdropPreset/PerPixelMesh.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ class PerPixelMesh
122122
int m_viewportWidth{}; //!< Last known viewport width.
123123
int m_viewportHeight{}; //!< Last known viewport height.
124124

125-
Renderer::Mesh m_warpMesh; //!< The Warp effect mesh
126-
Renderer::VertexBuffer<RadiusAngle> m_radiusAngleBuffer; //!< Vertex attribute buffer for radius and angle values.
127-
Renderer::VertexBuffer<ZoomRotWarp> m_zoomRotWarpBuffer; //!< Vertex attribute buffer for zoom, roation and warp values.
128-
Renderer::VertexBuffer<Renderer::Point> m_centerBuffer; //!< Vertex attribute buffer for center coordinate values.
129-
Renderer::VertexBuffer<Renderer::Point> m_distanceBuffer; //!< Vertex attribute buffer for distance values.
130-
Renderer::VertexBuffer<Renderer::Point> m_stretchBuffer; //!< Vertex attribute buffer for stretch values.
125+
Renderer::Mesh m_warpMesh; //!< The Warp effect mesh
126+
Renderer::VertexBuffer<RadiusAngle> m_radiusAngleBuffer{Renderer::VertexBufferUsage::StreamDraw}; //!< Vertex attribute buffer for radius and angle values.
127+
Renderer::VertexBuffer<ZoomRotWarp> m_zoomRotWarpBuffer{Renderer::VertexBufferUsage::StreamDraw}; //!< Vertex attribute buffer for zoom, roation and warp values.
128+
Renderer::VertexBuffer<Renderer::Point> m_centerBuffer{Renderer::VertexBufferUsage::StreamDraw}; //!< Vertex attribute buffer for center coordinate values.
129+
Renderer::VertexBuffer<Renderer::Point> m_distanceBuffer{Renderer::VertexBufferUsage::StreamDraw}; //!< Vertex attribute buffer for distance values.
130+
Renderer::VertexBuffer<Renderer::Point> m_stretchBuffer{Renderer::VertexBufferUsage::StreamDraw}; //!< Vertex attribute buffer for stretch values.
131131

132132
std::weak_ptr<Renderer::Shader> m_perPixelMeshShader; //!< Special shader which calculates the per-pixel UV coordinates.
133133
std::unique_ptr<MilkdropShader> m_warpShader; //!< The warp shader. Either preset-defined or a default shader.

src/libprojectM/Renderer/BlendMode.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
namespace libprojectM {
66
namespace Renderer {
77

8+
/**
9+
* A simple wrapper class around OpenGL's blend mode functionality.
10+
*/
811
class BlendMode
912
{
1013
public:
14+
/**
15+
* Available blend functions.
16+
* @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml
17+
*/
1118
enum class Function : int
1219
{
1320
Zero,
@@ -33,12 +40,23 @@ class BlendMode
3340

3441
BlendMode() = delete;
3542

43+
/**
44+
* @brief Enables or disables blending and sets the blend functions.
45+
* A convenience wrapper around BlendMode::SetBlendActive() and BlendMode::SetBlendFunction().
46+
* @param enable If true, blending is enabled, otherwise disabled.
47+
* @param srcFunc The blend function to determine the source color.
48+
* @param dstFunc the blend function to determine the destination color.
49+
*/
3650
static void Set(bool enable, Function srcFunc, Function dstFunc)
3751
{
3852
SetBlendActive(enable);
3953
SetBlendFunction(srcFunc, dstFunc);
4054
}
4155

56+
/**
57+
* Enables or disables blending.
58+
* @param enable If true, blending is enabled, otherwise disabled.
59+
*/
4260
static void SetBlendActive(bool enable)
4361
{
4462
if (enable)
@@ -51,12 +69,22 @@ class BlendMode
5169
}
5270
}
5371

72+
/**
73+
* Sets the blend functions.
74+
* @param srcFunc The blend function to determine the source color.
75+
* @param dstFunc the blend function to determine the destination color.
76+
*/
5477
static void SetBlendFunction(Function srcFunc, Function dstFunc)
5578
{
5679
glBlendFunc(FunctionToGL(srcFunc), FunctionToGL(dstFunc));
5780
}
5881

5982
private:
83+
/**
84+
* Translates the Function enum values into OpenGL constants.
85+
* @param func The blend function to translate.
86+
* @return the OpenGL constant for the given blend function.
87+
*/
6088
static GLuint FunctionToGL(Function func)
6189
{
6290
switch (func)

src/libprojectM/Renderer/Color.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ class Color
161161
Modulo(col.A()));
162162
}
163163

164+
/**
165+
* @brief Initializes the attribute array pointer for this storage type.
166+
* @param attributeIndex the attribute index to use.
167+
*/
164168
static void InitializeAttributePointer(uint32_t attributeIndex)
165169
{
166170
glVertexAttribPointer(attributeIndex, sizeof(Color) / sizeof(float), GL_FLOAT, GL_FALSE, sizeof(Color), nullptr);

src/libprojectM/Renderer/Mesh.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ Mesh::Mesh(VertexBufferUsage usage)
1212
: m_vertices(usage)
1313
, m_colors(usage)
1414
, m_textureUVs(usage)
15+
, m_indices(usage)
1516
{
1617
Initialize();
1718
}
1819

1920
Mesh::Mesh(VertexBufferUsage usage, bool useColor, bool useTextureUVs)
20-
: m_vertices(usage)
21+
: m_useColorAttributes(useColor)
22+
, m_useUVAttributes(useTextureUVs)
23+
, m_vertices(usage)
2124
, m_colors(usage)
2225
, m_textureUVs(usage)
23-
, m_useColorAttributes(useColor)
24-
, m_useUVAttributes(useTextureUVs)
26+
, m_indices(usage)
2527
{
2628
Initialize();
2729
}

0 commit comments

Comments
 (0)