Skip to content

Commit 7653827

Browse files
committed
Add Doxygen documentation, plus a few small fixes.
1 parent f8b5573 commit 7653827

File tree

13 files changed

+489
-100
lines changed

13 files changed

+489
-100
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: 32 additions & 57 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,67 +40,35 @@ class BlendMode
3340

3441
BlendMode() = delete;
3542

36-
static void Set(bool enable, Function srcFunc, Function dstFunc)
37-
{
38-
SetBlendActive(enable);
39-
SetBlendFunction(srcFunc, dstFunc);
40-
}
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+
*/
50+
static void Set(bool enable, Function srcFunc, Function dstFunc);
4151

42-
static void SetBlendActive(bool enable)
43-
{
44-
if (enable)
45-
{
46-
glEnable(GL_BLEND);
47-
}
48-
else
49-
{
50-
glDisable(GL_BLEND);
51-
}
52-
}
52+
/**
53+
* Enables or disables blending.
54+
* @param enable If true, blending is enabled, otherwise disabled.
55+
*/
56+
static void SetBlendActive(bool enable);
5357

54-
static void SetBlendFunction(Function srcFunc, Function dstFunc)
55-
{
56-
glBlendFunc(FunctionToGL(srcFunc), FunctionToGL(dstFunc));
57-
}
58+
/**
59+
* Sets the blend functions.
60+
* @param srcFunc The blend function to determine the source color.
61+
* @param dstFunc the blend function to determine the destination color.
62+
*/
63+
static void SetBlendFunction(Function srcFunc, Function dstFunc);
5864

5965
private:
60-
static GLuint FunctionToGL(Function func)
61-
{
62-
switch (func)
63-
{
64-
case Function::Zero:
65-
return GL_ZERO;
66-
case Function::One:
67-
default:
68-
return GL_ONE;
69-
case Function::SourceColor:
70-
return GL_SRC_COLOR;
71-
case Function::OneMinusSourceColor:
72-
return GL_ONE_MINUS_SRC_COLOR;
73-
case Function::DestinationColor:
74-
return GL_DST_COLOR;
75-
case Function::OneMinusDestinationColor:
76-
return GL_ONE_MINUS_DST_COLOR;
77-
case Function::SourceAlpha:
78-
return GL_SRC_ALPHA;
79-
case Function::OneMinusSourceAlpha:
80-
return GL_ONE_MINUS_SRC_ALPHA;
81-
case Function::DestinationAlpha:
82-
return GL_DST_ALPHA;
83-
case Function::OneMinusDestinationAlpha:
84-
return GL_ONE_MINUS_DST_ALPHA;
85-
case Function::ConstantColor:
86-
return GL_CONSTANT_COLOR;
87-
case Function::OneMinusConstantColor:
88-
return GL_ONE_MINUS_CONSTANT_COLOR;
89-
case Function::ConstantAlpha:
90-
return GL_CONSTANT_ALPHA;
91-
case Function::OneMinusConstantAlpha:
92-
return GL_ONE_MINUS_CONSTANT_ALPHA;
93-
case Function::SourceAlphaSaturate:
94-
return GL_SRC_ALPHA_SATURATE;
95-
}
96-
}
66+
/**
67+
* Translates the Function enum values into OpenGL constants.
68+
* @param func The blend function to translate.
69+
* @return the OpenGL constant for the given blend function.
70+
*/
71+
static GLuint FunctionToGL(Function func);
9772
};
9873

9974
} // namespace Renderer

src/libprojectM/Renderer/Color.hpp

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

165+
/**
166+
* @brief Initializes the attribute array pointer for this storage type.
167+
* @param attributeIndex the attribute index to use.
168+
*/
165169
static void InitializeAttributePointer(uint32_t attributeIndex)
166170
{
167171
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)