My Project
Loading...
Searching...
No Matches
CFog.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, CHAI3D
5 (www.chai3d.org)
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials provided
19 with the distribution.
20
21 * Neither the name of CHAI3D nor the names of its contributors may
22 be used to endorse or promote products derived from this software
23 without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37
38 \author <http://www.chai3d.org>
39 \author Francois Conti
40 \version 3.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CFogH
46#define CFogH
47//------------------------------------------------------------------------------
48#include "graphics/CColor.h"
50//------------------------------------------------------------------------------
51
52//------------------------------------------------------------------------------
53namespace chai3d {
54//------------------------------------------------------------------------------
55
56//==============================================================================
63//==============================================================================
64
65//==============================================================================
80//==============================================================================
81class cFog
82{
83 //--------------------------------------------------------------------------
84 // CONSTRUCTOR & DESTRUCTOR:
85 //--------------------------------------------------------------------------
86
87public:
88
90 cFog();
91
93 virtual ~cFog() {};
94
95
96 //-----------------------------------------------------------------------
97 // PUBLIC METHODS:
98 //--------------------------------------------------------------------------
99
100public:
101
103 virtual void render(cRenderOptions& a_options);
104
106 void setEnabled(const bool a_enabled) { m_enabled = a_enabled; }
107
109 bool getEnabled() const { return(m_enabled); }
110
112 void setFogMode(const GLint a_fogMode) { m_fogMode = a_fogMode; }
113
115 void setFogModeLINEAR() { m_fogMode = GL_LINEAR; }
116
118 void setFogModeEXP() { m_fogMode = GL_EXP; }
119
121 void setFogModeEXP2() { m_fogMode = GL_EXP2; }
122
124 GLint getFogMode() { return (m_fogMode); }
125
127 void setProperties(const double a_start,
128 const double a_end,
129 const double a_density);
130
131
132 //-----------------------------------------------------------------------
133 // PUBLIC MEMBERS:
134 //--------------------------------------------------------------------------
135
136public:
137
140
141
142 //-----------------------------------------------------------------------
143 // PROTECTED MEMBERS:
144 //--------------------------------------------------------------------------
145
146protected:
147
150
153
155 float m_start;
156
158 float m_end;
159
162};
163
164//------------------------------------------------------------------------------
165} // namespace chai3d
166//------------------------------------------------------------------------------
167
168//------------------------------------------------------------------------------
169#endif
170//------------------------------------------------------------------------------
171
Implements color properties.
Implements a structure to store rendering options.
This class implements fog inside the world.
Definition CFog.h:82
cColorf m_color
Fog color.
Definition CFog.h:139
GLint m_fogMode
Fog mode. (GL_LINEAR, GL_EXP, GL_EXP2).
Definition CFog.h:152
void setFogModeEXP2()
This method sets the fog mode to GL_EXP2.
Definition CFog.h:121
GLint getFogMode()
This method returns the current fog mode.
Definition CFog.h:124
bool getEnabled() const
This method returns true if fog is enabled, false otherwise.
Definition CFog.h:109
bool m_enabled
If true, then fog is enabled, false otherwise.
Definition CFog.h:149
void setFogModeLINEAR()
This method sets the fog mode to GL_LINEAR.
Definition CFog.h:115
float m_density
Fog density.
Definition CFog.h:161
void setFogMode(const GLint a_fogMode)
This method sets the fog mode by passing the OpenGL fog mode constant as parameter (GL_LINEAR,...
Definition CFog.h:112
virtual void render(cRenderOptions &a_options)
This method renders the fog using OpenGL.
Definition CFog.cpp:97
void setFogModeEXP()
This method sets the fog mode to GL_EXP.
Definition CFog.h:118
void setProperties(const double a_start, const double a_end, const double a_density)
This method sets the fog properties.
Definition CFog.cpp:82
cFog()
Constructor of cFog.
Definition CFog.cpp:57
float m_end
Fog end distance.
Definition CFog.h:158
virtual ~cFog()
Destructor of cFog.
Definition CFog.h:93
void setEnabled(const bool a_enabled)
This method enables of disables fog.
Definition CFog.h:106
float m_start
Fog start distance.
Definition CFog.h:155
Definition CAudioBuffer.cpp:57
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83