mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-16 15:21:02 +00:00
8b6e09ca09
This was done to clean up the license and to ensure that any commercial fork of the engine has to obey the far stricter requirements concerning source distribution. The old license was compatible with GPLv2 whereas combining GPLv2 and LGPLv3 force a license upgrade to GPLv3. The license of code that originates from ZDoomGL has not been changed.
85 lines
2.4 KiB
C++
85 lines
2.4 KiB
C++
//
|
|
//---------------------------------------------------------------------------
|
|
//
|
|
// Copyright(C) 2015 Christopher Bruns
|
|
// All rights reserved.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
//
|
|
//--------------------------------------------------------------------------
|
|
//
|
|
/*
|
|
** gl_anaglyph.cpp
|
|
** Color mask based stereoscopic 3D modes for GZDoom
|
|
**
|
|
*/
|
|
|
|
#include "gl_anaglyph.h"
|
|
#include "gl/renderer/gl_renderer.h"
|
|
#include "gl/renderer/gl_renderbuffers.h"
|
|
|
|
namespace s3d {
|
|
|
|
MaskAnaglyph::MaskAnaglyph(const ColorMask& leftColorMask, double ipdMeters)
|
|
: leftEye(leftColorMask, ipdMeters), rightEye(leftColorMask.inverse(), ipdMeters)
|
|
{
|
|
eye_ptrs.Push(&leftEye);
|
|
eye_ptrs.Push(&rightEye);
|
|
}
|
|
|
|
void MaskAnaglyph::Present() const
|
|
{
|
|
GLRenderer->mBuffers->BindOutputFB();
|
|
GLRenderer->ClearBorders();
|
|
|
|
gl_RenderState.SetColorMask(leftEye.GetColorMask().r, leftEye.GetColorMask().g, leftEye.GetColorMask().b, true);
|
|
gl_RenderState.ApplyColorMask();
|
|
GLRenderer->mBuffers->BindEyeTexture(0, 0);
|
|
GLRenderer->DrawPresentTexture(GLRenderer->mOutputLetterbox, true);
|
|
|
|
gl_RenderState.SetColorMask(rightEye.GetColorMask().r, rightEye.GetColorMask().g, rightEye.GetColorMask().b, true);
|
|
gl_RenderState.ApplyColorMask();
|
|
GLRenderer->mBuffers->BindEyeTexture(1, 0);
|
|
GLRenderer->DrawPresentTexture(GLRenderer->mOutputLetterbox, true);
|
|
|
|
gl_RenderState.ResetColorMask();
|
|
gl_RenderState.ApplyColorMask();
|
|
}
|
|
|
|
|
|
/* static */
|
|
const GreenMagenta& GreenMagenta::getInstance(float ipd)
|
|
{
|
|
static GreenMagenta instance(ipd);
|
|
return instance;
|
|
}
|
|
|
|
|
|
/* static */
|
|
const RedCyan& RedCyan::getInstance(float ipd)
|
|
{
|
|
static RedCyan instance(ipd);
|
|
return instance;
|
|
}
|
|
|
|
|
|
/* static */
|
|
const AmberBlue& AmberBlue::getInstance(float ipd)
|
|
{
|
|
static AmberBlue instance(ipd);
|
|
return instance;
|
|
}
|
|
|
|
|
|
} /* namespace s3d */
|