8#ifndef MULTICHANNELDRAWER_H
9#define MULTICHANNELDRAWER_H
15#include <osg/TextureRectangle>
17#include <util/coExport.h>
25class MultiChannelDrawer;
26struct ViewChannelData;
58 osg::ref_ptr<osg::Uniform>
size;
98 std::vector<std::shared_ptr<ViewChannelData>>
viewChan;
123 void setThis(std::shared_ptr<ViewChannelData> vcd);
133 std::shared_ptr<ViewData>
view;
140 friend struct SingleScreenCB;
161 ReprojectMeshWithHoles
184 void updateMatrices(
int idx,
const osg::Matrix &model,
const osg::Matrix &view,
const osg::Matrix &proj);
186 void resizeView(
int idx,
int w,
int h, GLenum depthFormat=0, GLenum colorFormat=GL_UNSIGNED_BYTE);
190 unsigned char *
rgba(
int idx)
const;
192 unsigned char *
depth(
int idx)
const;
203 void clearViewData();
204 std::vector<std::shared_ptr<ViewData>> m_viewData;
205 std::vector<std::shared_ptr<ChannelData>> m_channelData;
209 int renderTex=0, writeTex=0;
210 struct AvailableEyes {
215 AvailableEyes m_availableEyes;
218 const bool m_useCuda;
219 void updateGeoForView(
ViewData &vd);
Definition: ARToolKit.h:33
ViewEye
Definition: MultiChannelDrawer.h:28
@ Invalid
Definition: MultiChannelDrawer.h:32
@ Right
Definition: MultiChannelDrawer.h:31
@ Middle
Definition: MultiChannelDrawer.h:29
@ Left
Definition: MultiChannelDrawer.h:30
Definition: MultiChannelDrawer.h:36
int depthWidth[NumImages]
Definition: MultiChannelDrawer.h:43
osg::Matrix imgProj
Definition: MultiChannelDrawer.h:45
int height[NumImages]
Definition: MultiChannelDrawer.h:42
osg::ref_ptr< osg::Uniform > pixelOffset
Definition: MultiChannelDrawer.h:59
osg::Matrix imgView
Definition: MultiChannelDrawer.h:45
osg::ref_ptr< osg::TextureRectangle > depthTex
Definition: MultiChannelDrawer.h:50
std::vector< ViewChannelData * > viewChan
Definition: MultiChannelDrawer.h:66
osg::ref_ptr< osg::Geometry > reprojGeo
Definition: MultiChannelDrawer.h:55
int depthHeight[NumImages]
Definition: MultiChannelDrawer.h:43
osg::ref_ptr< osg::Geometry > fixedGeo
Definition: MultiChannelDrawer.h:54
ViewData(int view=-1)
Definition: MultiChannelDrawer.h:68
osg::ref_ptr< osg::Uniform > withNeighbors
Definition: MultiChannelDrawer.h:60
GLenum depthFormat[NumImages]
Definition: MultiChannelDrawer.h:44
int viewNum
Definition: MultiChannelDrawer.h:40
osg::ref_ptr< osg::Program > reprojAdaptProgram
Definition: MultiChannelDrawer.h:63
osg::ref_ptr< osg::Vec2Array > texcoord
Definition: MultiChannelDrawer.h:53
osg::ref_ptr< osg::Program > reprojMeshProgram
Definition: MultiChannelDrawer.h:64
GLenum colorFormat[NumImages]
Definition: MultiChannelDrawer.h:44
osg::ref_ptr< osg::Vec2Array > quadCoord
Definition: MultiChannelDrawer.h:56
osg::ref_ptr< osg::Program > reprojConstProgram
Definition: MultiChannelDrawer.h:62
osg::ref_ptr< osg::Image > colorImg[NumImages]
Definition: MultiChannelDrawer.h:51
osg::ref_ptr< osg::TextureRectangle > colorTex
Definition: MultiChannelDrawer.h:49
int width[NumImages]
Definition: MultiChannelDrawer.h:42
osg::ref_ptr< osg::Vec2Array > pointCoord
Definition: MultiChannelDrawer.h:56
osg::Matrix newModel
Definition: MultiChannelDrawer.h:46
int geoWidth
Definition: MultiChannelDrawer.h:41
osg::ref_ptr< osg::Uniform > withHoles
Definition: MultiChannelDrawer.h:61
osg::ref_ptr< osg::DrawArrays > quadArr
Definition: MultiChannelDrawer.h:57
osg::Matrix imgModel
Definition: MultiChannelDrawer.h:45
osg::ref_ptr< osg::DrawArrays > pointArr
Definition: MultiChannelDrawer.h:57
osg::ref_ptr< osg::Image > depthImg[NumImages]
Definition: MultiChannelDrawer.h:52
static const int NumImages
Definition: MultiChannelDrawer.h:37
int geoHeight
Definition: MultiChannelDrawer.h:41
osg::ref_ptr< osg::Uniform > size
Definition: MultiChannelDrawer.h:58
osg::Matrix newView
Definition: MultiChannelDrawer.h:46
ViewEye eye
Definition: MultiChannelDrawer.h:39
osg::Matrix newProj
Definition: MultiChannelDrawer.h:46
store data associated with one channel (output viewport)
Definition: MultiChannelDrawer.h:85
void addView(std::shared_ptr< ViewData > vd)
ChannelData(MultiChannelDrawer *drawer, int channel)
Definition: MultiChannelDrawer.h:100
std::vector< std::shared_ptr< ViewChannelData > > viewChan
Definition: MultiChannelDrawer.h:98
osg::ref_ptr< osg::Group > scene
Definition: MultiChannelDrawer.h:96
int width
Definition: MultiChannelDrawer.h:90
osg::Matrix curView
Definition: MultiChannelDrawer.h:92
osg::Matrix curModel
Definition: MultiChannelDrawer.h:92
int height
Definition: MultiChannelDrawer.h:91
bool second
Definition: MultiChannelDrawer.h:89
ViewEye eye
Definition: MultiChannelDrawer.h:88
osg::ref_ptr< osg::Camera > camera
Definition: MultiChannelDrawer.h:95
MultiChannelDrawer * drawer
Definition: MultiChannelDrawer.h:86
int channelNum
Definition: MultiChannelDrawer.h:87
osg::Matrix curProj
Definition: MultiChannelDrawer.h:92
void enableView(std::shared_ptr< ViewData > vd, bool enable)
data for rendering a View into a Channel
Definition: MultiChannelDrawer.h:119
std::shared_ptr< ViewData > view
Definition: MultiChannelDrawer.h:133
void setThis(std::shared_ptr< ViewChannelData > vcd)
osg::ref_ptr< osg::Geode > geode
Definition: MultiChannelDrawer.h:129
osg::ref_ptr< osg::Uniform > reprojMat
Definition: MultiChannelDrawer.h:127
ChannelData * chan
Definition: MultiChannelDrawer.h:132
osg::ref_ptr< osg::StateSet > state
Definition: MultiChannelDrawer.h:128
osg::ref_ptr< osg::Geometry > fixedGeo
Definition: MultiChannelDrawer.h:125
osg::ref_ptr< osg::Drawable::DrawCallback > drawCallback
Definition: MultiChannelDrawer.h:130
ViewChannelData(std::shared_ptr< ViewData > view, ChannelData *chan)
osg::ref_ptr< osg::Geometry > reprojGeo
Definition: MultiChannelDrawer.h:126
Definition: MultiChannelDrawer.h:139
ViewSelection viewsToRender() const
whether all available views should be rendered
void clearColor(int idx)
fill color array with all zeros
void resizeView(int idx, int w, int h, GLenum depthFormat=0, GLenum colorFormat=GL_UNSIGNED_BYTE)
resize view idx
opencover::ViewEye ViewEye
Definition: MultiChannelDrawer.h:144
void setNumViews(int nv=-1)
set number of views to render, -1: one view/channel/stereo eye
const osg::Matrix & modelMatrix(int idx) const
to be called each frame, updates current matrices
void updateMatrices(int idx, const osg::Matrix &model, const osg::Matrix &view, const osg::Matrix &proj)
set matrices corresponding to RGBA and depth data for view idx
opencover::ViewData ViewData
Definition: MultiChannelDrawer.h:143
MultiChannelDrawer(bool flipped=false, bool useCuda=false)
Mode
reprojection mode
Definition: MultiChannelDrawer.h:155
@ Reproject
Definition: MultiChannelDrawer.h:157
@ ReprojectAdaptive
Definition: MultiChannelDrawer.h:158
@ ReprojectAdaptiveWithNeighbors
Definition: MultiChannelDrawer.h:159
@ ReprojectMesh
Definition: MultiChannelDrawer.h:160
@ AsIs
Definition: MultiChannelDrawer.h:156
const osg::Matrix & viewMatrix(int idx) const
std::shared_ptr< ViewData > getViewData(int idx)
get a pointer that can be retained
const osg::Matrix & projectionMatrix(int idx) const
void setViewsToRender(ViewSelection views)
return whether all available views should be rendered
unsigned char * rgba(int idx) const
access RGBA data for view idx
void setViewEye(int view, ViewEye eye)
configure for which eye this a view is intended
void swapFrame()
from now on, draw with current RGBA and depth data for all views
unsigned char * depth(int idx) const
access depth data for view idx
ViewSelection
Definition: MultiChannelDrawer.h:166
@ MatchingEye
Definition: MultiChannelDrawer.h:168
@ Same
Definition: MultiChannelDrawer.h:167
@ All
Definition: MultiChannelDrawer.h:169
opencover::ChannelData ChannelData
Definition: MultiChannelDrawer.h:142
void clearDepth(int idx)
fill depth array with all ones