mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 22:44:32 +00:00
Eliminating obsolete #ifdefs and friends (#26)
The following options have been applied globally, using unifdef(1): ```c #undef BBGE_BUILD_DIRECTX #define BBGE_BUILD_OPENGL 1 #define GL_GLEXT_LEGACY 1 #define HAVE_PUTENV 1 #define TIXML_USE_STL 1 #define BBGE_BUILD_SDL 1 ```
This commit is contained in:
parent
dff33b0530
commit
276265be1d
54 changed files with 1 additions and 2248 deletions
|
@ -59,7 +59,6 @@ int RenderObject::getTopLayer()
|
|||
|
||||
void RenderObject::applyBlendType()
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
if (blendEnabled)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -84,42 +83,6 @@ void RenderObject::applyBlendType()
|
|||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
if (blendEnabled)
|
||||
{
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
switch (blendType)
|
||||
{
|
||||
case BLEND_DEFAULT:
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case BLEND_ADD:
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
||||
//glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
break;
|
||||
case BLEND_SUB:
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA);
|
||||
//glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
|
||||
break;
|
||||
}
|
||||
|
||||
core->getD3DDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
core->getD3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
/*
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RenderObject::setColorMult(const Vector &color, const float alpha)
|
||||
|
@ -179,9 +142,6 @@ RenderObject::RenderObject()
|
|||
motionBlurFrameOffset = 0;
|
||||
motionBlur = false;
|
||||
idx = -1;
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
useDXTransform = false;
|
||||
#endif
|
||||
_fv = false;
|
||||
_fh = false;
|
||||
updateCull = -1;
|
||||
|
@ -255,7 +215,6 @@ bool RenderObject::isPieceFlippedHorizontal()
|
|||
|
||||
Vector RenderObject::getInvRotPosition(const Vector &vec)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
|
@ -292,9 +251,6 @@ Vector RenderObject::getInvRotPosition(const Vector &vec)
|
|||
|
||||
glPopMatrix();
|
||||
return Vector(x,y,z);
|
||||
#elif BBGE_BUILD_DIRECTX
|
||||
return vec;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BBGE_USE_GLM
|
||||
|
@ -327,7 +283,6 @@ static void matrixChain(RenderObject *ro)
|
|||
if (RenderObject *parent = ro->getParent())
|
||||
matrixChain(parent);
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glTranslatef(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0);
|
||||
glRotatef(ro->rotation.z+ro->rotationOffset.z, 0, 0, 1);
|
||||
glTranslatef(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0);
|
||||
|
@ -338,7 +293,6 @@ static void matrixChain(RenderObject *ro)
|
|||
glRotatef(180, 0, 1, 0);
|
||||
}
|
||||
glTranslatef(ro->internalOffset.x, ro->internalOffset.y, 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -369,7 +323,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
|
|||
|
||||
return Vector(transformMatrix[3][0], transformMatrix[3][1], 0);
|
||||
#else
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
|
@ -383,9 +336,6 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec)
|
|||
|
||||
glPopMatrix();
|
||||
return Vector(x,y,0);
|
||||
#elif BBGE_BUILD_DIRECTX
|
||||
return vec;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -656,19 +606,13 @@ void RenderObject::renderCall()
|
|||
|
||||
position += offset;
|
||||
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
if (!RENDEROBJECT_FASTTRANSFORM)
|
||||
core->getD3DMatrixStack()->Push();
|
||||
#endif
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
if (!RENDEROBJECT_FASTTRANSFORM)
|
||||
glPushMatrix();
|
||||
if (!RENDEROBJECT_SHAREATTRIBUTES)
|
||||
{
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (!RENDEROBJECT_FASTTRANSFORM)
|
||||
|
@ -685,7 +629,6 @@ void RenderObject::renderCall()
|
|||
{
|
||||
if (followCamera == 1)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glLoadIdentity();
|
||||
glScalef(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
|
@ -696,24 +639,11 @@ void RenderObject::renderCall()
|
|||
}
|
||||
|
||||
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->getD3DMatrixStack()->LoadIdentity();
|
||||
core->scaleMatrixStack(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
|
||||
core->translateMatrixStack(position.x, position.y, 0);
|
||||
if (isfh())
|
||||
{
|
||||
//HACK: disable cull ->
|
||||
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
|
||||
}
|
||||
core->rotateMatrixStack(rotation.z + rotationOffset.z);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector pos = getFollowCameraPosition();
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glTranslatef(pos.x, pos.y, pos.z);
|
||||
if (isfh())
|
||||
{
|
||||
|
@ -721,29 +651,13 @@ void RenderObject::renderCall()
|
|||
glRotatef(180, 0, 1, 0);
|
||||
}
|
||||
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->translateMatrixStack(pos.x, pos.y, 0);
|
||||
if (isfh())
|
||||
{
|
||||
//HACK: disable cull ->
|
||||
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
|
||||
}
|
||||
core->rotateMatrixStack(rotation.z + rotationOffset.z);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->translateMatrixStack(position.x, position.y, 0);
|
||||
#endif
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
if (RenderObject::renderPaths && position.data && position.data->path.getNumPathNodes() > 0)
|
||||
{
|
||||
glLineWidth(4);
|
||||
|
@ -770,8 +684,6 @@ void RenderObject::renderCall()
|
|||
}
|
||||
glEnd();
|
||||
}
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
|
||||
glRotatef(rotation.z+rotationOffset.z, 0, 0, 1);
|
||||
if (isfh())
|
||||
|
@ -779,34 +691,11 @@ void RenderObject::renderCall()
|
|||
//glDisable(GL_CULL_FACE);
|
||||
glRotatef(180, 0, 1, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
//core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 0, 1), rotation.z+rotationOffset.z);
|
||||
core->rotateMatrixStack(rotation.z + rotationOffset.z);
|
||||
if (isfh())
|
||||
{
|
||||
//HACK: disable cull
|
||||
core->getD3DDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
//core->getD3DMatrixStack()->Scale(-1, 1, 1);
|
||||
//core->applyMatrixStackToWorld();
|
||||
core->getD3DMatrixStack()->RotateAxisLocal(&D3DXVECTOR3(0, 1, 0), D3DXToRadian(180));
|
||||
//core->applyMatrixStackToWorld();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z);
|
||||
glScalef(scale.x, scale.y, 1);
|
||||
glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z);
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->translateMatrixStack(beforeScaleOffset.x, beforeScaleOffset.y, 0);
|
||||
core->scaleMatrixStack(scale.x, scale.y, 1);
|
||||
core->translateMatrixStack(internalOffset.x, internalOffset.y, 0);
|
||||
|
||||
core->applyMatrixStackToWorld();
|
||||
#endif
|
||||
|
||||
|
||||
//glDisable(GL_CULL_FACE);
|
||||
|
@ -844,41 +733,27 @@ void RenderObject::renderCall()
|
|||
|
||||
//if (useColor)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
if (rlayer)
|
||||
glColor4f(color.x * rlayer->color.x, color.y * rlayer->color.y, color.z * rlayer->color.z, alpha.x*alphaMod);
|
||||
else
|
||||
glColor4f(color.x, color.y, color.z, alpha.x*alphaMod);
|
||||
#elif defined(BBGE_BUILD_DIRECTX)
|
||||
core->setColor(color.x, color.y, color.z, alpha.x*alphaMod);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (texture)
|
||||
{
|
||||
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
if (texture->textures[0] != lastTextureApplied || repeatTexture != lastTextureRepeat)
|
||||
{
|
||||
texture->apply(repeatTexture);
|
||||
lastTextureRepeat = repeatTexture;
|
||||
lastTextureApplied = texture->textures[0];
|
||||
}
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
texture->apply(repeatTexture);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lastTextureApplied != 0 || repeatTexture != lastTextureRepeat)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->bindTexture(0, 0);
|
||||
#endif
|
||||
lastTextureApplied = 0;
|
||||
lastTextureRepeat = repeatTexture;
|
||||
}
|
||||
|
@ -922,13 +797,7 @@ void RenderObject::renderCall()
|
|||
|
||||
if (!RENDEROBJECT_FASTTRANSFORM)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glPopMatrix();
|
||||
#endif
|
||||
#ifdef BBGE_BUILD_DIRECTX
|
||||
core->getD3DMatrixStack()->Pop();
|
||||
core->applyMatrixStackToWorld();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -939,7 +808,6 @@ void RenderObject::renderCollision()
|
|||
{
|
||||
if (!collisionRects.empty())
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glPushMatrix();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -974,12 +842,10 @@ void RenderObject::renderCollision()
|
|||
glDisable(GL_BLEND);
|
||||
|
||||
glPopAttrib();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!collisionMask.empty())
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glPushMatrix();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -1023,7 +889,6 @@ void RenderObject::renderCollision()
|
|||
glPopAttrib();
|
||||
|
||||
//glTranslatef(offset.x, offset.y,0);
|
||||
#endif
|
||||
}
|
||||
else if (collideRadius > 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue