diff --git a/src/graphics/cbatchrenderer.hpp b/src/graphics/cbatchrenderer.hpp index 1b99219ea..6fa26eb12 100755 --- a/src/graphics/cbatchrenderer.hpp +++ b/src/graphics/cbatchrenderer.hpp @@ -22,7 +22,8 @@ struct eeVertex { class EE_API cBatchRenderer { public: cBatchRenderer(); - ~cBatchRenderer(); + + virtual ~cBatchRenderer(); /** Construct with a defined number of vertexs preallocated */ cBatchRenderer( const eeUint& Prealloc ); diff --git a/src/graphics/cfont.cpp b/src/graphics/cfont.cpp index 8cb183c5f..afc014c98 100644 --- a/src/graphics/cfont.cpp +++ b/src/graphics/cfont.cpp @@ -127,14 +127,17 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con if ( Flags & FONT_DRAW_SHADOW ) { Uint32 f = Flags; + f &= ~FONT_DRAW_SHADOW; eeColorA Col = mColor; - /** FIXME: Cache shadows? */ SetText( TextCache.Text() ); + Color( mShadowColor ); + Draw( TextCache, X + 1, Y + 1, f, Scale, Angle, Effect ); + Color( Col ); } diff --git a/src/graphics/cparticle.cpp b/src/graphics/cparticle.cpp index afd1f3f57..58472c6c0 100755 --- a/src/graphics/cparticle.cpp +++ b/src/graphics/cparticle.cpp @@ -8,7 +8,7 @@ cParticle::cParticle() { cParticle::~cParticle() {} -void cParticle::SetColor(eeColorAf Color, eeFloat AlphaDecay) { +void cParticle::Color(eeColorAf Color, eeFloat AlphaDecay) { mColor = Color; mAlphaDecay = AlphaDecay; } diff --git a/src/graphics/cparticle.hpp b/src/graphics/cparticle.hpp index be6e51ef7..ec978a506 100755 --- a/src/graphics/cparticle.hpp +++ b/src/graphics/cparticle.hpp @@ -10,8 +10,8 @@ class EE_API cParticle{ cParticle(); ~cParticle(); - void SetColor(eeColorAf Color, eeFloat AlphaDecay); - eeColorAf GetColor() const { return mColor; } + void Color(eeColorAf Color, eeFloat AlphaDecay); + eeColorAf Color() const { return mColor; } eeFloat R() { return mColor.R(); } eeFloat G() { return mColor.G(); } diff --git a/src/graphics/cparticlesystem.cpp b/src/graphics/cparticlesystem.cpp index da93a328f..d27446fba 100755 --- a/src/graphics/cparticlesystem.cpp +++ b/src/graphics/cparticlesystem.cpp @@ -17,9 +17,6 @@ cParticleSystem::cParticleSystem() : mColor(), mProgression( 0 ), mDirection( 0 ), - mLoop( false ), - mUsed( false ), - mPointsSup( false ), mX( 0.f ), mY( 0.f ), mXAcc( 0.f ), @@ -31,8 +28,10 @@ cParticleSystem::cParticleSystem() : mHSize( 0.f ), mTime( 0.01f ), mX2( 0.f ), - mY2( 0.f ) - + mY2( 0.f ), + mLoop( false ), + mUsed( false ), + mPointsSup( false ) { } @@ -110,46 +109,46 @@ void cParticleSystem::Reset(cParticle* P) { switch(mEffect) { case Nofx: P->Reset(mX, mY, mXSpeed, mYSpeed, mXAcc, mYAcc, mSize); - P->SetColor( mColor , mAlphaDecay ); + P->Color( mColor , mAlphaDecay ); break; case BlueBall: P->Reset(mX, mY, -10, (-1 * eeRandf()), 0.01f, eeRandf(), mSize); - P->SetColor( eeColorAf(0.25f ,0.25f ,1 ,1) , 0.1f + (0.1f * eeRandf())); + P->Color( eeColorAf(0.25f ,0.25f ,1 ,1) , 0.1f + (0.1f * eeRandf())); break; case Fire: x = (mX2 - mX + 1) * eeRandf() + mX; y = (mY2 - mY + 1) * eeRandf() + mY; P->Reset(mX, mY, eeRandf() - 0.5f, (eeRandf() - 1.1f) * 8.5f, 0.f, 0.05f, mSize); - P->SetColor(eeColorAf(1.f, 0.5f, 0.1f, (eeRandf() * 0.5f) ), eeRandf() * 0.4f + 0.01f ); + P->Color(eeColorAf(1.f, 0.5f, 0.1f, (eeRandf() * 0.5f) ), eeRandf() * 0.4f + 0.01f ); break; case Smoke: x = (mX2 - mX + 1) * eeRandf() + mX; y = (mY2 - mY + 1) * eeRandf() + mY; P->Reset(x, y, -(eeRandf() / 3.f + 0.1f), ((eeRandf() * 0.5f) - 0.7f) * 3, (eeRandf() / 200.f), (eeRandf() - 0.5f) / 200.f ); - P->SetColor( eeColorAf(0.8f,0.8f,0.8f,0.3f), (eeRandf() * 0.005f) + 0.005f ); + P->Color( eeColorAf(0.8f,0.8f,0.8f,0.3f), (eeRandf() * 0.005f) + 0.005f ); break; case Snow: x = (mX2 - mX + 1) * eeRandf() + mX; y = (mY2 - mY + 1) * eeRandf() + mY; w = (eeRandf() + 0.3f) * 4; P->Reset(x, y, eeRandf() - 0.5f, w, 0.f, 0.f, w * 3); - P->SetColor( eeColorAf(1.f, 1.f, 1.f, 0.5f), 0 ); + P->Color( eeColorAf(1.f, 1.f, 1.f, 0.5f), 0 ); break; case MagicFire: P->Reset( mX + eeRandf() , mY, -0.4f + eeRandf() * 0.8f, -0.5f - eeRandf() * 0.4f, 0.f, -(eeRandf() * 0.3f) ); - P->SetColor( eeColorAf(1.f, 0.5f, 0.1f, 0.7f + 0.2f * eeRandf()), 0.01f + eeRandf() * 0.05f ); + P->Color( eeColorAf(1.f, 0.5f, 0.1f, 0.7f + 0.2f * eeRandf()), 0.01f + eeRandf() * 0.05f ); break; case LevelUp: P->Reset(mX, mY, eeRandf() * 1.5f - 0.75f, eeRandf() * 1.5f - 0.75f, eeRandf() * 4 - 2, eeRandf() * -4 + 2 ); - P->SetColor( eeColorAf(1.f, 0.5f, 0.1f, 1.f), 0.07f + eeRandf() * 0.01f ); + P->Color( eeColorAf(1.f, 0.5f, 0.1f, 1.f), 0.07f + eeRandf() * 0.01f ); break; case LevelUp2: P->Reset(mX + eeRandf() * 32 - 16, mY + eeRandf() * 64 - 32, eeRandf() - 0.5f, eeRandf() - 0.5f, eeRandf() - 0.5f, eeRandf() * -0.9f + 0.45f ); - P->SetColor( eeColorAf(0.1f + eeRandf() * 0.1f, 0.1f + eeRandf() * 0.1f, 0.8f + eeRandf() * 0.3f, 1), 0.07f + eeRandf() * 0.01f ); + P->Color( eeColorAf(0.1f + eeRandf() * 0.1f, 0.1f + eeRandf() * 0.1f, 0.8f + eeRandf() * 0.3f, 1), 0.07f + eeRandf() * 0.01f ); break; case Heal: P->Reset(mX, mY, eeRandf() * 1.4f - 0.7f, eeRandf() * -0.4f - 1.5f, eeRandf() - 0.5f, eeRandf() * -0.2f + 0.1f ); - P->SetColor( eeColorAf(0.2f, 0.3f, 0.9f, 0.4f), 0.01f + eeRandf() * 0.01f ); + P->Color( eeColorAf(0.2f, 0.3f, 0.9f, 0.4f), 0.01f + eeRandf() * 0.01f ); break; case WormHole: int lo, la; @@ -168,7 +167,7 @@ void cParticleSystem::Reset(cParticle* P) { y = mY + (radio * eesin( (eeFloat)P->Id() )); P->Reset(x, y, VarB[0], VarB[1], VarB[2], VarB[3]); - P->SetColor( eeColorAf(1.f, 0.6f, 0.3f, 1.f), 0.02f + eeRandf() * 0.3f ); + P->Color( eeColorAf(1.f, 0.6f, 0.3f, 1.f), 0.02f + eeRandf() * 0.3f ); break; case Twirl: z = 10.f + (eeFloat)mProgression; @@ -181,7 +180,7 @@ void cParticleSystem::Reset(cParticle* P) { y = mY - z * eecos((eeFloat)q * 2); P->Reset(x, y, 1, 1, 0, 0); - P->SetColor( eeColorAf(1.f, 0.25f, 0.25f, 1), 0.6f + eeRandf() * 0.3f ); + P->Color( eeColorAf(1.f, 0.25f, 0.25f, 1), 0.6f + eeRandf() * 0.3f ); break; case Flower: radio = eecos( 2 * ( (eeFloat)P->Id() * 0.1f ) ) * 50; @@ -189,21 +188,21 @@ void cParticleSystem::Reset(cParticle* P) { y = mY + radio * eesin( (eeFloat)P->Id() * 0.1f ); P->Reset(x, y, 1, 1, 0 , 0); - P->SetColor( eeColorAf(1.f, 0.25f, 0.1f, 0.1f), 0.3f + (0.2f * eeRandf()) + eeRandf() * 0.3f ); + P->Color( eeColorAf(1.f, 0.25f, 0.1f, 0.1f), 0.3f + (0.2f * eeRandf()) + eeRandf() * 0.3f ); break; case Galaxy: radio = (eeRandf(1.f, 1.2f) + eesin( 20.f / (eeFloat)P->Id() )) * 60; x = mX + radio * eecos( (eeFloat)P->Id() ); y = mY + radio * eesin( (eeFloat)P->Id() ); P->Reset(x, y, 0, 0, 0, 0); - P->SetColor( eeColorAf(0.2f, 0.2f, 0.6f + 0.4f * eeRandf(), 1.f), eeRandf(0.05f, 0.15f) ); + P->Color( eeColorAf(0.2f, 0.2f, 0.6f + 0.4f * eeRandf(), 1.f), eeRandf(0.05f, 0.15f) ); break; case Heart: q = P->Id() * 0.01f; x = mX - 50 * eesin(q * 2) * eesqrt( eeabs( eecos(q) ) ); y = mY - 50 * eecos(q * 2) * eesqrt( eeabs( eesin(q) ) ); P->Reset(x, y, 0.f, 0.f, 0.f, -(eeRandf() * 0.2f)); - P->SetColor( eeColorAf(1.f, 0.5f, 0.2f, 0.6f + 0.2f * eeRandf()), 0.01f + eeRandf() * 0.08f ); + P->Color( eeColorAf(1.f, 0.5f, 0.2f, 0.6f + 0.2f * eeRandf()), 0.01f + eeRandf() * 0.08f ); break; case BlueExplosion: if ( P->Id() == 0 ) mProgression+=10; @@ -212,7 +211,7 @@ void cParticleSystem::Reset(cParticle* P) { y = mY + (radio * eesin( (eeFloat)P->Id() / mProgression ) * 30); P->Reset(x, y, eecos( (eeFloat)P->Id() ), eesin( (eeFloat)P->Id() ), 0, 0 ); - P->SetColor( eeColorAf(0.3f, 0.6f, 1.f, 1.f), 0.03f ); + P->Color( eeColorAf(0.3f, 0.6f, 1.f, 1.f), 0.03f ); break; case GP: radio = 50 + eeRandf() * 15 * eecos( (eeFloat)P->Id() * 3.5f ); @@ -220,7 +219,7 @@ void cParticleSystem::Reset(cParticle* P) { y = mY + ( radio * eesin( (eeFloat)P->Id() * (eeFloat)0.01428571428 ) ); P->Reset(x, y, 0, 0, 0, 0); - P->SetColor( eeColorAf(0.2f, 0.8f, 0.4f, 0.5f) , eeRandf() * 0.3f ); + P->Color( eeColorAf(0.2f, 0.8f, 0.4f, 0.5f) , eeRandf() * 0.3f ); break; case BTwirl: w = 10.f + (eeFloat)mProgression; @@ -232,7 +231,7 @@ void cParticleSystem::Reset(cParticle* P) { y = mY - w * eecos((eeFloat)q * 2); P->Reset(x, y, 1, 1, 0, 0); - P->SetColor( eeColorAf(0.25f, 0.25f, 1.f, 1.f), 0.1f + eeRandf() * 0.3f + eeRandf() * 0.3f ); + P->Color( eeColorAf(0.25f, 0.25f, 1.f, 1.f), 0.1f + eeRandf() * 0.3f + eeRandf() * 0.3f ); break; case BT: w = 10.f + (eeFloat)mProgression; @@ -244,14 +243,14 @@ void cParticleSystem::Reset(cParticle* P) { y = mY - w * eecos((eeFloat)q * 2); P->Reset(x, y, -10, -1 * eeRandf(), 0, eeRandf()); - P->SetColor( eeColorAf(0.25f, 0.25f, 1.f, 1.f), 0.1f + eeRandf() * 0.1f + eeRandf() * 0.3f ); + P->Color( eeColorAf(0.25f, 0.25f, 1.f, 1.f), 0.1f + eeRandf() * 0.1f + eeRandf() * 0.3f ); break; case Atomic: radio = 10 + eesin( 2 * ( (eeFloat)P->Id() * 0.1f ) ) * 50; x = mX + radio * eecos( (eeFloat)P->Id() * (eeFloat)0.033333 ); y = mY + radio * eesin( (eeFloat)P->Id() * (eeFloat)0.033333 ); P->Reset(x, y, 1, 1, 0, 0); - P->SetColor( eeColorAf(0.4f, 0.25f, 1.f, 1.f), 0.3f + eeRandf() * 0.2f + eeRandf() * 0.3f ); + P->Color( eeColorAf(0.4f, 0.25f, 1.f, 1.f), 0.3f + eeRandf() * 0.2f + eeRandf() * 0.3f ); break; case Callback: if ( mPC.IsSet() ) @@ -293,15 +292,10 @@ void cParticleSystem::Draw() { for ( Uint32 i = 0; i < mPCount; i++ ) { P = &mParticle[i]; - eeVector2f TL; if ( P->Used() ) { - TL.x = P->X() - mHSize; - TL.y = P->Y() - mHSize; - - /** FIXME: Optimize */ BR->QuadsSetColor( eeColorA( static_cast ( P->R() * 255 ), static_cast ( P->G() * 255 ), static_cast( P->B() * 255 ), static_cast( P->A() * 255 ) ) ); - BR->BatchQuad( TL.x, TL.y, mSize, mSize ); + BR->BatchQuad( P->X() - mHSize, P->Y() - mHSize, mSize, mSize ); } } diff --git a/src/graphics/cparticlesystem.hpp b/src/graphics/cparticlesystem.hpp index 53d68d124..dfa85d734 100755 --- a/src/graphics/cparticlesystem.hpp +++ b/src/graphics/cparticlesystem.hpp @@ -131,9 +131,6 @@ class EE_API cParticleSystem { eeInt mProgression; eeInt mDirection; - bool mLoop; - bool mUsed; - bool mPointsSup; eeFloat mX; eeFloat mY; @@ -148,7 +145,12 @@ class EE_API cParticleSystem { eeFloat mX2; eeFloat mY2; + bool mLoop; + bool mUsed; + bool mPointsSup; + void Begin(); + void Reset( cParticle* P ); ParticleCallback mPC; diff --git a/src/graphics/ctexturegrouploader.cpp b/src/graphics/ctexturegrouploader.cpp index 9b1db9e54..c9880d4b8 100644 --- a/src/graphics/ctexturegrouploader.cpp +++ b/src/graphics/ctexturegrouploader.cpp @@ -97,10 +97,10 @@ void cTextureGroupLoader::Load( const std::string& TextureGroupPath ) { if ( !mSkipResourceLoad ) { mIsLoading = true; mRL.Load(); + + if ( !mThreaded ) + CreateShapes(); } - - if ( !mThreaded ) - CreateShapes(); } } @@ -209,7 +209,10 @@ void cTextureGroupLoader::CreateShapes() { tSG->Add( tShape ); } } else { - /** @TODO: Error Report */ + cLog::instance()->Write( "cTextureGroupLoader::CreateShapes: Failed to find texture group texture, it seems that is not loaded for some reason. Couldn't find: " + path ); + + eeASSERT( NULL != tTex ); + return; } } diff --git a/src/graphics/cvertexbuffervbo.cpp b/src/graphics/cvertexbuffervbo.cpp index af91e8f71..87d249e3e 100644 --- a/src/graphics/cvertexbuffervbo.cpp +++ b/src/graphics/cvertexbuffervbo.cpp @@ -196,7 +196,7 @@ void cVertexBufferVBO::SetVertexStates() { glBindBuffer( GL_ARRAY_BUFFER, mArrayHandle[ VERTEX_FLAG_TEXTURE0 + i ] ); #ifdef EE_GL3_ENABLED - if ( GLv_3 == GLi->Version() ) { /** FIXME: Support for multitexturing */ + if ( GLv_3 == GLi->Version() ) { index = GLi->GetRendererGL3()->GetStateIndex( EEGL_TEXTURE_COORD_ARRAY ); if ( -1 != index && 0 == i ) @@ -227,7 +227,7 @@ void cVertexBufferVBO::SetVertexStates() { if ( GLv_3 == GLi->Version() ) { index = GLi->GetRendererGL3()->GetStateIndex( EEGL_TEXTURE_COORD_ARRAY ); - if ( -1 != index ) /** FIXME: Support for multitexturing */ + if ( -1 != index ) glVertexAttribPointer( index, eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, GL_FALSE, 0, 0 ); } else diff --git a/src/graphics/renderer/crenderergl3.cpp b/src/graphics/renderer/crenderergl3.cpp index 790189056..52f2f39cd 100644 --- a/src/graphics/renderer/crenderergl3.cpp +++ b/src/graphics/renderer/crenderergl3.cpp @@ -631,6 +631,10 @@ void cRendererGL3::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, co GLint cRendererGL3::GetStateIndex( const Uint32& State ) { eeASSERT( State < EEGL_ARRAY_STATES_COUNT ); + + if ( EEGL_TEXTURE_COORD_ARRAY == State ) + return mTextureUnits[ mCurActiveTex ]; + return mStates[ State ]; } diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 5790c2752..d9eab884e 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -1429,6 +1429,8 @@ void cEETest::End() { eeSAFE_DELETE( mBoxSprite ); eeSAFE_DELETE( mCircleSprite ); + mResLoad.Unload(); + cLog::instance()->Save(); cEngine::DestroySingleton(); @@ -1440,7 +1442,7 @@ void cEETest::ParticlesCallback(cParticle* P, cParticleSystem* Me) { x = Me->X() + radio * cos( (eeFloat)P->Id() ); y = Me->Y() + radio * sin( (eeFloat)P->Id() ); P->Reset(x, y, eeRandf(-10.f, 10.f), eeRandf(-10.f, 10.f), eeRandf(-10.f, 10.f), eeRandf(-10.f, 10.f)); - P->SetColor( eeColorAf(1.f, 0.6f, 0.3f, 1.f), 0.02f + eeRandf() * 0.3f ); + P->Color( eeColorAf(1.f, 0.6f, 0.3f, 1.f), 0.02f + eeRandf() * 0.3f ); } void cEETest::Particles() { diff --git a/src/window/backend/SDL/cclipboardsdl.cpp b/src/window/backend/SDL/cclipboardsdl.cpp index 7dd1463f1..30050ad70 100644 --- a/src/window/backend/SDL/cclipboardsdl.cpp +++ b/src/window/backend/SDL/cclipboardsdl.cpp @@ -18,8 +18,6 @@ static int clipboard_filter( const SDL_Event *event ) { return 1; } - /** FIXME: Support multiple windows */ - //Display * curDisplay = cEngine::instance()->GetWindowHandler(); Display * curDisplay = (Display *)CurrentHandler; /* Handle window-manager specific clipboard events */ @@ -84,7 +82,6 @@ void cClipboardSDL::Init() { SDL_EventState( SDL_SYSWMEVENT, SDL_ENABLE ); SDL_SetEventFilter( clipboard_filter ); - /** FIXME: Support multiple windows */ CurrentHandler = (void*)mWindow->GetWindowHandler(); #endif diff --git a/src/window/backend/SDL/ccursormanagersdl.cpp b/src/window/backend/SDL/ccursormanagersdl.cpp index d78fb305f..310d65706 100644 --- a/src/window/backend/SDL/ccursormanagersdl.cpp +++ b/src/window/backend/SDL/ccursormanagersdl.cpp @@ -52,29 +52,28 @@ void cCursorManagerSDL::Hide() { void cCursorManagerSDL::Visible( bool visible ) { if ( visible ) { - SDL_ShowCursor( SDL_ENABLE ); - - mWindow->GetPlatform()->ShowMouseCursor(); + SDL_ShowCursor( SDL_ENABLE ); + + mWindow->GetPlatform()->ShowMouseCursor(); mVisible = true; } else { - SDL_ShowCursor( SDL_DISABLE ); - - mWindow->GetPlatform()->HideMouseCursor(); + SDL_ShowCursor( SDL_DISABLE ); + + mWindow->GetPlatform()->HideMouseCursor(); mVisible = false; } -} - -void cCursorManagerSDL::Remove( cCursor * cursor, bool Delete ) { - //! FIXME: Implement Secure Deletion - cCursorManager::Remove( cursor, Delete ); +} + +void cCursorManagerSDL::Remove( cCursor * cursor, bool Delete ) { + cCursorManager::Remove( cursor, Delete ); } void cCursorManagerSDL::Reload() { if ( mVisible ) { - Show(); - + Show(); + mWindow->GetPlatform()->RestoreCursor(); } else { Hide(); diff --git a/src/window/backend/allegro5/ccursormanageral.cpp b/src/window/backend/allegro5/ccursormanageral.cpp index 6c7a22515..10a58cbd6 100644 --- a/src/window/backend/allegro5/ccursormanageral.cpp +++ b/src/window/backend/allegro5/ccursormanageral.cpp @@ -49,10 +49,9 @@ void cCursorManagerAl::Visible( bool visible ) { mVisible = false; } } - -void cCursorManagerAl::Remove( cCursor * cursor, bool Delete ) { - //! FIXME: Implement Secure Deletion - cCursorManager::Remove( cursor, Delete ); + +void cCursorManagerAl::Remove( cCursor * cursor, bool Delete ) { + cCursorManager::Remove( cursor, Delete ); } void cCursorManagerAl::Show() { diff --git a/src/window/platform/x11/cx11impl.cpp b/src/window/platform/x11/cx11impl.cpp index 353c1b731..f20c9741f 100644 --- a/src/window/platform/x11/cx11impl.cpp +++ b/src/window/platform/x11/cx11impl.cpp @@ -99,10 +99,11 @@ void cX11Impl::MoveWindow( int left, int top ) { } void cX11Impl::SetContext( eeWindowContex Context ) { - /// FIXME: This is wrong - /*mLock(); + mLock(); + glXMakeCurrent( mDisplay, mX11Window, Context ); - mUnlock();*/ + + mUnlock(); } eeVector2i cX11Impl::Position() {