mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Added ClippingMask class, for clipping with scissor test, clip planes and stencil test.
Fixed some minor problems. --HG-- branch : dev
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class ArcDrawable : public PrimitiveDrawable {
|
||||
class EE_API ArcDrawable : public PrimitiveDrawable {
|
||||
public:
|
||||
ArcDrawable();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class CircleDrawable : public ArcDrawable {
|
||||
class EE_API CircleDrawable : public ArcDrawable {
|
||||
public:
|
||||
CircleDrawable();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace EE { namespace Graphics {
|
||||
|
||||
class VertexBuffer;
|
||||
|
||||
class PrimitiveDrawable : public Drawable {
|
||||
class EE_API PrimitiveDrawable : public Drawable {
|
||||
public:
|
||||
PrimitiveDrawable( EE_DRAWABLE_TYPE drawableType );
|
||||
|
||||
@@ -36,7 +36,6 @@ class PrimitiveDrawable : public Drawable {
|
||||
EE_FILL_MODE mFillMode;
|
||||
EE_BLEND_MODE mBlendMode;
|
||||
Float mLineWidth;
|
||||
Vector2f mPosition;
|
||||
bool mNeedsUpdate;
|
||||
bool mRecreateVertexBuffer;
|
||||
VertexBuffer * mVertexBuffer;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class RectangleDrawable : public PrimitiveDrawable {
|
||||
class EE_API RectangleDrawable : public PrimitiveDrawable {
|
||||
public:
|
||||
RectangleDrawable();
|
||||
|
||||
|
||||
65
include/eepp/graphics/renderer/clippingmask.hpp
Normal file
65
include/eepp/graphics/renderer/clippingmask.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef EE_GRAPHICS_CLIPPINGMASK_HPP
|
||||
#define EE_GRAPHICS_CLIPPINGMASK_HPP
|
||||
|
||||
#include <eepp/core.hpp>
|
||||
#include <eepp/graphics/drawable.hpp>
|
||||
#include <eepp/math/rect.hpp>
|
||||
#include <list>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class EE_API ClippingMask {
|
||||
public:
|
||||
enum Mode {
|
||||
Inclusive,
|
||||
Exclusive
|
||||
};
|
||||
|
||||
/** Set the current Clipping area ( default the entire window, SCISSOR TEST ). */
|
||||
void clipEnable( const Int32& x, const Int32& y, const Uint32& Width, const Uint32& Height );
|
||||
|
||||
/** Disable the Clipping area */
|
||||
void clipDisable();
|
||||
|
||||
/** Clip the area with a plane. */
|
||||
void clipPlaneEnable( const Int32& x, const Int32& y, const Int32& Width, const Int32& Height );
|
||||
|
||||
/** Disable the clip plane area. */
|
||||
void clipPlaneDisable();
|
||||
|
||||
std::size_t getMaskCount() const;
|
||||
|
||||
const Drawable*& operator [](std::size_t index);
|
||||
|
||||
const Drawable* const& operator [](std::size_t index) const;
|
||||
|
||||
void clearMasks();
|
||||
|
||||
void appendMask(const Drawable& drawable);
|
||||
|
||||
void removeMask(const Drawable& drawable);
|
||||
|
||||
Mode getMaskMode() const;
|
||||
|
||||
void setMaskMode(Mode theMode);
|
||||
|
||||
void stencilMaskEnable();
|
||||
|
||||
void stencilMaskDisable( bool clearMasks = false );
|
||||
protected:
|
||||
std::list<Rectf> mScissorsClipped;
|
||||
bool mPushScissorClip;
|
||||
|
||||
std::vector<const Drawable*> mDrawables;
|
||||
Mode mMode;
|
||||
|
||||
void drawMask();
|
||||
private:
|
||||
friend class Renderer;
|
||||
|
||||
ClippingMask();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <eepp/graphics/renderer/base.hpp>
|
||||
#include <eepp/graphics/shaderprogram.hpp>
|
||||
#include <eepp/graphics/renderer/rendererhelper.hpp>
|
||||
#include <eepp/graphics/renderer/clippingmask.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
@@ -210,6 +211,8 @@ class EE_API Renderer {
|
||||
const bool& quadsSupported() const;
|
||||
|
||||
const int& quadVertexs() const;
|
||||
|
||||
ClippingMask * getClippingMask() const;
|
||||
protected:
|
||||
static Renderer * sSingleton;
|
||||
|
||||
@@ -228,6 +231,7 @@ class EE_API Renderer {
|
||||
unsigned int mCurVAO;
|
||||
|
||||
std::list<Rectf> mPlanesClipped;
|
||||
ClippingMask * mClippingMask;
|
||||
private:
|
||||
void writeExtension( Uint8 Pos, Uint32 BitWrite );
|
||||
};
|
||||
|
||||
@@ -301,7 +301,7 @@ class EE_API UIControl {
|
||||
|
||||
virtual Uint32 onValueChange();
|
||||
|
||||
virtual void onVisibleChange();
|
||||
virtual void onVisibilityChange();
|
||||
|
||||
virtual void onEnabledChange();
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ class EE_API UIWidget : public UIControlAnim {
|
||||
|
||||
virtual void onPositionChange();
|
||||
|
||||
virtual void onVisibilityChange();
|
||||
|
||||
virtual void onAutoSize();
|
||||
|
||||
void notifyLayoutAttrChange();
|
||||
|
||||
@@ -318,18 +318,6 @@ class EE_API Window {
|
||||
/** Get a frame per second limit. */
|
||||
Uint32 getFrameRateLimit();
|
||||
|
||||
/** Set the current Clipping area ( default the entire window, SCISSOR TEST ). */
|
||||
void clipEnable( const Int32& x, const Int32& y, const Uint32& Width, const Uint32& Height );
|
||||
|
||||
/** Disable the Clipping area */
|
||||
void clipDisable();
|
||||
|
||||
/** Clip the area with a plane. */
|
||||
void clipPlaneEnable( const Int32& x, const Int32& y, const Int32& Width, const Int32& Height );
|
||||
|
||||
/** Disable the clip plane area. */
|
||||
void clipPlaneDisable();
|
||||
|
||||
/** @return The clipboard manager */
|
||||
Clipboard * getClipboard() const;
|
||||
|
||||
@@ -492,8 +480,6 @@ class EE_API Window {
|
||||
};
|
||||
|
||||
FrameData mFrameData;
|
||||
std::list<Rectf> mScissorsClipped;
|
||||
bool mPushScissorClip;
|
||||
|
||||
/** Set the flag state to be the current window */
|
||||
virtual void setCurrent();
|
||||
|
||||
Reference in New Issue
Block a user