2011-08-28 15:17:58 +02:00
|
|
|
/*
|
2017-01-13 11:47:07 +01:00
|
|
|
* Copyright (c) 2010-2017 OTClient <https://github.com/edubart/otclient>
|
2011-08-28 15:17:58 +02:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2010-11-23 16:30:43 +01:00
|
|
|
#ifndef FRAMEBUFFER_H
|
|
|
|
#define FRAMEBUFFER_H
|
|
|
|
|
2011-08-15 16:06:15 +02:00
|
|
|
#include "declarations.h"
|
2012-01-30 01:00:12 +01:00
|
|
|
#include "texture.h"
|
2011-08-12 03:38:54 +02:00
|
|
|
|
2012-07-29 05:34:40 +02:00
|
|
|
class FrameBuffer : public stdext::shared_object
|
2010-11-23 16:30:43 +01:00
|
|
|
{
|
2012-06-18 10:13:52 +02:00
|
|
|
protected:
|
2012-01-30 01:00:12 +01:00
|
|
|
FrameBuffer();
|
2012-06-18 10:13:52 +02:00
|
|
|
|
|
|
|
friend class FrameBufferManager;
|
|
|
|
|
|
|
|
public:
|
2010-11-23 16:30:43 +01:00
|
|
|
virtual ~FrameBuffer();
|
2012-01-24 19:39:16 +01:00
|
|
|
|
2011-12-25 00:14:12 +01:00
|
|
|
void resize(const Size& size);
|
2012-04-04 22:18:24 +02:00
|
|
|
void bind();
|
2011-12-07 01:31:55 +01:00
|
|
|
void release();
|
2012-06-01 21:39:09 +02:00
|
|
|
void draw();
|
2011-12-07 01:31:55 +01:00
|
|
|
void draw(const Rect& dest);
|
2012-01-30 01:00:12 +01:00
|
|
|
void draw(const Rect& dest, const Rect& src);
|
2011-08-15 16:06:15 +02:00
|
|
|
|
2012-06-08 18:58:08 +02:00
|
|
|
void setBackuping(bool enabled) { m_backuping = enabled; }
|
2012-06-22 07:26:22 +02:00
|
|
|
void setSmooth(bool enabled) { m_smooth = enabled; }
|
2012-06-08 18:58:08 +02:00
|
|
|
|
2011-08-15 16:06:15 +02:00
|
|
|
TexturePtr getTexture() { return m_texture; }
|
2012-03-21 13:41:43 +01:00
|
|
|
Size getSize();
|
2012-06-08 18:58:08 +02:00
|
|
|
bool isBackuping() { return m_backuping; }
|
2012-06-22 07:26:22 +02:00
|
|
|
bool isSmooth() { return m_smooth; }
|
2010-11-23 22:56:28 +01:00
|
|
|
|
2010-11-23 16:30:43 +01:00
|
|
|
private:
|
2012-03-20 23:26:07 +01:00
|
|
|
void internalCreate();
|
2011-12-25 00:14:12 +01:00
|
|
|
void internalBind();
|
|
|
|
void internalRelease();
|
|
|
|
|
2011-08-15 16:06:15 +02:00
|
|
|
TexturePtr m_texture;
|
2011-11-25 23:29:45 +01:00
|
|
|
TexturePtr m_screenBackup;
|
2011-12-25 00:14:12 +01:00
|
|
|
Size m_oldViewportSize;
|
2011-04-06 22:18:00 +02:00
|
|
|
uint m_fbo;
|
2011-12-25 00:14:12 +01:00
|
|
|
uint m_prevBoundFbo;
|
2012-07-31 02:47:21 +02:00
|
|
|
stdext::boolean<true> m_backuping;
|
|
|
|
stdext::boolean<true> m_smooth;
|
2011-12-25 00:14:12 +01:00
|
|
|
|
|
|
|
static uint boundFbo;
|
2010-11-23 16:30:43 +01:00
|
|
|
};
|
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
#endif
|