VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtPlanarReflectionCamera.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 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 DtPlanarReflectionCamera : public osg::Camera
28  {
29  public:
31  DtPlanarReflectionCamera(osg::Camera* mainCamera, DtDe& de);
32 
33  protected:
35  virtual ~DtPlanarReflectionCamera();
36 
37  public:
39  virtual osg::Texture* reflectionTexture();
40 
42  virtual const osg::Texture* reflectionTexture() const;
43 
45  virtual osg::RefMatrix * textureProjectionMatrix();
46 
48  virtual const osg::RefMatrix* textureProjectionMatrix() const;
49 
51  virtual void accept(osg::NodeVisitor& nv);
52 
54  virtual void enable(bool enabled);
55 
57  virtual void releaseGLObjects(osg::State* state = 0) const;
58 
60  virtual void setClipPlane(const osg::Vec4d& v);
61 
63  virtual bool isRenderToTextureValid();
64 
66  virtual void setMirrorMatrix(const osg::Matrix& mirror);
67 
69  virtual void updateFogColor(bool skyEnabled, const osg::Vec4f& envFogColor);
70 
72  virtual const osg::observer_ptr<osg::Camera>& sceneCameraObserver(void) const;
73 
74  protected:
75 
78  virtual void lodScaleChanged(float lodScale);
79 
81  virtual osg::Matrixd modifyProjectionMatrix(const osg::Matrix& sceneProjection, const osg::Vec4d& clipPlane) const;
82 
84  virtual void setupColorBufferTexture(int format, int sourceFormat, int sourceType);
85 
87  virtual osg::Texture* allocateRenderTexture(int width, int height);
88 
90  virtual void updateReflectionTexture();
91 
92  protected:
93 
96 
100  osg::observer_ptr< osg::Camera > mySceneCameraObserver;
101 
102  osg::Matrix myMirrorMatrix;
103 
107 
108  int myWidth;
109  int myHeight;
110 
111  osg::Vec4d myClipPlane;
112 
113  const unsigned int myNodeMask;
114  };
115 }
virtual void accept(osg::NodeVisitor &nv)
Override Node::accept to intercept cull visitor traversal.
virtual void lodScaleChanged(float lodScale)
pass in a new lod scale to use for calculating the lod connected to the signal_oceanPlanarReflections...
int mySourceFormat
Definition: DtPlanarReflectionCamera.h:105
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...
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...
osg::Vec4d myClipPlane
Definition: DtPlanarReflectionCamera.h:111
virtual osg::Matrixd modifyProjectionMatrix(const osg::Matrix &sceneProjection, const osg::Vec4d &clipPlane) const
modify projection matrix based on clip plane
osg::observer_ptr< osg::Camera > mySceneCameraObserver
Definition: DtPlanarReflectionCamera.h:100
osg::Matrix myMirrorMatrix
Definition: DtPlanarReflectionCamera.h:102
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 myWidth
Definition: DtPlanarReflectionCamera.h:108
DtPlanarReflectionCamera(osg::Camera *mainCamera, DtDe &de)
CTOR.
osg::ref_ptr< osg::RefMatrix > myTextureProjectionMatrix
Definition: DtPlanarReflectionCamera.h:99
virtual void setupColorBufferTexture(int format, int sourceFormat, int sourceType)
setup the color buffer format
A camera for rendering Triton&#39;s planar reflection texture.
Definition: DtPlanarReflectionCamera.h:27
virtual bool isRenderToTextureValid()
check to see if the render to texture settings are valid
int myHeight
Definition: DtPlanarReflectionCamera.h:109
int mySourceType
Definition: DtPlanarReflectionCamera.h:106
osg::ref_ptr< osg::Texture > myTexture
Definition: DtPlanarReflectionCamera.h:97
virtual osg::RefMatrix * textureProjectionMatrix()
Retrieve the matrix used to map this texture to the water surface.
virtual void updateReflectionTexture()
update the reflection texture settings based on the current main camera settings. ...
virtual const osg::observer_ptr< osg::Camera > & sceneCameraObserver(void) const
access
int myTexFormat
Definition: DtPlanarReflectionCamera.h:104
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
virtual void enable(bool enabled)
Enable / disable this reflection camera at runtime.
const unsigned int myNodeMask
Definition: DtPlanarReflectionCamera.h:113
DtSignalConnectionManager myConnections
Definition: DtPlanarReflectionCamera.h:95
virtual ~DtPlanarReflectionCamera()
DTOR.
Base class to provide boost signal/slot management.
virtual void updateFogColor(bool skyEnabled, const osg::Vec4f &envFogColor)
sets the clear color to match the fog color for this camera.
virtual osg::Texture * reflectionTexture()
Retrieve the reflection map texture this camera renders to.
osg::ref_ptr< osg::Texture > myDepthTexture
Definition: DtPlanarReflectionCamera.h:98
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
virtual void setClipPlane(const osg::Vec4d &v)
Set the clip plane for this planar reflection camera.
DtDe & myDe
Definition: DtPlanarReflectionCamera.h:94

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)