GteGL4RasterizerState.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(rasterizerState)
16 {
17  mFillMode = msFillMode[rasterizerState->fillMode];
18  mCullFace = msCullFace[rasterizerState->cullMode];
19  mFrontFace = (rasterizerState->frontCCW ? GL_CCW : GL_CW);
20  mDepthScale = rasterizerState->slopeScaledDepthBias;
21  mDepthBias = static_cast<float>(rasterizerState->depthBias);
22  mEnableScissor = (rasterizerState->enableScissor ? GL_TRUE : GL_FALSE);
23 }
24 
25 std::shared_ptr<GEObject> GL4RasterizerState::Create(void*, GraphicsObject const* object)
26 {
27  if (object->GetType() == GT_RASTERIZER_STATE)
28  {
29  return std::make_shared<GL4RasterizerState>(
30  static_cast<RasterizerState const*>(object));
31  }
32 
33  LogError("Invalid object type.");
34  return nullptr;
35 }
36 
38 {
40 
41  if (mCullFace != 0)
42  {
46  }
47  else
48  {
50  }
51 
52  if (mDepthScale != 0.0f && mDepthBias != 0.0f)
53  {
58  }
59  else
60  {
64  }
65 }
66 
67 
69 {
70  GL_FILL,
71  GL_LINE
72 };
73 
75 {
76  0,
77  GL_FRONT,
78  GL_BACK
79 };
#define GL_FALSE
Definition: glcorearb.h:199
#define GL_POLYGON_OFFSET_POINT
Definition: glcorearb.h:306
#define GL_LINE
Definition: glcorearb.h:362
GL4RasterizerState(RasterizerState const *rasterizerState)
GraphicsObjectType GetType() const
GT_RASTERIZER_STATE
#define GL_CCW
Definition: glcorearb.h:244
#define GL_POLYGON_OFFSET_FILL
Definition: glcorearb.h:308
#define GL_CULL_FACE
Definition: glcorearb.h:254
static GLenum const msCullFace[]
#define GL_FRONT_AND_BACK
Definition: glcorearb.h:237
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 glCullFace(GLenum mode)
Definition: GteOpenGL.cpp:136
static GLenum const msFillMode[]
#define GL_CW
Definition: glcorearb.h:243
void APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
Definition: GteOpenGL.cpp:876
GLfloat f
Definition: glcorearb.h:1921
#define GL_FILL
Definition: glcorearb.h:363
#define GL_TRUE
Definition: glcorearb.h:200
void APIENTRY glDisable(GLenum cap)
Definition: GteOpenGL.cpp:409
GLuint object
Definition: glext.h:6426
void APIENTRY glFrontFace(GLenum mode)
Definition: GteOpenGL.cpp:149
static std::shared_ptr< GEObject > Create(void *unused, GraphicsObject const *object)
void APIENTRY glPolygonMode(GLenum face, GLenum mode)
Definition: GteOpenGL.cpp:201
#define GL_POLYGON_OFFSET_LINE
Definition: glcorearb.h:307
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