mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Added BlendMode class to set the blend mode, since it doesn't make sense to control the blend mode in the texture factory.
Added Clear() method to cWindow, to allow the user to control WHEN clear the buffers. Added some operators to eeColorA. Fixed BlendMode for FBO's. Hided cTexture constructors, the only class that it's allowed to create textures is cTextureFactory.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace EE { namespace Gaming {
|
||||
|
||||
cGameObjectSubTextureEx::cGameObjectSubTextureEx( const Uint32& Flags, cLayer * Layer, cSubTexture * SubTexture, const eeVector2f& Pos, EE_PRE_BLEND_FUNC Blend, EE_RENDERTYPE Render, eeFloat Angle, eeFloat Scale, eeColorA Color ) :
|
||||
cGameObjectSubTextureEx::cGameObjectSubTextureEx( const Uint32& Flags, cLayer * Layer, cSubTexture * SubTexture, const eeVector2f& Pos, EE_BLEND_MODE Blend, EE_RENDERTYPE Render, eeFloat Angle, eeFloat Scale, eeColorA Color ) :
|
||||
cGameObjectSubTexture( Flags, Layer, SubTexture, Pos ),
|
||||
mBlend( Blend ),
|
||||
mRender( Render ),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/gaming/cobjectlayer.hpp>
|
||||
#include <eepp/gaming/cmap.hpp>
|
||||
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
#include <eepp/graphics/renderer/cgl.hpp>
|
||||
using namespace EE::Graphics;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/gaming/ctilelayer.hpp>
|
||||
#include <eepp/gaming/cmap.hpp>
|
||||
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
#include <eepp/graphics/renderer/cgl.hpp>
|
||||
using namespace EE::Graphics;
|
||||
|
||||
67
src/eepp/graphics/blendmode.cpp
Normal file
67
src/eepp/graphics/blendmode.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <eepp/graphics/blendmode.hpp>
|
||||
#include <eepp/graphics/renderer/cgl.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
EE_BLEND_MODE BlendMode::sLastBlend = ALPHA_NORMAL;
|
||||
|
||||
void BlendMode::SetMode( const EE_BLEND_MODE& blend, bool force ) {
|
||||
if ( sLastBlend != blend || force ) {
|
||||
if (blend == ALPHA_NONE) {
|
||||
GLi->Disable( GL_BLEND );
|
||||
} else {
|
||||
GLi->Enable( GL_BLEND );
|
||||
|
||||
switch (blend) {
|
||||
case ALPHA_NORMAL:
|
||||
if ( GLi->IsExtension( EEGL_EXT_blend_func_separate ) )
|
||||
glBlendFuncSeparateEXT( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||
else
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_BLENDONE:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE);
|
||||
break;
|
||||
case ALPHA_BLENDTWO:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_SRC_ALPHA);
|
||||
GLi->BlendFunc(GL_DST_ALPHA , GL_ONE);
|
||||
break;
|
||||
case ALPHA_BLENDTHREE:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE);
|
||||
GLi->BlendFunc(GL_DST_ALPHA , GL_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_ALPHACHANNELS:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_DESTALPHA:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_DST_ALPHA);
|
||||
break;
|
||||
case ALPHA_MULTIPLY:
|
||||
GLi->BlendFunc(GL_DST_COLOR,GL_ZERO);
|
||||
break;
|
||||
case ALPHA_NONE:
|
||||
// Avoid compiler warning
|
||||
break;
|
||||
case ALPHA_CUSTOM:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sLastBlend= blend;
|
||||
}
|
||||
}
|
||||
|
||||
void BlendMode::SetBlendFunc( const EE_BLEND_FUNC& SrcFactor, const EE_BLEND_FUNC& DestFactor ) {
|
||||
GLi->Enable( GL_BLEND );
|
||||
|
||||
GLi->BlendFunc( (GLenum)SrcFactor, (GLenum)DestFactor );
|
||||
|
||||
sLastBlend = ALPHA_CUSTOM;
|
||||
}
|
||||
|
||||
const EE_BLEND_MODE& BlendMode::GetPreBlendFunc() {
|
||||
return sLastBlend;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <eepp/graphics/cbatchrenderer.hpp>
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
|
||||
@@ -70,7 +71,7 @@ void cBatchRenderer::SetTexture( const cTexture * Tex ) {
|
||||
mTexture = Tex;
|
||||
}
|
||||
|
||||
void cBatchRenderer::SetPreBlendFunc( const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
void cBatchRenderer::SetBlendMode( const EE_BLEND_MODE& Blend ) {
|
||||
if ( Blend != mBlend )
|
||||
Flush();
|
||||
|
||||
@@ -103,7 +104,7 @@ void cBatchRenderer::Flush() {
|
||||
|
||||
bool CreateMatrix = ( mRotation || mScale != 1.0f || mPosition.x || mPosition.y );
|
||||
|
||||
mTF->SetPreBlendFunc( mBlend );
|
||||
BlendMode::SetMode( mBlend );
|
||||
|
||||
if ( mCurrentMode == DM_POINTS && NULL != mTexture ) {
|
||||
GLi->Enable( GL_POINT_SPRITE );
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <eepp/graphics/cfont.hpp>
|
||||
#include <eepp/graphics/cfontmanager.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
@@ -128,21 +129,21 @@ const std::vector<eeFloat>& cFont::GetLinesWidth() const {
|
||||
return mLinesWidth;
|
||||
}
|
||||
|
||||
void cFont::Draw( const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_PRE_BLEND_FUNC& Effect) {
|
||||
void cFont::Draw( const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_BLEND_MODE& Effect) {
|
||||
SubDraw( mText, X, Y, Flags, Scale, Angle, true, Effect );
|
||||
}
|
||||
|
||||
void cFont::Draw( const String& Text, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_PRE_BLEND_FUNC& Effect ) {
|
||||
void cFont::Draw( const String& Text, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_BLEND_MODE& Effect ) {
|
||||
SubDraw( Text, X, Y, Flags, Scale, Angle, false, Effect );
|
||||
}
|
||||
|
||||
void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_PRE_BLEND_FUNC& Effect ) {
|
||||
void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_BLEND_MODE& Effect ) {
|
||||
if ( !TextCache.Text().size() )
|
||||
return;
|
||||
|
||||
cGlobalBatchRenderer::instance()->Draw();
|
||||
cTextureFactory::instance()->Bind( mTexId );
|
||||
cTextureFactory::instance()->SetPreBlendFunc( Effect );
|
||||
BlendMode::SetMode( Effect );
|
||||
|
||||
if ( Flags & FONT_DRAW_SHADOW ) {
|
||||
Uint32 f = Flags;
|
||||
@@ -334,13 +335,13 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con
|
||||
}
|
||||
}
|
||||
|
||||
void cFont::SubDraw( const String& Text, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const bool& Cached, const EE_PRE_BLEND_FUNC& Effect ) {
|
||||
void cFont::SubDraw( const String& Text, const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const bool& Cached, const EE_BLEND_MODE& Effect ) {
|
||||
if ( !Text.size() )
|
||||
return;
|
||||
|
||||
cGlobalBatchRenderer::instance()->Draw();
|
||||
cTextureFactory::instance()->Bind( mTexId );
|
||||
cTextureFactory::instance()->SetPreBlendFunc( Effect );
|
||||
BlendMode::SetMode( Effect );
|
||||
|
||||
if ( !Cached && ( Text.size() != mRenderCoords.size() / EE_QUAD_VERTEX || Angle != 0.f || Scale != 1.f || FontHAlignGet( Flags ) == FONT_DRAW_CENTER || FontHAlignGet( Flags ) == FONT_DRAW_RIGHT ) ) {
|
||||
SetText( Text );
|
||||
|
||||
@@ -173,7 +173,7 @@ const Uint8* cImage::GetPixelsPtr() {
|
||||
|
||||
eeColorA cImage::GetPixel( const eeUint& x, const eeUint& y ) {
|
||||
if ( mPixels == NULL || x > mWidth || y > mHeight ) {
|
||||
return eeColorA::Black;
|
||||
return eeColorA::Transparent;
|
||||
}
|
||||
|
||||
eeUint Pos = ( x + y * mWidth ) * mChannels;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <eepp/graphics/cparticlesystem.hpp>
|
||||
#include <eepp/graphics/glhelper.hpp>
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/cbatchrenderer.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
#include <eepp/window/cengine.hpp>
|
||||
|
||||
using namespace EE::Window;
|
||||
@@ -319,7 +321,7 @@ void cParticleSystem::Draw() {
|
||||
cTextureFactory * TF = cTextureFactory::instance();
|
||||
|
||||
TF->Bind( mTexId );
|
||||
TF->SetPreBlendFunc( mBlend );
|
||||
BlendMode::SetMode( mBlend );
|
||||
|
||||
if ( mPointsSup ) {
|
||||
GLi->Enable( GL_POINT_SPRITE );
|
||||
@@ -343,7 +345,7 @@ void cParticleSystem::Draw() {
|
||||
|
||||
cBatchRenderer * BR = cGlobalBatchRenderer::instance();
|
||||
BR->SetTexture( Tex );
|
||||
BR->SetPreBlendFunc( mBlend );
|
||||
BR->SetBlendMode( mBlend );
|
||||
BR->QuadsBegin();
|
||||
|
||||
for ( Uint32 i = 0; i < mPCount; i++ ) {
|
||||
@@ -459,11 +461,11 @@ bool cParticleSystem::Using() const {
|
||||
return mUsed;
|
||||
}
|
||||
|
||||
const EE_PRE_BLEND_FUNC& cParticleSystem::BlendMode() const {
|
||||
const EE_BLEND_MODE& cParticleSystem::BlendMode() const {
|
||||
return mBlend;
|
||||
}
|
||||
|
||||
void cParticleSystem::BlendMode( const EE_PRE_BLEND_FUNC& mode ) {
|
||||
void cParticleSystem::BlendMode( const EE_BLEND_MODE& mode ) {
|
||||
mBlend = mode;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ cPrimitives::cPrimitives() :
|
||||
cPrimitives::~cPrimitives() {
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRoundedRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
void cPrimitives::DrawRoundedRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
mBR->SetTexture( NULL );
|
||||
mBR->SetPreBlendFunc( blend );
|
||||
mBR->SetBlendMode( blend );
|
||||
|
||||
eeUint i;
|
||||
eeFloat xscalediff = width * Scale - width;
|
||||
@@ -86,14 +86,14 @@ void cPrimitives::DrawRoundedRectangle(const eeFloat& x, const eeFloat& y, const
|
||||
DrawBatch();
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
void cPrimitives::DrawRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
if ( 0 != Corners ) {
|
||||
DrawRoundedRectangle( x, y, width, height, TopLeft, BottomLeft, BottomRight, TopRight, Angle, Scale, fillmode, blend, lineWidth, Corners );
|
||||
return;
|
||||
}
|
||||
|
||||
mBR->SetTexture( NULL );
|
||||
mBR->SetPreBlendFunc( blend );
|
||||
mBR->SetBlendMode( blend );
|
||||
|
||||
switch(fillmode) {
|
||||
case EE_DRAW_FILL: {
|
||||
@@ -186,9 +186,9 @@ void cPrimitives::DrawCircle( const eeFloat& x, const eeFloat& y, const eeFloat&
|
||||
DrawBatch();
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
mBR->SetTexture( NULL );
|
||||
mBR->SetPreBlendFunc( blend );
|
||||
mBR->SetBlendMode( blend );
|
||||
|
||||
switch(fillmode) {
|
||||
case EE_DRAW_LINE:
|
||||
@@ -214,9 +214,9 @@ void cPrimitives::DrawTriangle(const eeFloat& x1, const eeFloat& y1, const eeFlo
|
||||
DrawBatch();
|
||||
}
|
||||
|
||||
void cPrimitives::DrawQuad( const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeFloat& x4, const eeFloat& y4, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const eeColorA& Color4, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
void cPrimitives::DrawQuad( const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeFloat& x4, const eeFloat& y4, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const eeColorA& Color4, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
mBR->SetTexture( NULL );
|
||||
mBR->SetPreBlendFunc( blend );
|
||||
mBR->SetBlendMode( blend );
|
||||
|
||||
switch(fillmode) {
|
||||
case EE_DRAW_LINE:
|
||||
@@ -238,9 +238,9 @@ void cPrimitives::DrawQuad( const eeFloat& x1, const eeFloat& y1, const eeFloat&
|
||||
DrawBatch();
|
||||
}
|
||||
|
||||
void cPrimitives::DrawPolygon(const eePolygon2f& p, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawPolygon(const eePolygon2f& p, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
mBR->SetTexture( NULL );
|
||||
mBR->SetPreBlendFunc( blend );
|
||||
mBR->SetBlendMode( blend );
|
||||
|
||||
switch(fillmode) {
|
||||
case EE_DRAW_LINE:
|
||||
@@ -262,27 +262,27 @@ void cPrimitives::DrawPolygon(const eePolygon2f& p, const EE_FILL_MODE& fillmode
|
||||
DrawBatch();
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRectangle( const eeRectf& R, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
void cPrimitives::DrawRectangle( const eeRectf& R, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
DrawRectangle( R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, TopLeft, BottomLeft, BottomRight, TopRight, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRectangle( const eeRectf& R, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
void cPrimitives::DrawRectangle( const eeRectf& R, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
DrawRectangle( R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, mColor, mColor, mColor, mColor, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
void cPrimitives::DrawRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
DrawRectangle(x, y, width, height, mColor, mColor, mColor, mColor, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRoundedRectangle( const eeRectf& R, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
void cPrimitives::DrawRoundedRectangle( const eeRectf& R, const eeColorA& TopLeft, const eeColorA& BottomLeft, const eeColorA& BottomRight, const eeColorA& TopRight, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
DrawRoundedRectangle( R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, TopLeft, BottomLeft, BottomRight, TopRight, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRoundedRectangle( const eeRectf& R, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
void cPrimitives::DrawRoundedRectangle( const eeRectf& R, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners) {
|
||||
DrawRoundedRectangle( R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, mColor, mColor, mColor, mColor, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawRoundedRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
void cPrimitives::DrawRoundedRectangle(const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& Angle, const eeFloat& Scale, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeUint& Corners ) {
|
||||
DrawRoundedRectangle(x, y, width, height, mColor, mColor, mColor, mColor, Angle, Scale, fillmode, blend, lineWidth, Corners);
|
||||
}
|
||||
|
||||
@@ -302,39 +302,39 @@ void cPrimitives::SetColor( const eeColorA& Color ) {
|
||||
mColor = Color;
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeTriangle2f& t, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeTriangle2f& t, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
DrawTriangle( t.V[0], t.V[1], t.V[2], mColor, mColor, mColor, fillmode, blend, lineWidth );
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeTriangle2f& t, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeTriangle2f& t, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
DrawTriangle( t.V[0], t.V[1], t.V[2], Color1, Color2, Color3, fillmode, blend, lineWidth );
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
DrawTriangle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, Color1, Color2, Color3, fillmode, blend, lineWidth);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
DrawTriangle(x1, y1, x2, y2, x3, y3, mColor, mColor, mColor, fillmode, blend, lineWidth);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawTriangle(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth) {
|
||||
void cPrimitives::DrawTriangle(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth) {
|
||||
DrawTriangle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, mColor, mColor, mColor, fillmode, blend, lineWidth);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawQuad(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeFloat& x4, const eeFloat& y4, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
void cPrimitives::DrawQuad(const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeFloat& x4, const eeFloat& y4, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
DrawQuad(x1, y1, x2, y2, x3, y3, x4, y4, mColor, mColor, mColor, mColor, fillmode, blend, lineWidth, OffsetX, OffsetY);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawQuad(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeVector2f& p4, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const eeColorA& Color4, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
void cPrimitives::DrawQuad(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeVector2f& p4, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const eeColorA& Color4, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
DrawQuad(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, Color1, Color2, Color3, Color4, fillmode, blend, lineWidth, OffsetX, OffsetY);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawQuad(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeVector2f& p4, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
void cPrimitives::DrawQuad(const eeVector2f& p1, const eeVector2f& p2, const eeVector2f& p3, const eeVector2f& p4, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
DrawQuad(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, mColor, mColor, mColor, mColor, fillmode, blend, lineWidth, OffsetX, OffsetY);
|
||||
}
|
||||
|
||||
void cPrimitives::DrawQuad(const eeQuad2f& q, const EE_FILL_MODE& fillmode, const EE_PRE_BLEND_FUNC& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
void cPrimitives::DrawQuad(const eeQuad2f& q, const EE_FILL_MODE& fillmode, const EE_BLEND_MODE& blend, const eeFloat& lineWidth, const eeFloat& OffsetX, const eeFloat& OffsetY ) {
|
||||
DrawQuad(q.V[0].x, q.V[0].y, q.V[1].x, q.V[1].y, q.V[2].x, q.V[2].y, q.V[3].x, q.V[3].y, mColor, mColor, mColor, mColor, fillmode, blend, lineWidth, OffsetX, OffsetY);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ cScrollParallax::cScrollParallax() :
|
||||
|
||||
cScrollParallax::~cScrollParallax() {}
|
||||
|
||||
cScrollParallax::cScrollParallax( cSubTexture * SubTexture, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
cScrollParallax::cScrollParallax( cSubTexture * SubTexture, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_BLEND_MODE& Blend ) {
|
||||
Create( SubTexture, DestX, DestY, DestWidth, DestHeight, Speed, Color, Blend );
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ void cScrollParallax::SetAABB() {
|
||||
mAABB = eeRectf( mInitPos.x, mInitPos.y, mInitPos.x + mSize.Width(), mInitPos.y + mSize.Height() );
|
||||
}
|
||||
|
||||
bool cScrollParallax::Create( cSubTexture * SubTexture, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
bool cScrollParallax::Create( cSubTexture * SubTexture, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_BLEND_MODE& Blend ) {
|
||||
mSubTexture = SubTexture;
|
||||
mPos = eeVector2f( DestX, DestY );
|
||||
mSize = eeSizef( DestWidth, DestHeight );
|
||||
|
||||
@@ -526,7 +526,7 @@ void cSprite::SetReverseFromStart() {
|
||||
mCurrentFrame = Size;
|
||||
}
|
||||
|
||||
void cSprite::Draw( const EE_PRE_BLEND_FUNC& Blend, const EE_RENDERTYPE& Effect ) {
|
||||
void cSprite::Draw( const EE_BLEND_MODE& Blend, const EE_RENDERTYPE& Effect ) {
|
||||
if ( SPR_FGET( SPRITE_FLAG_AUTO_ANIM ) )
|
||||
Update();
|
||||
|
||||
@@ -545,7 +545,7 @@ void cSprite::Draw() {
|
||||
Draw( mBlend, mEffect );
|
||||
}
|
||||
|
||||
void cSprite::Draw( const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
void cSprite::Draw( const EE_BLEND_MODE& Blend ) {
|
||||
Draw( Blend, mEffect );
|
||||
}
|
||||
|
||||
@@ -860,11 +860,11 @@ const EE_RENDERTYPE& cSprite::RenderType() const {
|
||||
return mEffect;
|
||||
}
|
||||
|
||||
void cSprite::BlendMode( const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
void cSprite::BlendMode( const EE_BLEND_MODE& Blend ) {
|
||||
mBlend = Blend;
|
||||
}
|
||||
|
||||
const EE_PRE_BLEND_FUNC& cSprite::BlendMode() const {
|
||||
const EE_BLEND_MODE& cSprite::BlendMode() const {
|
||||
return mBlend;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <eepp/graphics/csubtexture.hpp>
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/renderer/cgl.hpp>
|
||||
#include <eepp/helper/SOIL2/src/SOIL2/SOIL2.h>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
@@ -114,8 +115,8 @@ const Uint32& cSubTexture::Texture() {
|
||||
}
|
||||
|
||||
void cSubTexture::Texture( const Uint32& TexId ) {
|
||||
mTexId = TexId;
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
mTexId = TexId;
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
}
|
||||
|
||||
const eeRecti& cSubTexture::SrcRect() const {
|
||||
@@ -164,17 +165,17 @@ void cSubTexture::OffsetY( const Int32& offsety ) {
|
||||
mOffsetY = offsety;
|
||||
}
|
||||
|
||||
void cSubTexture::Draw( const eeFloat& X, const eeFloat& Y, const eeColorA& Color, const eeFloat& Angle, const eeFloat& Scale, const EE_PRE_BLEND_FUNC& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) {
|
||||
void cSubTexture::Draw( const eeFloat& X, const eeFloat& Y, const eeColorA& Color, const eeFloat& Angle, const eeFloat& Scale, const EE_BLEND_MODE& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) {
|
||||
if ( NULL != mTexture )
|
||||
mTexture->DrawEx( X + mOffsetX, Y + mOffsetY, mDestWidth, mDestHeight, Angle, Scale, Color, Color, Color, Color, Blend, Effect, ScaleRendered, mSrcRect );
|
||||
}
|
||||
|
||||
void cSubTexture::Draw( const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) {
|
||||
void cSubTexture::Draw( const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_BLEND_MODE& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) {
|
||||
if ( NULL != mTexture )
|
||||
mTexture->DrawEx( X + mOffsetX, Y + mOffsetY, mDestWidth, mDestHeight, Angle, Scale, Color0, Color1, Color2, Color3, Blend, Effect, ScaleRendered, mSrcRect );
|
||||
}
|
||||
|
||||
void cSubTexture::Draw( const eeQuad2f Q, const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC& Blend ) {
|
||||
void cSubTexture::Draw( const eeQuad2f Q, const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_BLEND_MODE& Blend ) {
|
||||
if ( NULL != mTexture )
|
||||
mTexture->DrawQuadEx( Q, X, Y, Angle, Scale, Color0, Color1, Color2, Color3, Blend, mSrcRect );
|
||||
}
|
||||
@@ -386,7 +387,7 @@ bool cSubTexture::SaveToFile(const std::string& filepath, const EE_SAVE_TYPE& Fo
|
||||
|
||||
Lock();
|
||||
|
||||
if ( mTexture )
|
||||
if ( NULL != mTexture )
|
||||
Res = 0 != ( SOIL_save_image ( filepath.c_str(), Format, RealSize().Width(), RealSize().Height(), 4, GetPixelsPtr() ) );
|
||||
|
||||
Unlock();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <eepp/graphics/ctextcache.hpp>
|
||||
#include <eepp/graphics/cfont.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
@@ -126,7 +127,7 @@ const std::vector<eeFloat>& cTextCache::LinesWidth() {
|
||||
return mLinesWidth;
|
||||
}
|
||||
|
||||
void cTextCache::Draw( const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, EE_PRE_BLEND_FUNC Effect ) {
|
||||
void cTextCache::Draw( const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, EE_BLEND_MODE Effect ) {
|
||||
if ( NULL != mFont ) {
|
||||
if ( mFlags != Flags ) {
|
||||
mFlags = Flags;
|
||||
|
||||
@@ -200,6 +200,10 @@ void cTexture::SetPixel( const eeUint& x, const eeUint& y, const eeColorA& Color
|
||||
mFlags |= TEX_FLAG_MODIFIED;
|
||||
}
|
||||
|
||||
void cTexture::Bind() {
|
||||
cTextureFactory::instance()->Bind( this );
|
||||
}
|
||||
|
||||
bool cTexture::SaveToFile( const std::string& filepath, const EE_SAVE_TYPE& Format ) {
|
||||
bool Res = false;
|
||||
|
||||
@@ -407,11 +411,11 @@ bool cTexture::Compressed() const {
|
||||
return 0 != ( mFlags & TEX_FLAG_COMPRESSED );
|
||||
}
|
||||
|
||||
void cTexture::Draw( const eeFloat &x, const eeFloat &y, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_PRE_BLEND_FUNC &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector) {
|
||||
void cTexture::Draw( const eeFloat &x, const eeFloat &y, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_BLEND_MODE &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector) {
|
||||
DrawEx( x, y, 0, 0, Angle, Scale, Color, Color, Color, Color, blend, Effect, ScaleCentered, texSector);
|
||||
}
|
||||
|
||||
void cTexture::DrawFast( const eeFloat& x, const eeFloat& y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color, const EE_PRE_BLEND_FUNC &blend, const eeFloat &width, const eeFloat &height ) {
|
||||
void cTexture::DrawFast( const eeFloat& x, const eeFloat& y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color, const EE_BLEND_MODE &blend, const eeFloat &width, const eeFloat &height ) {
|
||||
cBatchRenderer * BR = cGlobalBatchRenderer::instance();
|
||||
|
||||
eeFloat w = width, h = height;
|
||||
@@ -419,7 +423,7 @@ void cTexture::DrawFast( const eeFloat& x, const eeFloat& y, const eeFloat& Angl
|
||||
if (!h) h = (eeFloat)ImgHeight();
|
||||
|
||||
BR->SetTexture( this );
|
||||
BR->SetPreBlendFunc( blend );
|
||||
BR->SetBlendMode( blend );
|
||||
|
||||
BR->QuadsBegin();
|
||||
BR->QuadsSetColor( Color );
|
||||
@@ -432,7 +436,7 @@ void cTexture::DrawFast( const eeFloat& x, const eeFloat& y, const eeFloat& Angl
|
||||
BR->DrawOpt();
|
||||
}
|
||||
|
||||
void cTexture::DrawEx( const eeFloat &x, const eeFloat &y, const eeFloat &width, const eeFloat &height, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector) {
|
||||
void cTexture::DrawEx( const eeFloat &x, const eeFloat &y, const eeFloat &width, const eeFloat &height, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_BLEND_MODE &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector) {
|
||||
cBatchRenderer * BR = cGlobalBatchRenderer::instance();
|
||||
|
||||
bool renderdiv = true;
|
||||
@@ -475,12 +479,12 @@ void cTexture::DrawEx( const eeFloat &x, const eeFloat &y, const eeFloat &width,
|
||||
renderdiv = false;
|
||||
|
||||
BR->SetTexture( this );
|
||||
BR->SetPreBlendFunc( blend );
|
||||
BR->SetBlendMode( blend );
|
||||
|
||||
BR->QuadsBegin();
|
||||
BR->QuadsSetColorFree( Color0, Color1, Color2, Color3 );
|
||||
|
||||
if ( Effect <= 3 ) {
|
||||
if ( Effect <= RN_FLIPMIRROR ) {
|
||||
if ( ClampMode() == EE_CLAMP_REPEAT ) {
|
||||
if ( Effect == RN_NORMAL )
|
||||
if ( renderdiv ) {
|
||||
@@ -587,15 +591,15 @@ void cTexture::DrawEx( const eeFloat &x, const eeFloat &y, const eeFloat &width,
|
||||
BR->DrawOpt();
|
||||
}
|
||||
|
||||
void cTexture::DrawEx2( const eeFloat &x, const eeFloat &y, const eeFloat &width, const eeFloat &height, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_PRE_BLEND_FUNC &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector ) {
|
||||
void cTexture::DrawEx2( const eeFloat &x, const eeFloat &y, const eeFloat &width, const eeFloat &height, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_BLEND_MODE &blend, const EE_RENDERTYPE &Effect, const bool &ScaleCentered, const eeRecti& texSector ) {
|
||||
DrawEx( x, y, width, height, Angle, Scale, Color, Color, Color, Color, blend, Effect, ScaleCentered, texSector );
|
||||
}
|
||||
|
||||
void cTexture::DrawQuad( const eeQuad2f& Q, const eeFloat &offsetx, const eeFloat &offsety, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_PRE_BLEND_FUNC &blend, const eeRecti& texSector) {
|
||||
void cTexture::DrawQuad( const eeQuad2f& Q, const eeFloat &offsetx, const eeFloat &offsety, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color, const EE_BLEND_MODE &blend, const eeRecti& texSector) {
|
||||
DrawQuadEx( Q, offsetx, offsety, Angle, Scale, Color, Color, Color, Color, blend, texSector);
|
||||
}
|
||||
|
||||
void cTexture::DrawQuadEx( const eeQuad2f& Q, const eeFloat &offsetx, const eeFloat &offsety, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC &blend, const eeRecti& texSector ) {
|
||||
void cTexture::DrawQuadEx( const eeQuad2f& Q, const eeFloat &offsetx, const eeFloat &offsety, const eeFloat &Angle, const eeFloat &Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_BLEND_MODE &blend, const eeRecti& texSector ) {
|
||||
cBatchRenderer * BR = cGlobalBatchRenderer::instance();
|
||||
|
||||
bool renderdiv = true;
|
||||
@@ -619,7 +623,7 @@ void cTexture::DrawQuadEx( const eeQuad2f& Q, const eeFloat &offsetx, const eeFl
|
||||
renderdiv = false;
|
||||
|
||||
BR->SetTexture( this );
|
||||
BR->SetPreBlendFunc( blend );
|
||||
BR->SetBlendMode( blend );
|
||||
|
||||
BR->QuadsBegin();
|
||||
BR->QuadsSetColorFree( Color0, Color1, Color2, Color3 );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/ctextureloader.hpp>
|
||||
#include <eepp/graphics/glhelper.hpp>
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/helper/SOIL2/src/SOIL2/stb_image.h>
|
||||
#include <eepp/helper/SOIL2/src/SOIL2/SOIL2.h>
|
||||
|
||||
@@ -16,8 +17,6 @@ cTextureFactory::cTextureFactory() :
|
||||
mTextures.clear();
|
||||
mTextures.push_back( NULL );
|
||||
|
||||
mAppPath = Sys::GetProcessPath();
|
||||
|
||||
memset( &mCurrentTexture[0], 0, EE_MAX_TEXTURE_UNITS );
|
||||
}
|
||||
|
||||
@@ -210,58 +209,6 @@ void cTextureFactory::UngrabTextures() {
|
||||
}
|
||||
}
|
||||
|
||||
void cTextureFactory::SetBlendFunc( const EE_BLEND_FUNC& SrcFactor, const EE_BLEND_FUNC& DestFactor ) {
|
||||
GLi->Enable( GL_BLEND );
|
||||
|
||||
GLi->BlendFunc( (GLenum)SrcFactor, (GLenum)DestFactor );
|
||||
|
||||
mLastBlend = ALPHA_CUSTOM;
|
||||
}
|
||||
|
||||
void cTextureFactory::SetPreBlendFunc( const EE_PRE_BLEND_FUNC& blend, bool force ) {
|
||||
if ( mLastBlend != blend || force ) {
|
||||
if (blend == ALPHA_NONE) {
|
||||
GLi->Disable( GL_BLEND );
|
||||
} else {
|
||||
GLi->Enable( GL_BLEND );
|
||||
|
||||
switch (blend) {
|
||||
case ALPHA_NORMAL:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_BLENDONE:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE);
|
||||
break;
|
||||
case ALPHA_BLENDTWO:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_SRC_ALPHA);
|
||||
GLi->BlendFunc(GL_DST_ALPHA , GL_ONE);
|
||||
break;
|
||||
case ALPHA_BLENDTHREE:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_ONE);
|
||||
GLi->BlendFunc(GL_DST_ALPHA , GL_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_ALPHACHANNELS:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_DESTALPHA:
|
||||
GLi->BlendFunc(GL_SRC_ALPHA , GL_DST_ALPHA);
|
||||
break;
|
||||
case ALPHA_MULTIPLY:
|
||||
GLi->BlendFunc(GL_DST_COLOR,GL_ZERO);
|
||||
break;
|
||||
case ALPHA_NONE:
|
||||
// Avoid compiler warning
|
||||
break;
|
||||
case ALPHA_CUSTOM:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mLastBlend = blend;
|
||||
}
|
||||
}
|
||||
|
||||
void cTextureFactory::SetActiveTextureUnit( const Uint32& Unit ) {
|
||||
GLi->ActiveTexture( GL_TEXTURE0 + Unit );
|
||||
}
|
||||
@@ -284,10 +231,6 @@ void cTextureFactory::SetTextureEnv( const EE_TEXTURE_PARAM& Param, const Int32&
|
||||
#endif
|
||||
}
|
||||
|
||||
const EE_PRE_BLEND_FUNC& cTextureFactory::GetPreBlendFunc() const {
|
||||
return mLastBlend;
|
||||
}
|
||||
|
||||
eeUint cTextureFactory::GetValidTextureSize( const eeUint& Size ) {
|
||||
if ( GLi->IsExtension( EEGL_ARB_texture_non_power_of_two ) )
|
||||
return Size;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <eepp/graphics/ctexturefont.hpp>
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/system/ciostreamfile.hpp>
|
||||
#include <eepp/system/ciostreammemory.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <eepp/graphics/ctextureloader.hpp>
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/glhelper.hpp>
|
||||
#include <eepp/system/ciostreamfile.hpp>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <eepp/graphics/cttffont.hpp>
|
||||
#include <eepp/graphics/ctexture.hpp>
|
||||
#include <eepp/system/ciostreamfile.hpp>
|
||||
#include <eepp/helper/haikuttf/haikuttf.hpp>
|
||||
using namespace HaikuTTF;
|
||||
|
||||
@@ -122,6 +122,7 @@ void cGL::Init() {
|
||||
WriteExtension( EEGL_EXT_texture_compression_s3tc , GLEW_EXT_texture_compression_s3tc );
|
||||
WriteExtension( EEGL_ARB_vertex_buffer_object , GLEW_ARB_vertex_buffer_object );
|
||||
WriteExtension( EEGL_ARB_vertex_array_object , GLEW_ARB_vertex_array_object );
|
||||
WriteExtension( EEGL_EXT_blend_func_separate , GLEW_EXT_blend_func_separate );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -138,6 +139,7 @@ void cGL::Init() {
|
||||
WriteExtension( EEGL_EXT_texture_compression_s3tc , IsExtension( "GL_EXT_texture_compression_s3tc" ) );
|
||||
WriteExtension( EEGL_ARB_vertex_buffer_object , IsExtension( "GL_ARB_vertex_buffer_object" ) );
|
||||
WriteExtension( EEGL_ARB_vertex_array_object , IsExtension( "GL_ARB_vertex_array_object" ) );
|
||||
WriteExtension( EEGL_EXT_blend_func_separate , IsExtension( "GL_EXT_blend_func_separate" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ void cSpace::Draw() {
|
||||
#ifdef PHYSICS_RENDERER_ENABLED
|
||||
|
||||
cBatchRenderer * BR = cGlobalBatchRenderer::instance();
|
||||
BR->SetPreBlendFunc( ALPHA_NORMAL );
|
||||
BR->SetBlendMode( ALPHA_NORMAL );
|
||||
|
||||
cPhysicsManager::cDrawSpaceOptions * options = cPhysicsManager::instance()->GetDrawOptions();
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ cUIBackground::cUIBackground( const cUIBackground& Back ) :
|
||||
mColor = b->Colors();
|
||||
}
|
||||
|
||||
cUIBackground::cUIBackground( const eeColorA& Color, const eeUint& Corners, const EE_PRE_BLEND_FUNC& BlendMode ) :
|
||||
cUIBackground::cUIBackground( const eeColorA& Color, const eeUint& Corners, const EE_BLEND_MODE& BlendMode ) :
|
||||
mBlendMode( BlendMode ),
|
||||
mCorners( Corners )
|
||||
{
|
||||
mColor.push_back( Color );
|
||||
}
|
||||
|
||||
cUIBackground::cUIBackground( const eeColorA& TopLeftColor, const eeColorA& BottomLeftColor, const eeColorA& BottomRightColor, const eeColorA& TopRightColor, const eeUint& Corners, const EE_PRE_BLEND_FUNC& BlendMode ) :
|
||||
cUIBackground::cUIBackground( const eeColorA& TopLeftColor, const eeColorA& BottomLeftColor, const eeColorA& BottomRightColor, const eeColorA& TopRightColor, const eeUint& Corners, const EE_BLEND_MODE& BlendMode ) :
|
||||
mBlendMode( BlendMode ),
|
||||
mCorners( Corners )
|
||||
{
|
||||
@@ -70,11 +70,11 @@ void cUIBackground::Color( const eeColorA& Col ) {
|
||||
mColor[0] = Col;
|
||||
}
|
||||
|
||||
const EE_PRE_BLEND_FUNC& cUIBackground::Blend() const {
|
||||
const EE_BLEND_MODE& cUIBackground::Blend() const {
|
||||
return mBlendMode;
|
||||
}
|
||||
|
||||
void cUIBackground::Blend( const EE_PRE_BLEND_FUNC& blend ) {
|
||||
void cUIBackground::Blend( const EE_BLEND_MODE& blend ) {
|
||||
mBlendMode = blend;
|
||||
}
|
||||
|
||||
|
||||
@@ -444,12 +444,12 @@ void cUIControl::Flags( const Uint32& flags ) {
|
||||
mFlags |= flags;
|
||||
}
|
||||
|
||||
void cUIControl::Blend( const EE_PRE_BLEND_FUNC& blend ) {
|
||||
void cUIControl::Blend( const EE_BLEND_MODE& blend ) {
|
||||
mBlend = static_cast<Uint16> ( blend );
|
||||
}
|
||||
|
||||
EE_PRE_BLEND_FUNC cUIControl::Blend() {
|
||||
return static_cast<EE_PRE_BLEND_FUNC> ( mBlend );
|
||||
EE_BLEND_MODE cUIControl::Blend() {
|
||||
return static_cast<EE_BLEND_MODE> ( mBlend );
|
||||
}
|
||||
|
||||
void cUIControl::ToFront() {
|
||||
|
||||
@@ -321,7 +321,7 @@ WindowSettings cEngine::CreateWindowSettings( cIniFile * ini, std::string iniKey
|
||||
std::string Icon = ini->GetValue( iniKeyName, "WinIcon", "" );
|
||||
std::string Caption = ini->GetValue( iniKeyName, "WinCaption", "" );
|
||||
|
||||
WindowSettings WinSettings( Width, Height, BitColor, Style, Icon, Caption, WinBackend );
|
||||
WindowSettings WinSettings( Width, Height, Caption, Style, WinBackend, BitColor, Icon );
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_IOS
|
||||
//! @TODO: Check if SDL2 default win settings are being forced ( it wasn't working fine some time ago )
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <eepp/window/cinput.hpp>
|
||||
#include <eepp/window/ccursormanager.hpp>
|
||||
#include <eepp/graphics/ctexturefactory.hpp>
|
||||
#include <eepp/graphics/cglobalbatchrenderer.hpp>
|
||||
#include <eepp/window/platform/null/cnullimpl.hpp>
|
||||
#include <eepp/system/filesystem.hpp>
|
||||
#include <eepp/helper/SOIL2/src/SOIL2/SOIL2.h>
|
||||
@@ -122,7 +123,7 @@ void cWindow::Setup2D( const bool& KeepView ) {
|
||||
mCurrentView->NeedUpdate();
|
||||
}
|
||||
|
||||
cTextureFactory::instance()->SetPreBlendFunc( ALPHA_NORMAL, true );
|
||||
BlendMode::SetMode( ALPHA_NORMAL, true );
|
||||
|
||||
if ( GLv_3 != GLi->Version() ) {
|
||||
#if !defined( EE_GLES2 ) || defined( EE_GLES_BOTH )
|
||||
@@ -274,7 +275,11 @@ void cWindow::ViewCheckUpdate() {
|
||||
}
|
||||
}
|
||||
|
||||
void cWindow::Display() {
|
||||
void cWindow::Clear() {
|
||||
GLi->Clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
}
|
||||
|
||||
void cWindow::Display( bool clear ) {
|
||||
cGlobalBatchRenderer::instance()->Draw();
|
||||
|
||||
if ( mCurrentView->NeedUpdate() )
|
||||
@@ -282,7 +287,8 @@ void cWindow::Display() {
|
||||
|
||||
SwapBuffers();
|
||||
|
||||
GLi->Clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
if ( clear )
|
||||
Clear();
|
||||
|
||||
GetElapsedTime();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
{
|
||||
// Create a new window
|
||||
cWindow * win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, 32, WindowStyle::Default, "", "eepp - Empty Window" ), ContextSettings( ) );
|
||||
cWindow * win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - Empty Window" ) );
|
||||
|
||||
// Set window background color
|
||||
win->BackColor( eeColor( 50, 50, 50 ) );
|
||||
@@ -12,38 +12,25 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Check if created
|
||||
if ( win->Created() )
|
||||
{
|
||||
// Get input pointer
|
||||
cInput * imp = win->GetInput();
|
||||
// Create an instance of the primitive renderer
|
||||
cPrimitives p;
|
||||
|
||||
eeFloat ang = 0;
|
||||
// Change the color
|
||||
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
|
||||
|
||||
// Application loop
|
||||
while ( win->Running() )
|
||||
{
|
||||
// Update the input
|
||||
imp->Update();
|
||||
win->GetInput()->Update();
|
||||
|
||||
// Check if ESCAPE key is pressed
|
||||
if ( imp->IsKeyDown( KEY_ESCAPE ) )
|
||||
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) )
|
||||
{
|
||||
// Close the window
|
||||
win->Close();
|
||||
}
|
||||
|
||||
ang += cEngine::instance()->Elapsed() * 0.01;
|
||||
|
||||
// Create an instance of the primitive renderer
|
||||
cPrimitives p;
|
||||
|
||||
// Set the primitive color
|
||||
p.SetColor( eeColorA( 0, 150, 0, 150 ) );
|
||||
|
||||
// Draw a rectangle
|
||||
p.DrawRectangle( 100, 100, win->GetWidth() - 200, win->GetHeight() - 200, ang );
|
||||
|
||||
// Change the color
|
||||
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
|
||||
|
||||
// Draw a circle
|
||||
p.DrawCircle( win->GetWidth() / 2, win->GetHeight() / 2, 200 );
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void videoResize() {
|
||||
GLi->EnableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
/// Reset the default blend func ( by default eepp use ALPHA_NORMAL )
|
||||
cTextureFactory::instance()->SetPreBlendFunc( ALPHA_BLENDONE );
|
||||
BlendMode::SetMode( ALPHA_BLENDONE );
|
||||
|
||||
/// Set the line width
|
||||
cGlobalBatchRenderer::instance()->SetLineWidth( 2 );
|
||||
@@ -83,7 +83,7 @@ using namespace Demo_ExternalShader;
|
||||
|
||||
EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
{
|
||||
win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, 32, WindowStyle::Default, "", "eepp - External Shaders" ), ContextSettings( true ) );
|
||||
win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - External Shaders" ), ContextSettings( true ) );
|
||||
|
||||
if ( win->Created() )
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ void cEETest::Init() {
|
||||
WP.Start();
|
||||
|
||||
Batch.AllocVertexs( 2048 );
|
||||
Batch.SetPreBlendFunc( ALPHA_BLENDONE );
|
||||
Batch.SetBlendMode( ALPHA_BLENDONE );
|
||||
|
||||
mFBO = cFrameBuffer::CreateNew( 256, 256, false );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user