StateControl.hh 3.63 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<State>
19 20 21 22 23
{
    // ========================================================================================================= \/
    // ============================================================================================ CONSTRUCTORS \/
    // ========================================================================================================= \/
public:
24
    StateControl(
25 26
        const ConstSharedVertexBufferObject& _vertexBufferObject,
        const ConstSharedFrameBufferObject& _frameBufferObject,
27
        const ConstSharedShaderProgramObject& _shaderProgramObject,
28 29 30
        const ConstSharedViewport& _viewport)
    :   mpVertexBufferObject(_vertexBufferObject),
        mpFrameBufferObject(_frameBufferObject),
31
        mpShaderProgramObject(_shaderProgramObject),
32
        mpViewport(_viewport)
33 34 35 36
    {}
    virtual ~StateControl(void) {}

    // ==================================================================================================== \/
37
    // ============================================================================================ GETTERS \/
38 39
    // ==================================================================================================== \/
public:
40 41 42 43
    inline StateControl& vertexBufferObject  (const ConstSharedVertexBufferObject&  _vertexBufferObject)  { mpVertexBufferObject  = _vertexBufferObject;  return *this; }
    inline StateControl& frameBufferObject   (const ConstSharedFrameBufferObject&   _frameBufferObject)   { mpFrameBufferObject   = _frameBufferObject;   return *this; }
    inline StateControl& shaderProgramObject (const ConstSharedShaderProgramObject& _shaderProgramObject) { mpShaderProgramObject = _shaderProgramObject; return *this; }
    inline StateControl& viewport            (const ConstSharedViewport&            _viewport)            { mpViewport            = _viewport;            return *this; }
44 45 46 47 48 49 50

    // ===================================================================================================== \/
    // ============================================================================================ OVERRIDE \/
    // ===================================================================================================== \/
public:
    virtual SharedState create(void)
    {
51
        SharedState state(new State(mpVertexBufferObject, mpFrameBufferObject, mpShaderProgramObject, mpViewport));
52
        
53 54 55 56 57 58 59
        return state;
    }

    // =================================================================================================== \/
    // ============================================================================================ FIELDS \/
    // =================================================================================================== \/
protected:
60 61 62 63
    ConstSharedVertexBufferObject  mpVertexBufferObject;
    ConstSharedFrameBufferObject   mpFrameBufferObject;
    ConstSharedShaderProgramObject mpShaderProgramObject;
    ConstSharedViewport            mpViewport;
64 65 66 67 68 69
};

} // OpenGL
} // ACGL

#endif // ACGL_OPENGL_CONTROLLER_TEXTURECONTROL_HH