VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtPlanarReflection.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
15 
16 #include <osg/Camera>
17 #include <osg/ClipNode>
18 #include <osg/Texture2D>
19 
20 namespace makVrv
21 {
22  class DtDe;
23  class DtOsgCullVisitor;
24 
27  class DtPlanarReflection : public osg::Camera
28  {
29  public:
31  DtPlanarReflection(osg::Camera* mainCamera, DtDe& de);
32 
33  protected:
35  virtual ~DtPlanarReflection();
36 
37  public:
39  virtual osg::Texture* getTexture();
40 
42  virtual osg::RefMatrix * getTextureProjectionMatrix();
43 
45  virtual void accept(osg::NodeVisitor& nv);
46 
48  virtual void enable(bool enabled);
49 
51  virtual void releaseGLObjects(osg::State* state = 0) const;
52 
53 #ifdef USE_OBLIQUE_CLIP_PLANE
54  virtual void setClipPlane(const osg::Vec4d& v);
56 #endif
57 
59  virtual bool isRenderToTextureValid();
60 
62  virtual void setMirrorMatrix(const osg::Matrix& mirror);
63 
65  virtual void updateFogColor(bool skyEnabled, const osg::Vec4f& envFogColor);
66 
67  protected:
68 
71  virtual void lodScaleChanged(float lodScale);
72 
74  virtual osg::Matrixd modifyProjectionMatrix(const osg::Matrix& sceneProjection, const osg::Vec4d& clipPlane) const;
75 
77  virtual void setupColorBufferTexture(int format, int sourceFormat, int sourceType);
78 
80  virtual osg::Texture* allocateRenderTexture(int width, int height);
81 
83  virtual void updateReflectionTexture();
84 
85  protected:
86 
89 
93  osg::observer_ptr< osg::Camera > mySceneCameraObserver;
94 
95  osg::Matrix myMirrorMatrix;
96 
100 
101 #ifdef USE_OBLIQUE_CLIP_PLANE
102  osg::Vec4d myClipPlane;
103 #endif
104  };
105 }
virtual void setupColorBufferTexture(int format, int sourceFormat, int sourceType)
setup the color buffer format
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
DtDe & myDe
Definition: DtPlanarReflection.h:87
virtual osg::RefMatrix * getTextureProjectionMatrix()
Retrieve the matrix used to map this texture to the water surface.
osg::observer_ptr< osg::Camera > mySceneCameraObserver
Definition: DtPlanarReflection.h:93
int mySourceType
Definition: DtPlanarReflection.h:99
osg::ref_ptr< osg::Texture > myTexture
Definition: DtPlanarReflection.h:90
virtual void accept(osg::NodeVisitor &nv)
Override Node::accept to intercept cull visitor traversal.
A camera for rendering Triton&#39;s planar reflection texture.
Definition: DtPlanarReflection.h:27
virtual void updateFogColor(bool skyEnabled, const osg::Vec4f &envFogColor)
sets the clear color to match the fog color for this camera.
virtual osg::Texture * allocateRenderTexture(int width, int height)
allocate a render texture and set it&#39;s size, the function will handle creating Texture2DArray if need...
int mySourceFormat
Definition: DtPlanarReflection.h:98
osg::ref_ptr< osg::Texture > myDepthTexture
Definition: DtPlanarReflection.h:91
virtual ~DtPlanarReflection()
DTOR.
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
virtual osg::Matrixd modifyProjectionMatrix(const osg::Matrix &sceneProjection, const osg::Vec4d &clipPlane) const
only used if USE_OBLIQUE_CLIP_PLANE is enabled
virtual void enable(bool enabled)
Enable / disable this reflection camera at runtime.
virtual osg::Texture * getTexture()
Retrieve the reflection map texture this camera renders to.
virtual void updateReflectionTexture()
update the reflection texture settings based on the current main camera settings. ...
DtPlanarReflection(osg::Camera *mainCamera, DtDe &de)
CTOR.
virtual bool isRenderToTextureValid()
check to see if the render to texture settings are valid
int myTexFormat
Definition: DtPlanarReflection.h:97
osg::Matrix myMirrorMatrix
Definition: DtPlanarReflection.h:95
DtSignalConnectionManager myConnections
Definition: DtPlanarReflection.h:88
Base class to provide boost signal/slot management.
osg::ref_ptr< osg::RefMatrix > myTextureProjectionMatrix
Definition: DtPlanarReflection.h:92
virtual void releaseGLObjects(osg::State *state=0) const
Called when a graphic context is destroyed or when this object needs to cleanup its opengl objects...
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
virtual void lodScaleChanged(float lodScale)
pass in a new lod scale to use for calculating the lod connected to the signal_oceanPlanarReflections...
virtual void setMirrorMatrix(const osg::Matrix &mirror)
set the mirror matrix for this planar reflection, used to mirror the scene for the reflection pass re...

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)