Coin: SoEnvironmentElement.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/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 {
40 typedef SoReplacedElement inherited;
41
42 SO_ELEMENT_HEADER(SoEnvironmentElement);
43public:
44 static void initClass(void);
45protected:
46 virtual ~SoEnvironmentElement();
47
48public:
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
84protected:
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
95 float ambientIntensity;
96 SbColor ambientColor;
97 SbVec3f attenuation;
98 int32_t fogType;
99 SbColor fogColor;
100 float fogVisibility;
101 float fogStart;
102};
103
104#endif // !COIN_SOENVIRONMENTELEMENT_H
SbColor
The SbColor class contains the red, green and blue components which make up a color value.
Definition SbColor.h:39
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SoEnvironmentElement::ambientColor
SbColor ambientColor
Definition SoEnvironmentElement.h:96
SoEnvironmentElement::fogColor
SbColor fogColor
Definition SoEnvironmentElement.h:99
SoEnvironmentElement::ambientIntensity
float ambientIntensity
Definition SoEnvironmentElement.h:95
SoEnvironmentElement::fogVisibility
float fogVisibility
Definition SoEnvironmentElement.h:100
SoEnvironmentElement::attenuation
SbVec3f attenuation
Definition SoEnvironmentElement.h:97
SoEnvironmentElement::fogStart
float fogStart
Definition SoEnvironmentElement.h:101
SoEnvironmentElement::fogType
int32_t fogType
Definition SoEnvironmentElement.h:98
SoEnvironmentElement::FogType
FogType
Definition SoEnvironmentElement.h:50
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoReplacedElement::initClass
static void initClass(void)
Definition SoReplacedElement.cpp:77
SoReplacedElement::init
virtual void init(SoState *state)
Definition SoReplacedElement.cpp:91
SoReplacedElement::print
virtual void print(FILE *file) const
Definition SoReplacedElement.cpp:120
SoState
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44