H3D API  2.4.1
Fog.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __FOG_H__
30 #define __FOG_H__
31 
32 #include <H3D/X3DBindableNode.h>
33 #include <H3D/X3DFogObject.h>
34 
35 namespace H3D {
61  class H3DAPI_API Fog :
62  public X3DBindableNode,
63  public X3DFogObject {
64  public:
66  Fog( Inst< SFSetBind > _set_bind = 0,
67  Inst< SFNode > _metadata = 0,
68  Inst< SFTime > _bindTime = 0,
69  Inst< SFBool > _isBound = 0,
70  Inst< SFColor > _color = 0,
71  Inst< SFString > _fogType = 0,
72  Inst< SFFloat > _visibilityRange = 0 );
73 
75  static inline Fog *getActive() {
76  return static_cast< Fog * >( X3DBindableNode::getActive( "Fog" ) );
77  }
78 
80  virtual void renderFog();
81 
85  virtual void traverseSG( TraverseInfo &ti ) {
86  Matrix3f m = ti.getAccForwardMatrix().getScaleRotationPart();
87  Vec3f scaled_v = m * Vec3f( 0, 0, 1 );
88  scale_local_to_global = scaled_v.length();
89  }
90 
93  protected:
96 
97  };
98 }
99 
100 #endif
Header file for X3DBindableNode, X3D scene-graph node.
Header file for X3DFogObject, X3D scene-graph node.
The Fog node provides a way to simulate atmospheric effects by blending objects with the colour speci...
Definition: Fog.h:63
static Fog * getActive()
Convenience function to get the top of the Fog stack.
Definition: Fog.h:75
virtual void traverseSG(TraverseInfo &ti)
Traverse the scenegraph.
Definition: Fog.h:85
H3DFloat scale_local_to_global
The scaling factor from local to global space.
Definition: Fog.h:95
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Fog.h:92
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
const Matrix4f & getAccForwardMatrix()
Get the accumulated forward transformation matrix, i.e.
Definition: TraverseInfo.h:363
X3DBindableNode is the abstract base type for all bindable children nodes, including Background,...
Definition: X3DBindableNode.h:108
static X3DBindableNode * getActive(const string &bindable_stack_name)
Returns the active bindable instance, i.e.
Definition: X3DBindableNode.h:149
X3DFogObject is the abstract type that describes a node that influences the lighting equation through...
Definition: X3DFogObject.h:41
float H3DFloat
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194