GteGL4DepthStencilState.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
9 #include <LowLevel/GteLogger.h>
11 using namespace gte;
12 
14  :
15  GL4DrawingState(depthStencilState)
16 {
17  mDepthEnable = (depthStencilState->depthEnable ? GL_TRUE : GL_FALSE);
18  mWriteMask = msWriteMask[depthStencilState->writeMask];
19  mComparison = msComparison[depthStencilState->comparison];
20  mStencilEnable = (depthStencilState->stencilEnable ? GL_TRUE : GL_FALSE);
21  mStencilReadMask = depthStencilState->stencilReadMask;
22  mStencilWriteMask = depthStencilState->stencilWriteMask;
23  DepthStencilState::Face front = depthStencilState->frontFace;
28  DepthStencilState::Face back = depthStencilState->backFace;
33  mReference = depthStencilState->reference;
34 }
35 
36 std::shared_ptr<GEObject> GL4DepthStencilState::Create(void*, GraphicsObject const* object)
37 {
38  if (object->GetType() == GT_DEPTH_STENCIL_STATE)
39  {
40  return std::make_shared<GL4DepthStencilState>(
41  static_cast<DepthStencilState const*>(object));
42  }
43 
44  LogError("Invalid object type.");
45  return nullptr;
46 }
47 
49 {
50  if (mDepthEnable)
51  {
54  }
55  else
56  {
58  }
59 
61 
62  if (mStencilEnable)
63  {
65 
72  }
73  else
74  {
76  }
77 }
78 
79 
81 {
82  GL_FALSE,
83  GL_TRUE
84 };
85 
87 {
88  GL_NEVER,
89  GL_LESS,
90  GL_EQUAL,
91  GL_LEQUAL,
92  GL_GREATER,
94  GL_GEQUAL,
95  GL_ALWAYS
96 };
97 
99 {
100  GL_KEEP,
101  GL_ZERO,
102  GL_REPLACE,
103  GL_INCR, // TODO: DX11 has INCR_SAT that clamps the result
104  GL_DECR, // TODO: DX11 has INCR_SAT that clamps the result
105  GL_INVERT,
106  GL_INCR,
107  GL_DECR
108 };
void APIENTRY glDepthMask(GLboolean flag)
Definition: GteOpenGL.cpp:396
#define GL_GEQUAL
Definition: glcorearb.h:215
#define GL_ZERO
Definition: glcorearb.h:217
GL4DepthStencilState(DepthStencilState const *depthStencilState)
#define GL_FALSE
Definition: glcorearb.h:199
static GLenum const msOperation[]
unsigned char GLboolean
Definition: glcorearb.h:90
GraphicsObjectType GetType() const
#define GL_STENCIL_TEST
Definition: glcorearb.h:262
#define GL_NEVER
Definition: glcorearb.h:209
static GLboolean const msWriteMask[]
#define GL_REPLACE
Definition: glcorearb.h:365
static GLenum const msComparison[]
static std::shared_ptr< GEObject > Create(void *unused, GraphicsObject const *object)
unsigned int GLenum
Definition: glcorearb.h:83
#define GL_BACK
Definition: glcorearb.h:234
#define LogError(message)
Definition: GteLogger.h:92
#define GL_FRONT
Definition: glcorearb.h:233
void APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
Definition: GteOpenGL.cpp:1847
void APIENTRY glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
Definition: GteOpenGL.cpp:1834
#define GL_NOTEQUAL
Definition: glcorearb.h:214
#define GL_EQUAL
Definition: glcorearb.h:211
#define GL_GREATER
Definition: glcorearb.h:213
#define GL_ALWAYS
Definition: glcorearb.h:216
#define GL_DEPTH_TEST
Definition: glcorearb.h:258
#define GL_DECR
Definition: glcorearb.h:367
#define GL_INVERT
Definition: glcorearb.h:343
void APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
Definition: GteOpenGL.cpp:1860
#define GL_INCR
Definition: glcorearb.h:366
#define GL_TRUE
Definition: glcorearb.h:200
void APIENTRY glDisable(GLenum cap)
Definition: GteOpenGL.cpp:409
#define GL_KEEP
Definition: glcorearb.h:364
#define GL_LEQUAL
Definition: glcorearb.h:212
GLuint object
Definition: glext.h:6426
#define GL_LESS
Definition: glcorearb.h:210
void APIENTRY glDepthFunc(GLenum func)
Definition: GteOpenGL.cpp:513
GT_DEPTH_STENCIL_STATE
void APIENTRY glEnable(GLenum cap)
Definition: GteOpenGL.cpp:422


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00