VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSwapChain.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
15 #include <osg/StateSet>
16 
17 #include <vector>
18 #include <map>
19 
20 namespace makVrv
21 {
22  class DtDe;
23  class DtGlProgram;
24 
26  {
30  NONE
31  };
32 
36  {
37  private:
39  DtSwapChain();
40 
42  DtSwapChain(const DtSwapChain& orig);
43 
45  DtSwapChain& operator=(const DtSwapChain&);
46 
47  public:
50 
52  virtual ~DtSwapChain();
53 
55  virtual bool initalise(unsigned int width, unsigned int height, unsigned int layers, DtSwapChainTextureType type, DtGlImageType format);
56 
58  virtual bool addFormat(DtSwapChainTextureType type, DtGlImageType format);
59 
61  virtual void acquireTextures() = 0;
62 
64  unsigned int getAcquiredIndex(DtSwapChainTextureType type) const;
65 
67  virtual unsigned int getTexture(DtSwapChainTextureType type, int index) const = 0;
68 
70  virtual void releaseTextures() = 0;
71 
73  bool isInitialized() const;
74 
76  unsigned int length() const;
77 
79  DtSwapChainTextureType type(unsigned int index) const;
80 
82  DtGlImageType format(unsigned int index) const;
83 
85  DtGlImageType format(DtSwapChainTextureType type) const;
86 
88  unsigned int width() const;
89 
91  unsigned int height() const;
92 
94  unsigned int layers() const;
95 
97  vrvVirtualReality::DtEye eye() const;
98 
100  GLuint getFbo(unsigned int index) const;
101 
103  virtual void copyTextures(osg::RenderInfo& renderInfo, unsigned int srcColorId, unsigned int srcDepthId, unsigned int srcStencilId, bool copySrcAlpha = false, bool srcIsArray = true, int mode = 0) const;
104 
107  virtual void blitTextureToScreen(int swidth, int sheight, bool showleftEye);
108 
110  virtual void blendSwapChains(osg::RenderInfo& renderInfo, DtSwapChain* base, DtSwapChain* overlay) const;
111 
112  protected:
113 
116  virtual bool initaliseFbos() const;
117 
119  virtual bool initCopyProgram(bool copyDepth, bool copyStencil, bool copySrcAlpha, bool srcIsArray) const;
120 
122  virtual bool initBlendProgram() const;
123 
124  protected:
125 
126  // !\brief have the textue swap chains been initalised
128 
129  // !\brief the eye this swapchain represents
131 
133  mutable unsigned int myLength;
134 
136  std::vector<DtSwapChainTextureType> myTextureTypes;
137 
139  std::vector<DtGlImageType> myFormats;
140 
142  mutable unsigned int myWidth;
143 
145  mutable unsigned int myHeight;
146 
148  mutable unsigned int myLayers;
149 
151  mutable std::map<DtSwapChainTextureType, unsigned int> mySwapChainIndexes;
152 
154  mutable std::vector<GLuint> myFbos;
155 
158 
161 
164 
166  mutable unsigned int myCopyQuadVbo;
167 
169  mutable unsigned int myLastStencilTexId;
170 
172  mutable unsigned int mySrcStencilTexId;
173 
176 
178  };
179 }
osg::ref_ptr< osg::StateSet > myCopyStateSet
state set to encapsulate state changes when doing swapchain fill
Definition: DtSwapChain.h:163
DtGlProgram * myCopyProgram
shader to copy sources texture into swapchain
Definition: DtSwapChain.h:157
Contains DLL export macros.
std::vector< DtGlImageType > myFormats
the format of the texture swap chain
Definition: DtSwapChain.h:139
Definition: DtSwapChain.h:29
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
unsigned int myLastStencilTexId
the current source depth texture id, tracked so we can recreate stencil view if it changes ...
Definition: DtSwapChain.h:169
DtGlProgram * myBlendProgram
shader to blend two swapchains into one (scene and overlay)
Definition: DtSwapChain.h:175
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:65
std::vector< DtSwapChainTextureType > myTextureTypes
the type of the texture swap chain
Definition: DtSwapChain.h:136
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:37
int myLastCopyProgramConfig
the bit mask for the last complied version of the copy program
Definition: DtSwapChain.h:160
Definition: DtFxParticleSystem.h:98
Base implementation of a texture swapchain.
Definition: DtSwapChain.h:35
DtGlImageType
Definition: DtGlImageType.h:15
unsigned int myCopyQuadVbo
vbo for draw command used for swapchain fill
Definition: DtSwapChain.h:166
std::map< DtSwapChainTextureType, unsigned int > mySwapChainIndexes
active swapchain index for each format
Definition: DtSwapChain.h:151
unsigned int myWidth
the pixel width of the texture swap chain
Definition: DtSwapChain.h:142
unsigned int mySrcStencilTexId
the current depth textures stencil view texture id
Definition: DtSwapChain.h:172
Definition: DtSwapChain.h:27
Definition: DtSwapChain.h:28
const char int mode
Definition: ioapi.h:38
unsigned int myLength
the length/number of textures in the swapchain
Definition: DtSwapChain.h:133
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:70
unsigned int myHeight
the pixel height of the texture swap chain
Definition: DtSwapChain.h:145
enum representing an OpenGL image type
unsigned int myLayers
the number of layers in the textures i.e. array layers
Definition: DtSwapChain.h:148
vrvVirtualReality::DtEye myEye
Definition: DtSwapChain.h:130
DtDe & myDe
Definition: DtSwapChain.h:177
DtSwapChainTextureType
Definition: DtSwapChain.h:25
std::vector< GLuint > myFbos
fbo for swapchain copy operations
Definition: DtSwapChain.h:154
bool myIsInitialized
Definition: DtSwapChain.h:127

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)