H3D API  2.4.1
ShadowTransform.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 __SHADOWTRANSFORM_H__
30 #define __SHADOWTRANSFORM_H__
31 
33 #include <H3D/DirectionalLight.h>
34 #include <H3D/PointLight.h>
35 #include <H3D/SFRotation.h>
36 #include <H3D/MatrixTransform.h>
37 #include <H3D/X3DGeometryNode.h>
38 
39 namespace H3D {
40 
53  public:
54 
56 
58  ShadowTransform( Inst< SFNode > _metadata = 0,
59  Inst< SFTransformNode > _transform = 0,
60  Inst< MFShadowObjectNode > _shadowVolume = 0,
61  Inst< SFBool > _enabled = 0 );
62 
65  virtual void update();
66 
67  void computeShadowVolumeInformationCPU( const LightDataStruct& light_data, Matrix4f accumulated_fwd, bool render_caps, std::vector< Vec4d >& coord );
68 
69  void renderShadowGPU( const LightDataStruct& light_data, Matrix4f accumulated_fwd, bool render_caps );
70 
72  H3DUniquePtr< MFShadowObjectNode > shadowVolume;
73 
76 
77  protected:
78  // copies of fields that are updated in traverse and are used in computation of shadow volumes
79  // these are thread safe copies
80  Matrix4f transform_matrix_ts;
81  bool is_enabled_ts;
82  std::vector<H3DShadowObjectNode*> shadow_volumes_ts;
83 
84  };
85 }
86 
87 #endif
Header file for DirectionalLight, X3D scene-graph node.
Header file for H3DShadowObjectNode.
Header file for MatrixTransform, X3D scene-graph node.
Header file for PointLight, X3D scene-graph node.
Contains the SFRotation field class.
Header file for X3DGeometryNode, X3D scene-graph node.
The H3DShadowObjectNode is the base class for all shadow objects for use in the ShadowCaster node.
Definition: H3DShadowObjectNode.h:49
The ShadowTransform transforms another H3DShadowObjectNode with the values from the transform field.
Definition: ShadowTransform.h:52
ShadowTransform(Inst< SFNode > _metadata=0, Inst< SFTransformNode > _transform=0, Inst< MFShadowObjectNode > _shadowVolume=0, Inst< SFBool > _enabled=0)
Constructor.
Definition: ShadowTransform.cpp:45
H3DUniquePtr< MFShadowObjectNode > shadowVolume
The shadow volume we want to transform.
Definition: ShadowTransform.h:72
static H3DNodeDatabase database
The H3DNodeDatabase object for this node.
Definition: ShadowTransform.h:75
void renderShadowGPU(const LightDataStruct &light_data, Matrix4f accumulated_fwd, bool render_caps)
Override to do implement shadows using a geometry shader.
Definition: ShadowTransform.cpp:80
virtual void update()
Traverse into the ShadowTransform and through into any shadow volumes, preparing them for rendering.
Definition: ShadowTransform.cpp:58
void computeShadowVolumeInformationCPU(const LightDataStruct &light_data, Matrix4f accumulated_fwd, bool render_caps, std::vector< Vec4d > &coord)
Override to compute the shadow volume information of this object for light used in shadow caster sing...
Definition: ShadowTransform.cpp:98
Template to make sure that the Nodes that are added to a MFNode are of a specified Node type.
Definition: MFNode.h:221
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