StateControl.hh 3.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University         //
// All rights reserved.                                                       //
////////////////////////////////////////////////////////////////////////////////

#ifndef ACGL_OPENGL_CONTROLLER_STATECONTROL_HH
#define ACGL_OPENGL_CONTROLLER_STATECONTROL_HH

#include <ACGL/ACGL.hh>

#include <ACGL/Resource/BasicCreateController.hh>
#include <ACGL/OpenGL/Objects/State.hh>
#include <ACGL/OpenGL/GL.hh>

namespace ACGL{
namespace OpenGL{

18
class StateControl : public Resource::BasicCreateController<Texture>
19
20
21
22
23
{
    // ========================================================================================================= \/
    // ============================================================================================ CONSTRUCTORS \/
    // ========================================================================================================= \/
public:
24
25
26
27
28
29
30
31
32
    StateControl(
        const ConstSharedVertexBuffer& _vertexBuffer,
        const ConstSharedVertexBuffer& _frameBuffer,
        const ConstSharedVertexBuffer& _shaderProgram,
        const ConstSharedVertexBuffer& _viewport)
    :   mpVertexBuffer(_vertexBuffer),
        mpFrameBuffer(_frameBuffer),
        mpShaderProgram(_shaderProgram),
        mpViewport(_viewport)
33
34
35
36
    {}
    virtual ~StateControl(void) {}

    // ==================================================================================================== \/
37
    // ============================================================================================ GETTERS \/
38
39
    // ==================================================================================================== \/
public:
40
41
42
43
    inline StateControl& vertexBuffer  (const ConstSharedVertexBuffer&  _vertexBuffer)  { mpVertexBuffer  = _vertexBuffer;  return *this; }
    inline StateControl& frameBuffer   (const ConstSharedFrameBuffer&   _frameBuffer)   { mpFrameBuffer   = _frameBuffer;   return *this; }
    inline StateControl& shaderProgram (const ConstSharedShaderProgram& _shaderProgram) { mpShaderProgram = _shaderProgram; return *this; }
    inline StateControl& viewport      (const ConstSharedShaderProgram& _viewport)      { mpViewport      = _viewport;      return *this; }
44
45
46
47
48
49
50

    // ===================================================================================================== \/
    // ============================================================================================ OVERRIDE \/
    // ===================================================================================================== \/
public:
    virtual SharedState create(void)
    {
51
52
        SharedState state(new State(mpVertexBuffer, mpFrameBuffer, mpShaderProgram, mpViewport));
        
53
54
55
56
57
58
59
60
61
62
        return state;
    }

    // =================================================================================================== \/
    // ============================================================================================ FIELDS \/
    // =================================================================================================== \/
protected:
    ConstSharedVertexBuffer  mpVertexBuffer;
    ConstSharedFrameBuffer   mpFrameBuffer;
    ConstSharedShaderProgram mpShaderProgram;
63
    ConstSharedViewport      mpViewport;
64
65
66
67
68
69
};

} // OpenGL
} // ACGL

#endif // ACGL_OPENGL_CONTROLLER_TEXTURECONTROL_HH