mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Made the ScopedViewShifter fully inline
This commit is contained in:
parent
5a20de829b
commit
f33ddd8cce
5 changed files with 58 additions and 64 deletions
|
@ -1040,7 +1040,6 @@ set (PCH_SOURCES
|
|||
gl/stereo3d/gl_stereo3d.cpp
|
||||
gl/stereo3d/gl_stereo_cvars.cpp
|
||||
gl/stereo3d/gl_stereo_leftright.cpp
|
||||
gl/stereo3d/scoped_view_shifter.cpp
|
||||
gl/stereo3d/gl_anaglyph.cpp
|
||||
gl/stereo3d/gl_quadstereo.cpp
|
||||
gl/stereo3d/gl_sidebyside3d.cpp
|
||||
|
|
|
@ -670,7 +670,7 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, IntRect * bounds, fl
|
|||
SetViewAngle(r_viewpoint.Angles.Yaw);
|
||||
// Stereo mode specific viewpoint adjustment - temporarily shifts global ViewPos
|
||||
eye->GetViewShift(GLRenderer->mAngles.Yaw.Degrees, viewShift);
|
||||
s3d::ScopedViewShifter viewShifter(viewShift);
|
||||
ScopedViewShifter viewShifter(r_viewpoint.Pos, viewShift);
|
||||
SetViewMatrix(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, false, false);
|
||||
gl_RenderState.ApplyMatrices();
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** scoped_view_shifter.cpp
|
||||
** Stack-scoped class for temporarily changing camera viewpoint
|
||||
** Used for stereoscopic 3D.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "scoped_view_shifter.h"
|
||||
#include "r_utility.h"
|
||||
|
||||
namespace s3d {
|
||||
|
||||
ScopedViewShifter::ScopedViewShifter(float dxyz[3]) // in meters
|
||||
{
|
||||
// save original values
|
||||
cachedView = r_viewpoint.Pos;
|
||||
// modify values
|
||||
r_viewpoint.Pos += DVector3(dxyz[0], dxyz[1], dxyz[2]);
|
||||
}
|
||||
|
||||
ScopedViewShifter::~ScopedViewShifter()
|
||||
{
|
||||
// restore original values
|
||||
r_viewpoint.Pos = cachedView;
|
||||
}
|
||||
|
||||
}
|
|
@ -32,21 +32,31 @@
|
|||
#include "basictypes.h"
|
||||
#include "vectors.h"
|
||||
|
||||
namespace s3d {
|
||||
/**
|
||||
* Temporarily shift
|
||||
*/
|
||||
class ScopedViewShifter
|
||||
{
|
||||
public:
|
||||
ScopedViewShifter(DVector3 &var, float dxyz[3]) // in meters
|
||||
{
|
||||
// save original values
|
||||
mVar = &var;
|
||||
cachedView = var;
|
||||
// modify values
|
||||
var += DVector3(dxyz[0], dxyz[1], dxyz[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily shift
|
||||
*/
|
||||
class ScopedViewShifter
|
||||
{
|
||||
public:
|
||||
ScopedViewShifter(float dxyz[3]); // in meters
|
||||
~ScopedViewShifter();
|
||||
~ScopedViewShifter()
|
||||
{
|
||||
// restore original values
|
||||
*mVar = cachedView;
|
||||
}
|
||||
|
||||
private:
|
||||
DVector3 cachedView;
|
||||
};
|
||||
private:
|
||||
DVector3 *mVar;
|
||||
DVector3 cachedView;
|
||||
};
|
||||
|
||||
} /* namespace s3d */
|
||||
|
||||
#endif // GL_STEREO3D_SCOPED_VIEW_SHIFTER_H_
|
||||
|
|
33
src/hwrenderer/data/renderqueue.h
Normal file
33
src/hwrenderer/data/renderqueue.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "tflags.h"
|
||||
|
||||
// A render queue is what contains all render commands.
|
||||
// On Vulkan there can be several of them so this interface is needed to allow for the needed parallelism.
|
||||
// On OpenGL the render state is global so all this will do is to translate the system independent calls into OpenGL API calls.
|
||||
|
||||
enum class ColormaskBits
|
||||
{
|
||||
RED = 1,
|
||||
GREEN = 2,
|
||||
BLUE = 4,
|
||||
ALPHA = 8
|
||||
};
|
||||
|
||||
typedef TFlags<ColormaskBits, uint8_t> Colormask;
|
||||
|
||||
class IRenderQueue
|
||||
{
|
||||
Colormask mColorMask;
|
||||
|
||||
|
||||
Colormask GetColorMask() const
|
||||
{
|
||||
return mColorMask;
|
||||
}
|
||||
|
||||
void SetColorMask(Colormask mask) = 0;
|
||||
|
||||
|
||||
};
|
Loading…
Reference in a new issue