VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtPlanarReflection.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <osg/Camera>
15 #include <osg/ClipNode>
16 #include <osg/Texture2D>
17 
18 // Whether to use an oblique frustum plane or an OpenGL clip plane
19 // for reflection clipping at the waterline.
20 // Remember to also uncomment assignment of gl_ClipVertex in uber_vs.glsl if
21 // you use OpenGL clip planes.
22 #define USE_OBLIQUE_CLIP_PLANE
23 
24 namespace makVrv
25 {
26  class DtDe;
27  class DtOsgCullVisitor;
30  class DtPlanarReflection : public osg::Camera
31  {
32  public:
34  DtPlanarReflection( osg::Camera * mainCamera, DtDe& de );
35 
37  osg::Texture2D * getTexture();
38 
40  osg::RefMatrix * getTextureProjectionMatrix();
41 
42  // Override Node::accept to intercept cull visitor traversal
43  virtual void accept(osg::NodeVisitor& nv);
44 
45  // Enable / disable this reflection camera at runtime.
46  virtual void enable(bool enabled);
47 
48  virtual void releaseGLObjects(osg::State* state = 0);
49 
50 #ifdef USE_OBLIQUE_CLIP_PLANE
51  void setClipPlane(const osg::Vec4d& v) {clipPlane = v;}
52 #endif
54 
55  protected:
56  virtual void lodScaleChanged( float lodScale );
57 
58  osg::Matrixd modifyProjectionMatrix(const osg::Matrix& sceneProjection, const osg::Vec4d& clipPlane) const;
59 
61  virtual ~DtPlanarReflection();
62 
63  void setupColorBufferTexture(int format, int sourceFormat, int sourceType);
64 
65 
66  protected:
69 
70  osg::ref_ptr< osg::Texture2D > myTexture, myDepthTexture;
71  osg::ref_ptr< osg::RefMatrix > myTextureProjectionMatrix;
72  osg::ref_ptr< osg::Camera > mySceneCamera;
73 
77 
78 
79 #ifdef USE_OBLIQUE_CLIP_PLANE
80  osg::Vec4d clipPlane;
81 #endif
82  };
83 }
84 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)