StateControl.hh 3.15 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 24 25 26
{
    // ========================================================================================================= \/
    // ============================================================================================ CONSTRUCTORS \/
    // ========================================================================================================= \/
public:
    StateControl(void)
    :   mpVertexBuffer(NULL),
        mpFrameBuffer(NULL),
27 28
        mpShaderProgram(NULL),
        mpViewport(NULL)
29 30 31 32
    {}
    virtual ~StateControl(void) {}

    // ==================================================================================================== \/
33
    // ============================================================================================ GETTERS \/
34 35
    // ==================================================================================================== \/
public:
36 37 38 39
    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; }
40 41 42 43 44 45 46

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

    // =================================================================================================== \/
    // ============================================================================================ FIELDS \/
    // =================================================================================================== \/
protected:
    ConstSharedVertexBuffer  mpVertexBuffer;
    ConstSharedFrameBuffer   mpFrameBuffer;
    ConstSharedShaderProgram mpShaderProgram;
59
    ConstSharedViewport      mpViewport;
60 61 62 63 64 65
};

} // OpenGL
} // ACGL

#endif // ACGL_OPENGL_CONTROLLER_TEXTURECONTROL_HH