KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
pvr_fog.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/pvr/pvr_fog.h
4 Copyright (C) 2002 Megan Potter
5 Copyright (C) 2014 Lawrence Sebald
6 Copyright (C) 2023 Ruslan Rostovtsev
7 Copyright (C) 2024 Falco Girgis
8*/
9
10/** \file dc/pvr/pvr_fog.h
11 \brief Public API for the PVR's hardware fog
12 \ingroup pvr_fog
13
14 \author Megan Potter
15 \author Roger Cattermole
16 \author Paul Boese
17 \author Brian Paul
18 \author Lawrence Sebald
19 \author Benoit Miller
20 \author Falco Girgis
21*/
22
23#ifndef __DC_PVR_PVR_FOG_H
24#define __DC_PVR_PVR_FOG_H
25
26#include <sys/cdefs.h>
27__BEGIN_DECLS
28
29/** \defgroup pvr_fog Fog
30 \brief Hardware Fog API for the PowerVR
31 \ingroup pvr_global
32
33 \todo Explain fog modes + equations
34
35 \note
36 Thanks to Paul Boese for figuring this stuff out
37
38 @{
39*/
40
41/** Set the table fog color.
42
43 This function sets the color of fog for table fog. `0-1` range for all colors.
44
45 \param a Alpha value of the fog
46 \param r Red value of the fog
47 \param g Green value of the fog
48 \param b Blue value of the fog
49*/
50void pvr_fog_table_color(float a, float r, float g, float b);
51
52/** Set the vertex fog color.
53
54 This function sets the fog color for vertex fog. `0-1` range for all colors.
55
56 \todo
57 This function is currently not implemented, as vertex fog is not supported
58 by KOS.
59
60 \warning
61 Calling this function will cause an assertion failure.
62
63 \param a Alpha value of the fog
64 \param r Red value of the fog
65 \param g Green value of the fog
66 \param b Blue value of the fog
67*/
68void pvr_fog_vertex_color(float a, float r, float g, float b);
69
70/** Set the fog far depth.
71
72 This function sets the `PVR_FOG_DENSITY` register appropriately for the
73 specified value.
74
75 \param d The depth to set
76*/
77void pvr_fog_far_depth(float d);
78
79/** Initialize the fog table using an exp2 algorithm (like `GL_EXP2`).
80
81 This function will automatically set the `PVR_FOG_DENSITY` register to
82 `259.999999` as a part of its processing, then set up the fog table.
83
84 \param density Fog density value
85
86 \sa pvr_fog_table_exp(), pvr_fog_table_linear(), pvr_fog_table_custom()
87*/
88void pvr_fog_table_exp2(float density);
89
90/** Initialize the fog table using an exp algorithm (like `GL_EXP`).
91
92 This function will automatically set the `PVR_FOG_DENSITY` register to
93 `259.999999` as a part of its processing, then set up the fog table.
94
95 \param density Fog density value
96
97 \sa pvr_fog_table_exp2(), pvr_fog_table_linear(), pvr_fog_table_custom()
98*/
99void pvr_fog_table_exp(float density);
100
101/** Initialize the fog table using a linear algorithm (like `GL_LINEAR`).
102
103 This function will set the `PVR_FOG_DENSITY` register to the as appropriate
104 for the end value, and initialize the fog table for perspectively correct
105 linear fog.
106
107 \param start Fog start point
108 \param end Fog end point
109
110 \sa pvr_fog_table_exp(), pvr_fog_table_exp2(), pvr_fog_table_custom()
111*/
112void pvr_fog_table_linear(float start, float end);
113
114/** Set a custom fog table from float values
115
116 This function allows you to specify whatever values you need to for your fog
117 parameters. All values should be clamped between `0` and `1`, and its your
118 responsibility to set up the `PVR_FOG_DENSITY` register by calling
119 pvr_fog_far_depth() with an appropriate value. The table passed in should
120 have `129` entries, where the `0`th entry is farthest from the eye and the last
121 entry is nearest. Higher values = heavier fog.
122
123 \param table The table of fog values to set
124
125 \sa pvr_fog_table_exp2(), pvr_fog_table_exp(), pvr_fog_table_linear()
126*/
127void pvr_fog_table_custom(float *table);
128
129/** @} */
130
131__END_DECLS
132
133#endif /* __DC_PVR_PVR_FOG_H */
void pvr_fog_table_exp2(float density)
Initialize the fog table using an exp2 algorithm (like GL_EXP2).
void pvr_fog_table_linear(float start, float end)
Initialize the fog table using a linear algorithm (like GL_LINEAR).
void pvr_fog_table_custom(float *table)
Set a custom fog table from float values.
void pvr_fog_table_color(float a, float r, float g, float b)
Set the table fog color.
void pvr_fog_far_depth(float d)
Set the fog far depth.
void pvr_fog_table_exp(float density)
Initialize the fog table using an exp algorithm (like GL_EXP).
void pvr_fog_vertex_color(float a, float r, float g, float b)
Set the vertex fog color.