mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-30 15:41:47 +00:00
Create TopBottom3D mode and begin sketching RowInterleaved3D mode.
This commit is contained in:
parent
cfa6b817b5
commit
960d4d6755
8 changed files with 187 additions and 0 deletions
|
@ -1116,6 +1116,7 @@ set( FASTMATH_SOURCES
|
|||
gl/stereo3d/gl_anaglyph.cpp
|
||||
gl/stereo3d/gl_quadstereo.cpp
|
||||
gl/stereo3d/gl_sidebyside3d.cpp
|
||||
gl/stereo3d/gl_interleaved3d.cpp
|
||||
gl/dynlights/gl_dynlight.cpp
|
||||
gl/dynlights/gl_glow.cpp
|
||||
gl/dynlights/gl_dynlight1.cpp
|
||||
|
|
71
src/gl/stereo3d/gl_interleaved3d.cpp
Normal file
71
src/gl/stereo3d/gl_interleaved3d.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
** gl_interleaved3d.cpp
|
||||
** Interleaved image stereoscopic 3D modes for GZDoom
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2016 Christopher Bruns
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
#include "gl_interleaved3d.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
|
||||
namespace s3d {
|
||||
|
||||
/* static */
|
||||
const RowInterleaved3D& RowInterleaved3D::getInstance(float ipd)
|
||||
{
|
||||
static RowInterleaved3D instance(ipd);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void RowInterleaved3D::Present() const
|
||||
{
|
||||
GLRenderer->mBuffers->BindOutputFB();
|
||||
GLRenderer->ClearBorders();
|
||||
|
||||
// Compute screen regions to use for left and right eye views
|
||||
int topHeight = GLRenderer->mOutputLetterbox.height / 2;
|
||||
int bottomHeight = GLRenderer->mOutputLetterbox.height - topHeight;
|
||||
GL_IRECT topHalfScreen = GLRenderer->mOutputLetterbox;
|
||||
topHalfScreen.height = topHeight;
|
||||
GL_IRECT bottomHalfScreen = GLRenderer->mOutputLetterbox;
|
||||
bottomHalfScreen.height = bottomHeight;
|
||||
bottomHalfScreen.top += topHeight;
|
||||
|
||||
GLRenderer->mBuffers->BindEyeTexture(0, 0);
|
||||
GLRenderer->DrawPresentTexture(topHalfScreen, true);
|
||||
|
||||
GLRenderer->mBuffers->BindEyeTexture(1, 0);
|
||||
GLRenderer->DrawPresentTexture(bottomHalfScreen, true);
|
||||
}
|
||||
|
||||
|
||||
} /* namespace s3d */
|
58
src/gl/stereo3d/gl_interleaved3d.h
Normal file
58
src/gl/stereo3d/gl_interleaved3d.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
** gl_interleaved3d.h
|
||||
** Interleaved stereoscopic 3D modes for GZDoom
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2016 Christopher Bruns
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef GL_INTERLEAVED3D_H_
|
||||
#define GL_INTERLEAVED3D_H_
|
||||
|
||||
#include "gl_stereo3d.h"
|
||||
#include "gl_stereo_leftright.h"
|
||||
#include "gl_sidebyside3d.h"
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
||||
namespace s3d {
|
||||
|
||||
class RowInterleaved3D : public TopBottom3D
|
||||
{
|
||||
public:
|
||||
static const RowInterleaved3D& getInstance(float ipd);
|
||||
RowInterleaved3D(double ipdMeters) : TopBottom3D(ipdMeters) {}
|
||||
void Present() const override;
|
||||
};
|
||||
|
||||
} /* namespace s3d */
|
||||
|
||||
|
||||
#endif /* GL_INTERLEAVED3D_H_ */
|
|
@ -108,4 +108,42 @@ void SideBySideFull::AdjustPlayerSprites() const /* override */
|
|||
gl_RenderState.ApplyMatrices();
|
||||
}
|
||||
|
||||
/* static */
|
||||
const TopBottom3D& TopBottom3D::getInstance(float ipd)
|
||||
{
|
||||
static TopBottom3D instance(ipd);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void TopBottom3D::Present() const
|
||||
{
|
||||
GLRenderer->mBuffers->BindOutputFB();
|
||||
GLRenderer->ClearBorders();
|
||||
|
||||
// Compute screen regions to use for left and right eye views
|
||||
int topHeight = GLRenderer->mOutputLetterbox.height / 2;
|
||||
int bottomHeight = GLRenderer->mOutputLetterbox.height - topHeight;
|
||||
GL_IRECT topHalfScreen = GLRenderer->mOutputLetterbox;
|
||||
topHalfScreen.height = topHeight;
|
||||
GL_IRECT bottomHalfScreen = GLRenderer->mOutputLetterbox;
|
||||
bottomHalfScreen.height = bottomHeight;
|
||||
bottomHalfScreen.top += topHeight;
|
||||
|
||||
GLRenderer->mBuffers->BindEyeTexture(0, 0);
|
||||
GLRenderer->DrawPresentTexture(topHalfScreen, true);
|
||||
|
||||
GLRenderer->mBuffers->BindEyeTexture(1, 0);
|
||||
GLRenderer->DrawPresentTexture(bottomHalfScreen, true);
|
||||
}
|
||||
|
||||
// AdjustViewports() is called from within FLGRenderer::SetOutputViewport(...)
|
||||
void TopBottom3D::AdjustViewports() const
|
||||
{
|
||||
// Change size of renderbuffer, and align to screen
|
||||
GLRenderer->mSceneViewport.height /= 2;
|
||||
GLRenderer->mSceneViewport.top /= 2;
|
||||
GLRenderer->mScreenViewport.height /= 2;
|
||||
GLRenderer->mScreenViewport.top /= 2;
|
||||
}
|
||||
|
||||
} /* namespace s3d */
|
||||
|
|
|
@ -88,6 +88,14 @@ private:
|
|||
SBSFRightEyePose rightEye;
|
||||
};
|
||||
|
||||
class TopBottom3D : public SideBySideSquished
|
||||
{
|
||||
public:
|
||||
static const TopBottom3D& getInstance(float ipd);
|
||||
TopBottom3D(double ipdMeters) : SideBySideSquished(ipdMeters) {}
|
||||
void Present() const override;
|
||||
virtual void AdjustViewports() const override;
|
||||
};
|
||||
|
||||
} /* namespace s3d */
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "gl/stereo3d/gl_anaglyph.h"
|
||||
#include "gl/stereo3d/gl_quadstereo.h"
|
||||
#include "gl/stereo3d/gl_sidebyside3d.h"
|
||||
#include "gl/stereo3d/gl_interleaved3d.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
||||
// Set up 3D-specific console variables:
|
||||
|
@ -100,6 +101,12 @@ const Stereo3DMode& Stereo3DMode::getCurrentMode()
|
|||
setCurrentMode(AmberBlue::getInstance(vr_ipd));
|
||||
break;
|
||||
// TODO: 10: HTC Vive/OpenVR
|
||||
case 11:
|
||||
setCurrentMode(TopBottom3D::getInstance(vr_ipd));
|
||||
break;
|
||||
case 12:
|
||||
setCurrentMode(RowInterleaved3D::getInstance(vr_ipd));
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
setCurrentMode(MonoView::getInstance());
|
||||
|
|
|
@ -2703,6 +2703,8 @@ OPTVAL_LEFTEYE = "Left Eye";
|
|||
OPTVAL_RIGHTEYE = "Right Eye";
|
||||
OPTVAL_SBSFULL = "Side-by-side Full";
|
||||
OPTVAL_SBSNARROW = "Side-by-side Narrow";
|
||||
OPTVAL_TOPBOTTOM = "Top/Bottom";
|
||||
OPTVAL_ROWINTERLEAVED = "Row Interleaved";
|
||||
OPTVAL_QUADBUFFERED = "Quad-buffered";
|
||||
OPTVAL_UNCHARTED2 = "Uncharted 2";
|
||||
OPTVAL_HEJLDAWSON = "Hejl Dawson";
|
||||
|
|
|
@ -169,6 +169,8 @@ OptionValue VRMode
|
|||
9, "$OPTVAL_AMBERBLUE"
|
||||
3, "$OPTVAL_SBSFULL"
|
||||
4, "$OPTVAL_SBSNARROW"
|
||||
11, "$OPTVAL_TOPBOTTOM"
|
||||
12, "$OPTVAL_ROWINTERLEAVED"
|
||||
5, "$OPTVAL_LEFTEYE"
|
||||
6, "$OPTVAL_RIGHTEYE"
|
||||
7, "$OPTVAL_QUADBUFFERED"
|
||||
|
|
Loading…
Reference in a new issue