Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoEnvironmentElement.h
1 #ifndef COIN_SOENVIRONMENTELEMENT_H
2 #define COIN_SOENVIRONMENTELEMENT_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/elements/SoReplacedElement.h>
37 #include <Inventor/SbColor.h>
38 
39 class COIN_DLL_API SoEnvironmentElement : public SoReplacedElement {
41 
42  SO_ELEMENT_HEADER(SoEnvironmentElement);
43 public:
44  static void initClass(void);
45 protected:
46  virtual ~SoEnvironmentElement();
47 
48 public:
49 
50  enum FogType {
51  NONE,
52  HAZE,
53  FOG,
54  SMOKE
55  };
56 
57  virtual void init(SoState * state);
58 
59  static void set(SoState * const state, SoNode * const node,
60  const float ambientIntensity, const SbColor & ambientColor,
61  const SbVec3f & attenuation, const int32_t fogType,
62  const SbColor & fogColor, const float fogVisibility,
63  const float fogStart = 0.0f);
64  static void get(SoState * const state,
65  float & ambientIntensity, SbColor & ambientColor,
66  SbVec3f & attenuation, int32_t & fogType,
67  SbColor & fogColor, float & fogVisibility,
68  float & fogStart);
69 
70  static float getAmbientIntensity(SoState * const state);
71  static float getFogVisibility(SoState * const state);
72  static const SbVec3f & getLightAttenuation(SoState * const state);
73  static const SbColor & getAmbientColor(SoState * const state);
74  static const SbColor & getFogColor(SoState * const state);
75  static int32_t getFogType(SoState * const state);
76 
77  static void getDefault(float & ambientIntensity,
78  SbColor & ambientColor, SbVec3f & attenuation,
79  int32_t & fogType, SbColor & fogColor,
80  float & fogVisibility, float & fogNear);
81 
82  virtual void print(FILE * file) const;
83 
84 protected:
85 
86  virtual void setElt(SoState * const state,
87  const float ambientIntensity,
88  const SbColor & ambientColor,
89  const SbVec3f & attenuation,
90  const int32_t fogType,
91  const SbColor & fogColor,
92  const float fogVisibility,
93  const float fogNear);
94 
98  int32_t fogType;
101  float fogStart;
102 };
103 
104 #endif // !COIN_SOENVIRONMENTELEMENT_H
The SbColor class contains the red, green and blue components which make up a color value...
Definition: SbColor.h:39
float fogStart
Definition: SoEnvironmentElement.h:101
FogType
Definition: SoEnvironmentElement.h:50
The SoEnvironmentElement class is yet to be documented.
Definition: SoEnvironmentElement.h:39
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:56
float fogVisibility
Definition: SoEnvironmentElement.h:100
The SoState class manages the Coin scenegraph traversal state data.
Definition: SoState.h:44
virtual void init(SoState *state)
Definition: SoReplacedElement.cpp:89
SbColor fogColor
Definition: SoEnvironmentElement.h:99
SbColor ambientColor
Definition: SoEnvironmentElement.h:96
int32_t fogType
Definition: SoEnvironmentElement.h:98
The SoReplacedElement class is an abstract element superclass.
Definition: SoReplacedElement.h:39
virtual void print(FILE *file) const
Definition: SoReplacedElement.cpp:118
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:51
float ambientIntensity
Definition: SoEnvironmentElement.h:95
SbVec3f attenuation
Definition: SoEnvironmentElement.h:97