Merged from trunk, revisions 4488-4493. Only indentation changes, and to have the last merge revision in logs
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4494 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
e52f7c693c
commit
f484ff5ca7
|
@ -509,7 +509,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
RenderTargetTexture(0), CurrentRendertargetSize(0,0),
|
||||
ColorFormat(ECF_R8G8B8), CurrentTarget(ERT_FRAME_BUFFER), Params(params),
|
||||
X11Device(device), DeviceType(EIDT_X11)
|
||||
X11Device(device), DeviceType(EIDT_X11)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -625,9 +625,9 @@ COpenGLDriver::~COpenGLDriver()
|
|||
if (CgContext)
|
||||
cgDestroyContext(CgContext);
|
||||
#endif
|
||||
|
||||
if (BridgeCalls)
|
||||
delete BridgeCalls;
|
||||
|
||||
if (BridgeCalls)
|
||||
delete BridgeCalls;
|
||||
|
||||
RequestedLights.clear();
|
||||
|
||||
|
@ -685,10 +685,10 @@ bool COpenGLDriver::genericDriverInit()
|
|||
CurrentTexture.clear();
|
||||
// load extensions
|
||||
initExtensions(Params.Stencilbuffer);
|
||||
|
||||
if (!BridgeCalls)
|
||||
BridgeCalls = new COpenGLCallBridge(this);
|
||||
|
||||
|
||||
if (!BridgeCalls)
|
||||
BridgeCalls = new COpenGLCallBridge(this);
|
||||
|
||||
if (queryFeature(EVDF_ARB_GLSL))
|
||||
{
|
||||
char buf[32];
|
||||
|
@ -759,16 +759,16 @@ bool COpenGLDriver::genericDriverInit()
|
|||
// Create built-in 2D quad and line for 2D rendering.
|
||||
|
||||
Quad2DIndices[0] = 0;
|
||||
Quad2DIndices[1] = 2;
|
||||
Quad2DIndices[2] = 3;
|
||||
Quad2DIndices[3] = 0;
|
||||
Quad2DIndices[4] = 1;
|
||||
Quad2DIndices[5] = 2;
|
||||
|
||||
Line2DIndices[0] = 0;
|
||||
Line2DIndices[1] = 1;
|
||||
Quad2DIndices[1] = 2;
|
||||
Quad2DIndices[2] = 3;
|
||||
Quad2DIndices[3] = 0;
|
||||
Quad2DIndices[4] = 1;
|
||||
Quad2DIndices[5] = 2;
|
||||
|
||||
Quad2DVertices[0] = S3DVertex(core::vector3df(-1.0f, 1.0f, 0.0f), core::vector3df(0.0f, 0.0f, 0.0f), SColor(255,255,255,255), core::vector2df(0.0f, 1.0f));
|
||||
Line2DIndices[0] = 0;
|
||||
Line2DIndices[1] = 1;
|
||||
|
||||
Quad2DVertices[0] = S3DVertex(core::vector3df(-1.0f, 1.0f, 0.0f), core::vector3df(0.0f, 0.0f, 0.0f), SColor(255,255,255,255), core::vector2df(0.0f, 1.0f));
|
||||
Quad2DVertices[0] = S3DVertex(core::vector3df(1.0f, 1.0f, 0.0f), core::vector3df(0.0f, 0.0f, 0.0f), SColor(255,255,255,255), core::vector2df(1.0f, 1.0f));
|
||||
Quad2DVertices[0] = S3DVertex(core::vector3df(1.0f, -1.0f, 0.0f), core::vector3df(0.0f, 0.0f, 0.0f), SColor(255,255,255,255), core::vector2df(1.0f, 0.0f));
|
||||
Quad2DVertices[0] = S3DVertex(core::vector3df(-1.0f, -1.0f, 0.0f), core::vector3df(0.0f, 0.0f, 0.0f), SColor(255,255,255,255), core::vector2df(0.0f, 0.0f));
|
||||
|
@ -2400,7 +2400,7 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
|
|||
Quad2DVertices[1].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
|
||||
Quad2DVertices[2].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
|
||||
Quad2DVertices[3].TCoords = core::vector2df(tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
|
||||
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, Quad2DIndices);
|
||||
|
||||
targetPos.X += sourceRects[currentIndex].getWidth();
|
||||
|
@ -2595,7 +2595,7 @@ bool COpenGLDriver::disableTextures(u32 fromStage)
|
|||
for (u32 i=fromStage; i<MaxSupportedTextures; ++i)
|
||||
{
|
||||
result &= setActiveTexture(i, 0);
|
||||
BridgeCalls->setTexture(i, true);
|
||||
BridgeCalls->setTexture(i, true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -2990,39 +2990,39 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
switch (material.ZBuffer)
|
||||
{
|
||||
case ECFN_DISABLED:
|
||||
BridgeCalls->setDepthTest(false);
|
||||
BridgeCalls->setDepthTest(false);
|
||||
break;
|
||||
case ECFN_LESSEQUAL:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_LEQUAL);
|
||||
BridgeCalls->setDepthFunc(GL_LEQUAL);
|
||||
break;
|
||||
case ECFN_EQUAL:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_EQUAL);
|
||||
BridgeCalls->setDepthFunc(GL_EQUAL);
|
||||
break;
|
||||
case ECFN_LESS:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_LESS);
|
||||
BridgeCalls->setDepthFunc(GL_LESS);
|
||||
break;
|
||||
case ECFN_NOTEQUAL:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_NOTEQUAL);
|
||||
BridgeCalls->setDepthFunc(GL_NOTEQUAL);
|
||||
break;
|
||||
case ECFN_GREATEREQUAL:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_GEQUAL);
|
||||
BridgeCalls->setDepthFunc(GL_GEQUAL);
|
||||
break;
|
||||
case ECFN_GREATER:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_GREATER);
|
||||
BridgeCalls->setDepthFunc(GL_GREATER);
|
||||
break;
|
||||
case ECFN_ALWAYS:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_ALWAYS);
|
||||
BridgeCalls->setDepthFunc(GL_ALWAYS);
|
||||
break;
|
||||
case ECFN_NEVER:
|
||||
BridgeCalls->setDepthTest(true);
|
||||
BridgeCalls->setDepthFunc(GL_NEVER);
|
||||
BridgeCalls->setDepthFunc(GL_NEVER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3033,7 +3033,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
if (material.ZWriteEnable && (AllowZWriteOnTransparent || !material.isTransparent()))
|
||||
BridgeCalls->setDepthMask(true);
|
||||
else
|
||||
BridgeCalls->setDepthMask(false);
|
||||
BridgeCalls->setDepthMask(false);
|
||||
}
|
||||
|
||||
// back face culling
|
||||
|
@ -3255,9 +3255,9 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
}
|
||||
|
||||
// be sure to leave in texture stage 0
|
||||
BridgeCalls->setActiveTexture(GL_TEXTURE0_ARB);
|
||||
BridgeCalls->setActiveTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
|
||||
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
||||
void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline)
|
||||
{
|
||||
|
@ -3479,11 +3479,11 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
|
||||
if (texture)
|
||||
{
|
||||
if (OverrideMaterial2DEnabled)
|
||||
setTextureRenderStates(OverrideMaterial2D, false, true);
|
||||
else
|
||||
setTextureRenderStates(InitMaterial2D, false, true);
|
||||
|
||||
if (OverrideMaterial2DEnabled)
|
||||
setTextureRenderStates(OverrideMaterial2D, false, true);
|
||||
else
|
||||
setTextureRenderStates(InitMaterial2D, false, true);
|
||||
|
||||
Material.setTexture(0, const_cast<video::ITexture*>(CurrentTexture[0]));
|
||||
setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
|
||||
// Due to the transformation change, the previous line would call a reset each frame
|
||||
|
@ -3798,8 +3798,8 @@ void COpenGLDriver::drawStencilShadowVolume(const core::array<core::vector3df>&
|
|||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDepthFunc(GL_LESS);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
if (debugDataVisible & scene::EDS_MESH_WIRE_OVERLAY)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
@ -3929,7 +3929,7 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef
|
|||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
@ -4981,36 +4981,36 @@ GLenum COpenGLDriver::getZBufferBits() const
|
|||
|
||||
const SMaterial& COpenGLDriver::getCurrentMaterial() const
|
||||
{
|
||||
return Material;
|
||||
return Material;
|
||||
}
|
||||
|
||||
|
||||
COpenGLCallBridge* COpenGLDriver::getBridgeCalls() const
|
||||
{
|
||||
return BridgeCalls;
|
||||
return BridgeCalls;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_CG_
|
||||
const CGcontext& COpenGLDriver::getCgContext()
|
||||
{
|
||||
return CgContext;
|
||||
return CgContext;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver),
|
||||
AlphaMode(GL_ALWAYS), AlphaRef(0.0f), AlphaTest(false),
|
||||
BlendSource(GL_ONE), BlendDestination(GL_ZERO), Blend(false),
|
||||
ClientStateVertex(false), ClientStateNormal(false), ClientStateColor(false), ClientStateTexCoord0(false),
|
||||
CullFaceMode(GL_BACK), CullFace(false),
|
||||
DepthFunc(GL_LESS), DepthMask(true), DepthTest(false), MatrixMode(GL_MODELVIEW),
|
||||
ActiveTexture(GL_TEXTURE0_ARB), ClientActiveTexture(GL_TEXTURE0_ARB)
|
||||
DepthFunc(GL_LESS), DepthMask(true), DepthTest(false), MatrixMode(GL_MODELVIEW),
|
||||
ActiveTexture(GL_TEXTURE0_ARB), ClientActiveTexture(GL_TEXTURE0_ARB)
|
||||
{
|
||||
// Initial OpenGL values from specification.
|
||||
|
||||
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
Texture[i] = 0;
|
||||
TextureFixedPipeline[i] = true;
|
||||
}
|
||||
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
Texture[i] = 0;
|
||||
TextureFixedPipeline[i] = true;
|
||||
}
|
||||
|
||||
glAlphaFunc(GL_ALWAYS, 0.0f);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
@ -5020,20 +5020,19 @@ COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver),
|
|||
|
||||
glCullFace(GL_BACK);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glDepthFunc(GL_LESS);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
if(Driver->MultiTextureExtension)
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
if(Driver->MultiTextureExtension)
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
|
||||
Driver->extGlClientActiveTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
|
@ -5054,15 +5053,14 @@ void COpenGLCallBridge::setAlphaFunc(GLenum mode, GLclampf ref)
|
|||
|
||||
void COpenGLCallBridge::setAlphaTest(bool enable)
|
||||
{
|
||||
if(AlphaTest != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
else
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
||||
AlphaTest = enable;
|
||||
}
|
||||
if(AlphaTest != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
else
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
AlphaTest = enable;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setBlendFunc(GLenum source, GLenum destination)
|
||||
|
@ -5078,15 +5076,14 @@ void COpenGLCallBridge::setBlendFunc(GLenum source, GLenum destination)
|
|||
|
||||
void COpenGLCallBridge::setBlend(bool enable)
|
||||
{
|
||||
if(Blend != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
Blend = enable;
|
||||
}
|
||||
if(Blend != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
Blend = enable;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setClientState(bool vertex, bool normal, bool color, bool texCoord0)
|
||||
|
@ -5136,112 +5133,107 @@ void COpenGLCallBridge::setClientState(bool vertex, bool normal, bool color, boo
|
|||
|
||||
void COpenGLCallBridge::setCullFaceFunc(GLenum mode)
|
||||
{
|
||||
if(CullFaceMode != mode)
|
||||
{
|
||||
if(CullFaceMode != mode)
|
||||
{
|
||||
glCullFace(mode);
|
||||
|
||||
CullFaceMode = mode;
|
||||
}
|
||||
CullFaceMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setCullFace(bool enable)
|
||||
{
|
||||
if(CullFace != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_CULL_FACE);
|
||||
else
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
CullFace = enable;
|
||||
}
|
||||
if(CullFace != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_CULL_FACE);
|
||||
else
|
||||
glDisable(GL_CULL_FACE);
|
||||
CullFace = enable;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setDepthFunc(GLenum mode)
|
||||
{
|
||||
if(DepthFunc != mode)
|
||||
{
|
||||
if(DepthFunc != mode)
|
||||
{
|
||||
glDepthFunc(mode);
|
||||
|
||||
DepthFunc = mode;
|
||||
}
|
||||
DepthFunc = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COpenGLCallBridge::setDepthMask(bool enable)
|
||||
{
|
||||
if(DepthMask != enable)
|
||||
{
|
||||
if (enable)
|
||||
glDepthMask(GL_TRUE);
|
||||
else
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
DepthMask = enable;
|
||||
}
|
||||
if(DepthMask != enable)
|
||||
{
|
||||
if (enable)
|
||||
glDepthMask(GL_TRUE);
|
||||
else
|
||||
glDepthMask(GL_FALSE);
|
||||
DepthMask = enable;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setDepthTest(bool enable)
|
||||
{
|
||||
if(DepthTest != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
DepthTest = enable;
|
||||
}
|
||||
if(DepthTest != enable)
|
||||
{
|
||||
if (enable)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
DepthTest = enable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COpenGLCallBridge::setMatrixMode(GLenum mode)
|
||||
{
|
||||
if (MatrixMode != mode)
|
||||
{
|
||||
glMatrixMode(mode);
|
||||
MatrixMode = mode;
|
||||
}
|
||||
if (MatrixMode != mode)
|
||||
{
|
||||
glMatrixMode(mode);
|
||||
MatrixMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COpenGLCallBridge::setActiveTexture(GLenum texture)
|
||||
{
|
||||
if (Driver->MultiTextureExtension && ActiveTexture != texture)
|
||||
{
|
||||
Driver->extGlActiveTexture(texture);
|
||||
ActiveTexture = texture;
|
||||
}
|
||||
if (Driver->MultiTextureExtension && ActiveTexture != texture)
|
||||
{
|
||||
Driver->extGlActiveTexture(texture);
|
||||
ActiveTexture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setClientActiveTexture(GLenum texture)
|
||||
{
|
||||
if (Driver->MultiTextureExtension && ClientActiveTexture != texture)
|
||||
{
|
||||
Driver->extGlClientActiveTexture(texture);
|
||||
ClientActiveTexture = texture;
|
||||
}
|
||||
if (Driver->MultiTextureExtension && ClientActiveTexture != texture)
|
||||
{
|
||||
Driver->extGlClientActiveTexture(texture);
|
||||
ClientActiveTexture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline)
|
||||
{
|
||||
if (stage < MATERIAL_MAX_TEXTURES)
|
||||
{
|
||||
if((fixedPipeline && TextureFixedPipeline[stage] != fixedPipeline) || Texture[stage] != Driver->CurrentTexture[stage])
|
||||
{
|
||||
setActiveTexture(GL_TEXTURE0_ARB + stage);
|
||||
if (stage < MATERIAL_MAX_TEXTURES)
|
||||
{
|
||||
if((fixedPipeline && TextureFixedPipeline[stage] != fixedPipeline) || Texture[stage] != Driver->CurrentTexture[stage])
|
||||
{
|
||||
setActiveTexture(GL_TEXTURE0_ARB + stage);
|
||||
|
||||
if(Driver->CurrentTexture[stage])
|
||||
{
|
||||
if(fixedPipeline)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
if(Driver->CurrentTexture[stage])
|
||||
{
|
||||
if(fixedPipeline)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, static_cast<const COpenGLTexture*>(Driver->CurrentTexture[stage])->getOpenGLTextureName());
|
||||
}
|
||||
else if(fixedPipeline)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
TextureFixedPipeline[stage] = fixedPipeline;
|
||||
Texture[stage] = Driver->CurrentTexture[stage];
|
||||
}
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, static_cast<const COpenGLTexture*>(Driver->CurrentTexture[stage])->getOpenGLTextureName());
|
||||
}
|
||||
else if(fixedPipeline)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
TextureFixedPipeline[stage] = fixedPipeline;
|
||||
Texture[stage] = Driver->CurrentTexture[stage];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,102 +1,403 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
USE_GCC = 1;
|
||||
NDEBUG = 1;
|
||||
PROFILE = 0;
|
||||
|
||||
APPLICATION_NAME = 'Irrlicht';
|
||||
LIBRARIES = ['gdi32', 'opengl32', 'd3dx9d', 'winmm'];
|
||||
if USE_GCC==1 and PROFILE==1:
|
||||
LIBRARIES += ['gmon'];
|
||||
|
||||
CXXINCS = ['../../include/', 'zlib/', 'jpeglib/', 'libpng/'];
|
||||
|
||||
if USE_GCC==0:
|
||||
env = Environment(ENV = {
|
||||
'PATH': os.environ['PATH']
|
||||
}, CPPPATH=CXXINCS);
|
||||
else:
|
||||
env = Environment(ENV = {
|
||||
'PATH': os.environ['PATH']
|
||||
}, tools = ['mingw'], CPPPATH=CXXINCS);
|
||||
|
||||
IRRMESHLOADER = ['CBSPMeshFileLoader.cpp', 'CMD2MeshFileLoader.cpp', 'CMD3MeshFileLoader.cpp', 'CMS3DMeshFileLoader.cpp', 'CB3DMeshFileLoader.cpp', 'C3DSMeshFileLoader.cpp', 'COgreMeshFileLoader.cpp', 'COBJMeshFileLoader.cpp', 'CColladaFileLoader.cpp', 'CCSMLoader.cpp', 'CDMFLoader.cpp', 'CLMTSMeshFileLoader.cpp', 'CMY3DMeshFileLoader.cpp', 'COCTLoader.cpp', 'CXMeshFileLoader.cpp', 'CIrrMeshFileLoader.cpp', 'CSTLMeshFileLoader.cpp', 'CLWOMeshFileLoader.cpp'];
|
||||
|
||||
IRRMESHWRITER = ['CColladaMeshWriter.cpp', 'CIrrMeshWriter.cpp', 'COBJMeshWriter.cpp', 'CSTLMeshWriter.cpp'];
|
||||
|
||||
IRRMESHOBJ = IRRMESHLOADER + IRRMESHWRITER + ['CSkinnedMesh.cpp', 'CBoneSceneNode.cpp', 'CMeshSceneNode.cpp', 'CAnimatedMeshSceneNode.cpp', 'CAnimatedMeshMD2.cpp', 'CAnimatedMeshMD3.cpp', 'CQ3LevelMesh.cpp', 'CQuake3ShaderSceneNode.cpp'];
|
||||
|
||||
IRROBJ = ['CBillboardSceneNode.cpp', 'CCameraSceneNode.cpp', 'CDummyTransformationSceneNode.cpp', 'CEmptySceneNode.cpp', 'CGeometryCreator.cpp', 'CLightSceneNode.cpp', 'CMeshManipulator.cpp', 'CMetaTriangleSelector.cpp', 'COctreeSceneNode.cpp', 'COctreeTriangleSelector.cpp', 'CSceneCollisionManager.cpp', 'CSceneManager.cpp', 'CShadowVolumeSceneNode.cpp', 'CSkyBoxSceneNode.cpp', 'CSkyDomeSceneNode.cpp', 'CTerrainSceneNode.cpp', 'CTerrainTriangleSelector.cpp', 'CVolumeLightSceneNode.cpp', 'CCubeSceneNode.cpp', 'CSphereSceneNode.cpp', 'CTextSceneNode.cpp', 'CTriangleBBSelector.cpp', 'CTriangleSelector.cpp', 'CWaterSurfaceSceneNode.cpp', 'CMeshCache.cpp', 'CDefaultSceneNodeAnimatorFactory.cpp', 'CDefaultSceneNodeFactory.cpp'];
|
||||
|
||||
IRRPARTICLEOBJ = ['CParticleAnimatedMeshSceneNodeEmitter.cpp', 'CParticleBoxEmitter.cpp', 'CParticleCylinderEmitter.cpp', 'CParticleMeshEmitter.cpp', 'CParticlePointEmitter.cpp', 'CParticleRingEmitter.cpp', 'CParticleSphereEmitter.cpp', 'CParticleAttractionAffector.cpp', 'CParticleFadeOutAffector.cpp', 'CParticleGravityAffector.cpp', 'CParticleRotationAffector.cpp', 'CParticleSystemSceneNode.cpp', 'CParticleScaleAffector.cpp'];
|
||||
|
||||
IRRANIMOBJ = ['CSceneNodeAnimatorCameraFPS.cpp', 'CSceneNodeAnimatorCameraMaya.cpp', 'CSceneNodeAnimatorCollisionResponse.cpp', 'CSceneNodeAnimatorDelete.cpp', 'CSceneNodeAnimatorFlyCircle.cpp', 'CSceneNodeAnimatorFlyStraight.cpp', 'CSceneNodeAnimatorFollowSpline.cpp', 'CSceneNodeAnimatorRotation.cpp', 'CSceneNodeAnimatorTexture.cpp'];
|
||||
|
||||
IRRDRVROBJ = ['CNullDriver.cpp', 'COpenGLDriver.cpp', 'COpenGLNormalMapRenderer.cpp', 'COpenGLParallaxMapRenderer.cpp', 'COpenGLShaderMaterialRenderer.cpp', 'COpenGLTexture.cpp', 'COpenGLSLMaterialRenderer.cpp', 'COpenGLExtensionHandler.cpp', 'CD3D8Driver.cpp', 'CD3D8NormalMapRenderer.cpp', 'CD3D8ParallaxMapRenderer.cpp', 'CD3D8ShaderMaterialRenderer.cpp', 'CD3D8Texture.cpp', 'CD3D9Driver.cpp', 'CD3D9HLSLMaterialRenderer.cpp', 'CD3D9NormalMapRenderer.cpp', 'CD3D9ParallaxMapRenderer.cpp', 'CD3D9ShaderMaterialRenderer.cpp', 'CD3D9Texture.cpp'];
|
||||
|
||||
IRRIMAGEOBJ = ['CColorConverter.cpp', 'CImage.cpp', 'CImageLoaderBMP.cpp', 'CImageLoaderJPG.cpp', 'CImageLoaderPCX.cpp', 'CImageLoaderPNG.cpp', 'CImageLoaderPSD.cpp', 'CImageLoaderTGA.cpp', 'CImageLoaderPPM.cpp', 'CImageLoaderWAL.cpp', 'CImageWriterBMP.cpp', 'CImageWriterJPG.cpp', 'CImageWriterPCX.cpp', 'CImageWriterPNG.cpp', 'CImageWriterPPM.cpp', 'CImageWriterPSD.cpp', 'CImageWriterTGA.cpp'];
|
||||
|
||||
IRRVIDEOOBJ = ['CVideoModeList.cpp', 'CFPSCounter.cpp'] + IRRDRVROBJ + IRRIMAGEOBJ;
|
||||
|
||||
IRRSWRENDEROBJ = ['CSoftwareDriver.cpp', 'CSoftwareTexture.cpp', 'CTRFlat.cpp', 'CTRFlatWire.cpp', 'CTRGouraud.cpp', 'CTRGouraudWire.cpp', 'CTRTextureFlat.cpp', 'CTRTextureFlatWire.cpp', 'CTRTextureGouraud.cpp', 'CTRTextureGouraudAdd.cpp', 'CTRTextureGouraudNoZ.cpp', 'CTRTextureGouraudWire.cpp', 'CZBuffer.cpp', 'CTRTextureGouraudVertexAlpha2.cpp', 'CTRTextureGouraudNoZ2.cpp', 'CTRTextureLightMap2_M2.cpp', 'CTRTextureLightMap2_M4.cpp', 'CTRTextureLightMap2_M1.cpp', 'CSoftwareDriver2.cpp', 'CSoftwareTexture2.cpp', 'CTRTextureGouraud2.cpp', 'CTRGouraud2.cpp', 'CTRGouraudAlpha2.cpp', 'CTRGouraudAlphaNoZ2.cpp', 'CTRTextureDetailMap2.cpp', 'CTRTextureGouraudAdd2.cpp', 'CTRTextureGouraudAddNoZ2.cpp', 'CTRTextureWire2.cpp', 'CTRTextureLightMap2_Add.cpp', 'CTRTextureLightMapGouraud2_M4.cpp', 'IBurningShader.cpp', 'CTRTextureBlend.cpp', 'CTRTextureGouraudAlpha.cpp', 'CTRTextureGouraudAlphaNoZ.cpp', 'CDepthBuffer.cpp', 'CBurningShader_Raster_Reference.cpp'];
|
||||
|
||||
IRRIOOBJ = ['CFileList.cpp', 'CFileSystem.cpp', 'CLimitReadFile.cpp', 'CMemoryReadFile.cpp', 'CReadFile.cpp', 'CWriteFile.cpp', 'CXMLReader.cpp', 'CXMLWriter.cpp', 'CZipReader.cpp', 'CPakReader.cpp', 'CNPKReader.cpp', 'irrXML.cpp', 'CAttributes.cpp', 'lzma/LzmaDec.c'];
|
||||
|
||||
IRROTHEROBJ = ['CIrrDeviceSDL.cpp', 'CIrrDeviceLinux.cpp', 'CIrrDeviceStub.cpp', 'CIrrDeviceWin32.cpp', 'CLogger.cpp', 'COSOperator.cpp', 'Irrlicht.cpp', 'os.cpp'];
|
||||
|
||||
IRRGUIOBJ = ['CGUIButton.cpp', 'CGUICheckBox.cpp', 'CGUIComboBox.cpp', 'CGUIContextMenu.cpp', 'CGUIEditBox.cpp', 'CGUIEnvironment.cpp', 'CGUIFileOpenDialog.cpp', 'CGUIFont.cpp', 'CGUIImage.cpp', 'CGUIInOutFader.cpp', 'CGUIListBox.cpp', 'CGUIMenu.cpp', 'CGUIMeshViewer.cpp', 'CGUIMessageBox.cpp', 'CGUIModalScreen.cpp', 'CGUIScrollBar.cpp', 'CGUISpinBox.cpp', 'CGUISkin.cpp', 'CGUIStaticText.cpp', 'CGUITabControl.cpp', 'CGUITable.cpp', 'CGUIToolBar.cpp', 'CGUIWindow.cpp', 'CGUIColorSelectDialog.cpp', 'CDefaultGUIElementFactory.cpp', 'CGUISpriteBank.cpp'];
|
||||
|
||||
ZLIB_PREFIX = 'zlib/';
|
||||
ZLIBNAMES = ['adler32.c', 'compress.c', 'crc32.c', 'deflate.c', 'inffast.c', 'inflate.c', 'inftrees.c', 'trees.c', 'uncompr.c', 'zutil.c'];
|
||||
ZLIBOBJ = [];
|
||||
for fileName in ZLIBNAMES:
|
||||
ZLIBOBJ += [ZLIB_PREFIX + fileName];
|
||||
|
||||
JPEGLIB_PREFIX = 'jpeglib/';
|
||||
JPEGLIBNAMES = ['jaricom.c', 'jcapimin.c', 'jcapistd.c', 'jcarith.c', 'jccoefct.c', 'jccolor.c', 'jcdctmgr.c', 'jchuff.c', 'jcinit.c', 'jcmainct.c', 'jcmarker.c', 'jcmaster.c', 'jcomapi.c', 'jcparam.c', 'jcprepct.c', 'jcsample.c', 'jctrans.c', 'jdapimin.c', 'jdapistd.c', 'jdarith.c', 'jdatadst.c', 'jdatasrc.c', 'jdcoefct.c', 'jdcolor.c', 'jddctmgr.c', 'jdhuff.c', 'jdinput.c', 'jdmainct.c', 'jdmarker.c', 'jdmaster.c', 'jdmerge.c', 'jdpostct.c', 'jdsample.c', 'jdtrans.c', 'jerror.c', 'jfdctflt.c', 'jfdctfst.c', 'jfdctint.c', 'jidctflt.c', 'jidctfst.c', 'jidctint.c', 'jmemmgr.c', 'jmemnobs.c', 'jquant1.c', 'jquant2.c', 'jutils.c'];
|
||||
JPEGLIBOBJ = [];
|
||||
for fileName in JPEGLIBNAMES:
|
||||
JPEGLIBOBJ += [JPEGLIB_PREFIX + fileName];
|
||||
|
||||
LIBPNG_PREFIX = 'libpng/';
|
||||
LIBPNGNAMES = ['png.c', 'pngerror.c', 'pngget.c', 'pngmem.c', 'pngpread.c', 'pngread.c', 'pngrio.c', 'pngrtran.c', 'pngrutil.c', 'pngset.c', 'pngtrans.c', 'pngwio.c', 'pngwrite.c', 'pngwtran.c', 'pngwutil.c'];
|
||||
LIBPNGOBJ = [];
|
||||
for fileName in LIBPNGNAMES:
|
||||
LIBPNGOBJ += [LIBPNG_PREFIX + fileName];
|
||||
|
||||
AESGLADMAN_PREFIX = 'aesGladman/';
|
||||
AESGLADMANNAMES = ['aescrypt.cpp', 'aeskey.cpp', 'aestab.cpp', 'fileenc.cpp', 'hmac.cpp', 'prng.cpp', 'pwd2key.cpp', 'sha1.cpp', 'sha2.cpp'];
|
||||
AESGLADMANOBJ = [];
|
||||
for fileName in AESGLADMANNAMES:
|
||||
AESGLADMANOBJ += [AESGLADMAN_PREFIX + fileName];
|
||||
|
||||
BZIP2_PREFIX = 'bzip2/';
|
||||
BZIP2NAMES = ['blocksort.c', 'bzcompress.c', 'bzlib.c', 'crctable.c', 'decompress.c', 'huffman.c', 'randtable.c'];
|
||||
BZIP2OBJ = [];
|
||||
for fileName in BZIP2NAMES:
|
||||
BZIP2OBJ += [BZIP2_PREFIX + fileName];
|
||||
|
||||
# Next variable is for additional scene nodes etc. of customized Irrlicht versions
|
||||
EXTRAOBJ = [];
|
||||
|
||||
LINKOBJ = IRRMESHOBJ + IRROBJ + IRRPARTICLEOBJ + IRRANIMOBJ + IRRVIDEOOBJ + IRRSWRENDEROBJ + IRRIOOBJ + IRROTHEROBJ + IRRGUIOBJ + ZLIBOBJ + JPEGLIBOBJ + LIBPNGOBJ + AESGLADMANOBJ + EXTRAOBJ;
|
||||
|
||||
env.Append(LIBS = LIBRARIES, LIBPATH = CXXINCS);
|
||||
|
||||
CXXFLAGS = ['-Wall'];
|
||||
if NDEBUG:
|
||||
CXXFLAGS += ['-fexpensive-optimizations', '-O3'];
|
||||
else:
|
||||
CXXFLAGS += ['-g', '-D_DEBUG'];
|
||||
|
||||
if PROFILE:
|
||||
CXXFLAGS += ['-pg'];
|
||||
|
||||
CXXFLAGS += ['-DPNG_NO_MMX_CODE', '-DPNG_NO_MNG_FEATURES', '-DIRRLICHT_EXPORTS=1', '-D_IRR_STATIC_LIB_'];
|
||||
if USE_GCC:
|
||||
CXXFLAGS += ['-D__GNUWIN32__=1'];
|
||||
|
||||
env.Append(CCFLAGS = CXXFLAGS);
|
||||
|
||||
IrrlichtLibrary = env.SharedLibrary("Irrlicht.dll", LINKOBJ);
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, re, subprocess, tempfile, zipfile
|
||||
import SCons.Errors
|
||||
|
||||
|
||||
# === function for build environment object =========================================================================
|
||||
|
||||
# creating a resource file for suppress long-line-error
|
||||
# @param env environment object
|
||||
# @param sources list files (should be absoute path names)
|
||||
def ResourceFile(env, list) :
|
||||
(fd, resource) = tempfile.mkstemp(".res", text=True)
|
||||
for i in list :
|
||||
os.write (fd, "%s\n" % str(i).replace("\\", "\\\\"))
|
||||
os.close(fd)
|
||||
return env.get("TEMPFILEPREFIX", "") + resource
|
||||
|
||||
|
||||
def zipbetter(target, source, env):
|
||||
compression = env.get('ZIPCOMPRESSION', 0)
|
||||
zf = zipfile.ZipFile(str(target[0]), 'w', compression)
|
||||
for s in source:
|
||||
if s.isdir():
|
||||
for dirpath, dirnames, filenames in os.walk(str(s)):
|
||||
for fname in filenames:
|
||||
path = os.path.join(dirpath, fname)
|
||||
if os.path.isfile(path):
|
||||
zf.write(path, os.path.relpath(path, env.get("ZIPROOT", "")))
|
||||
else:
|
||||
zf.write(str(s), os.path.relpath(str(s), env.get("ZIPROOT", "")))
|
||||
zf.close()
|
||||
|
||||
|
||||
# creates the global build object
|
||||
# @return build object
|
||||
def createEnvironment() :
|
||||
directxdir = ""
|
||||
if "DXSDK_DIR" in os.environ :
|
||||
directxdir = os.environ["DXSDK_DIR"]
|
||||
|
||||
vars = Variables()
|
||||
vars.Add(PathVariable("installdir", "install directory for the library", os.path.join("bin"), PathVariable.PathIsDirCreate))
|
||||
vars.Add(EnumVariable("buildtarget", "type of the library", "shared", allowed_values=("shared", "static")))
|
||||
vars.Add(EnumVariable("buildtype", "name of target build type", "release", allowed_values=("debug", "release")))
|
||||
vars.Add(EnumVariable("platform", "build platform", "", allowed_values=("", "linux", "osx-library", "osx-framework", "win32-mingw", "win32-msvc", "win64-msvc")))
|
||||
vars.Add(BoolVariable("package", "creates of the compiled library a package (header & binary) as a zip file", False))
|
||||
|
||||
vars.Add(BoolVariable("opengl", "build with Open GL support", True))
|
||||
vars.Add(PathVariable("directxsdk", "directory of the Direct X SDK (joystick support is disabled by default)", directxdir, PathVariable.PathAccept))
|
||||
|
||||
# set the correct build toolkit (and a own process spawn)
|
||||
env = Environment(tools = [], variables=vars)
|
||||
Help(vars.GenerateHelpText(env))
|
||||
env["ResourceFile"] = ResourceFile
|
||||
|
||||
if env["package"] :
|
||||
zipbetter_bld = Builder(action = zipbetter, target_factory = SCons.Node.FS.default_fs.Entry, source_factory = SCons.Node.FS.default_fs.Entry)
|
||||
env.Append(BUILDERS = {'ZipBetter' : zipbetter_bld})
|
||||
|
||||
if env["platform"] in ["linux", "osx-library", "osx-framework"] :
|
||||
env.Tool("default")
|
||||
|
||||
elif env["platform"] in ["win32-msvc", "win64-mvc"] :
|
||||
env.Tool("msvc")
|
||||
env.Tool("mslink")
|
||||
env.Tool("msvs")
|
||||
env.Tool("mssdk")
|
||||
|
||||
elif env["platform"] in ["win32-mingw", "win64-mingw"] :
|
||||
env.Tool("mingw")
|
||||
|
||||
else :
|
||||
raise SCons.Errors.StopError("platform is not set")
|
||||
|
||||
# check parameter
|
||||
if env["buildtarget"] == "static" and env["platform"] == "osx-framework" :
|
||||
raise SCons.Errors.StopError("static library can not be build with the an osx framework")
|
||||
if env["buildtype"] == "debug" and env["platform"] == "osx-framework" :
|
||||
raise SCons.Errors.StopError("debug library can not be build with the an osx framework")
|
||||
|
||||
# set constants and global values (directory names are relative to the SConstruct)
|
||||
# read first Irrlicht SDK version from the file include/IrrCompileConfig.h
|
||||
irrlichtversion = None
|
||||
try :
|
||||
configfile = open( os.path.join("include", "IrrCompileConfig.h"), "r" )
|
||||
irrlichtversion = re.search("#define(.*)IRRLICHT_SDK_VERSION(.*)", configfile.read())
|
||||
configfile.close()
|
||||
except :
|
||||
pass
|
||||
if irrlichtversion == None :
|
||||
raise SCons.Errors.StopError("can not find Irrlicht SDK version in the configuration header")
|
||||
|
||||
env["irr_libversion"] = irrlichtversion.group(2).replace("\"", "").strip()
|
||||
env["irr_libinstallname"] = "Irrlicht"
|
||||
env["irr_osxframeworkname"] = env["irr_libinstallname"]
|
||||
env["irr_srcexamples"] = "examples"
|
||||
env["irr_srclibrary"] = os.path.join("source", "Irrlicht")
|
||||
if env["buildtype"] == "debug" :
|
||||
env["irr_libinstallname"] = env["irr_libinstallname"] + "Debug"
|
||||
|
||||
if "CXX" in os.environ :
|
||||
env.Replace(CXX = os.environ["CXX"])
|
||||
if "CC" in os.environ :
|
||||
env.Replace(CC = os.environ["CC"])
|
||||
if "CPPPATH" in os.environ :
|
||||
env.AppendUnique(CPPPATH = os.environ["CPPPATH"].split(os.pathsep))
|
||||
if "CXXFLAGS" in os.environ :
|
||||
env.AppendUnique(CXXFLAGS = os.environ["CXXFLAGS"].split(" "))
|
||||
if "LIBRARY_PATH" in os.environ :
|
||||
env.AppendUnique(CIBPATH = os.environ["LIBRARY_PATH"].split(os.pathsep))
|
||||
if "LDFLAGS" in os.environ :
|
||||
env.AppendUnique(LINKFLAGS = os.environ["LDFLAGS"].split(" "))
|
||||
|
||||
return env
|
||||
|
||||
|
||||
# creates a build object for the library,
|
||||
# and sets the platform specific build data
|
||||
# @param env build object
|
||||
# @return cloned build object with library specific data
|
||||
def getLibraryBuildEnvironment(env) :
|
||||
envlib = env.Clone()
|
||||
|
||||
# define global options
|
||||
envlib.AppendUnique(CPPPATH = ["include", envlib["irr_srclibrary"], os.path.join(envlib["irr_srclibrary"], "zlib"), os.path.join(envlib["irr_srclibrary"], "jpeglib"), os.path.join(envlib["irr_srclibrary"], "libpng")])
|
||||
envlib.AppendUnique(CPPDEFINES = ["IRRLICHT_EXPORTS"])
|
||||
if envlib["buildtype"] == "debug" :
|
||||
envlib.AppendUnique(CPPDEFINES = ["_DEBUG"])
|
||||
|
||||
# define platform specific options
|
||||
if envlib["platform"] in ["osx-library", "osx-framework"] :
|
||||
libname = envlib["LIBPREFIX"] + envlib["irr_libinstallname"] + "." + envlib["irr_libversion"] + envlib["SHLIBSUFFIX"]
|
||||
|
||||
envlib.AppendUnique(CPPPATH = [os.path.join(envlib["irr_srclibrary"], "MacOSX")])
|
||||
envlib.AppendUnique(LINKFLAGS = ["-Wl,-framework,Cocoa", "-Wl,-framework,IOKit", "-Wl,-install_name,"+libname])
|
||||
|
||||
if envlib["buildtype"] == "debug" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
elif envlib["buildtype"] == "release" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
|
||||
configOpenGL(envlib)
|
||||
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
|
||||
|
||||
|
||||
elif envlib["platform"] == "linux" :
|
||||
libname = envlib["LIBPREFIX"] + envlib["irr_libinstallname"] + envlib["SHLIBSUFFIX"] + "." + envlib["irr_libversion"]
|
||||
|
||||
envlib.AppendUnique(LIBS = ["Xxf86vm"])
|
||||
envlib.AppendUnique(LINKFLAGS = ["-Wl,--soname="+libname])
|
||||
if envlib["buildtype"] == "debug" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
elif envlib["buildtype"] == "release" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
|
||||
configOpenGL(envlib)
|
||||
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
|
||||
|
||||
|
||||
elif envlib["platform"] in ["win32-mingw", "win64-mingw"] :
|
||||
# for suppress the too-long-line error, we use a temporary file on the linker source list
|
||||
envlib["SHLINKCOM"] = "$SHLINK -o $TARGET $SHLINKFLAGS ${ResourceFile(__env__, SOURCES.abspath)} $_LIBDIRFLAGS $_LIBFLAGS"
|
||||
envlib["ARCOM"] = "$AR $ARFLAGS $TARGET ${ResourceFile(__env__, SOURCES.abspath)}"
|
||||
|
||||
# on MinGW we create a DLL, which can be used by other toolchains (we need the std-alias, the kill-flag and the out-implib option)
|
||||
envlib.AppendUnique(LINKFLAGS = ["-Wl,--add-stdcall-alias", "-Wl,--kill-at", "-Wl,--out-implib,"+envlib["LIBPREFIX"]+env["irr_libinstallname"]+envlib["LIBSUFFIX"]])
|
||||
envlib.AppendUnique(LIBS = ["winmm", "gdi32"])
|
||||
|
||||
if envlib["buildtype"] == "debug" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
elif envlib["buildtype"] == "release" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
|
||||
configOpenGL(envlib)
|
||||
configDirectX(envlib)
|
||||
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
|
||||
|
||||
|
||||
elif envlib["platform"] in ["win32-msvc", "win64-msvc"] :
|
||||
envlib.AppendUnique(CXXFLAGS = ["/analyze", "/Gd", "/GF", "/GR-", "/GS", "/Gy", "/Zl"])
|
||||
envlib.AppendUnique(LINKFLAGS = ["/VERSION:\""+envlib["irr_libversion"]+"\"", "/nologo"])
|
||||
envlib.AppendUnique(LIBS = ["gdi32.lib", "user32.lib", "advapi32.lib"])
|
||||
|
||||
if envlib["buildtype"] == "debug" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["-Wall", "/MTd", "/RTC1", "/Zi"])
|
||||
elif envlib["buildtype"] == "release" :
|
||||
envlib.AppendUnique(CXXFLAGS = ["/GL", "/MT", "/Ox"])
|
||||
envlib.AppendUnique(LINKFLAGS = ["/SUBSYSTEM:WINDOWS", "/OPT:REF", "/LTCG"])
|
||||
configOpenGL(envlib)
|
||||
configDirectX(envlib)
|
||||
|
||||
|
||||
return envlib
|
||||
|
||||
|
||||
# define Open GL support (OSX needs always the OpenGL framework)
|
||||
# @param library environment
|
||||
def configOpenGL(envlib) :
|
||||
if not envlib["opengl"] :
|
||||
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_OPENGL_"])
|
||||
|
||||
if envlib["platform"] in ["osx-library", "osx-framework"] :
|
||||
envlib.AppendUnique(LINKFLAGS = ["-Wl,-framework,OpenGL"])
|
||||
|
||||
elif envlib["opengl"] and envlib["platform"] == "linux" :
|
||||
envlib.AppendUnique(LIBS = ["GL"])
|
||||
|
||||
elif envlib["opengl"] and envlib["platform"] in ["win32-mingw", "win64-mingw", "win32-msvc", "win64-msvc"] :
|
||||
envlib.AppendUnique(LIBS = ["opengl32"])
|
||||
|
||||
|
||||
|
||||
# define Direct X 9 support ( Direct X 8 is disabled by the SDK )
|
||||
# @param library environment
|
||||
def configDirectX(envlib) :
|
||||
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_DIRECT3D_8_", "NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_"])
|
||||
|
||||
if os.path.exists(env["directxsdk"]) :
|
||||
envlib.AppendUnique(CPPPATH = [os.path.join(envlib["directxsdk"], "Include")])
|
||||
envlib.AppendUnique(CPPDEFINES = ["IRR_COMPILE_WITH_DX9_DEV_PACK"])
|
||||
envlib.AppendUnique(LIBS = ["d3dx9"])
|
||||
if "win32" in envlib["platform"] :
|
||||
envlib.AppendUnique(LIBPATH = [os.path.join(envlib["directxsdk"], "Lib", "x86")])
|
||||
elif "win64" in envlib["platform"] :
|
||||
envlib.AppendUnique(LIBPATH = [os.path.join(envlib["directxsdk"], "Lib", "x84")])
|
||||
else :
|
||||
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_DIRECT3D_9_"])
|
||||
|
||||
|
||||
# creates a build object for the examples,
|
||||
# and sets the platform specific build data
|
||||
# @param env build object
|
||||
# @return cloned build object with example specific data
|
||||
def getExampleBuildEnvironment(env) :
|
||||
envexamples = env.Clone()
|
||||
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(CPPDEFINES = ["_DEBUG"])
|
||||
|
||||
# define platform specific data
|
||||
if envexamples["platform"] in ["osx-library", "osx-framework"] :
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
elif envexamples["buildtype"] == "release" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
|
||||
|
||||
if envexamples["platform"] == "osx-framework" :
|
||||
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "Irrlicht.framework", "Headers")])
|
||||
envexamples.AppendUnique(LINKFLAGS = ["-Wl,-framework,Irrlicht", "-Wl,-F"+env["installdir"]])
|
||||
else :
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
|
||||
elif envexamples["buildtype"] == "release" :
|
||||
envexamples.AppendUnique(LIBS = ["Irrlicht"])
|
||||
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
|
||||
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
|
||||
|
||||
|
||||
elif envexamples["platform"] == "linux" :
|
||||
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
|
||||
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
|
||||
elif envexamples["buildtype"] == "release" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
|
||||
envexamples.AppendUnique(LIBS = ["Irrlicht"])
|
||||
|
||||
|
||||
elif envexamples["platform"] in ["win32-mingw", "win64-mingw"] :
|
||||
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
|
||||
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
|
||||
envexamples.AppendUnique(LIBS = ["Irrlicht", "gdi32", "opengl32"])
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
|
||||
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
|
||||
elif envexamples["buildtype"] == "release" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
|
||||
envexamples.AppendUnique(LIBS = ["Irrlicht"])
|
||||
|
||||
|
||||
elif envexamples["platform"] in ["win32-msvc", "win64-msvc"] :
|
||||
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
|
||||
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
|
||||
envexamples.AppendUnique(LINKFLAGS = ["/nologo"])
|
||||
envexamples.AppendUnique(CXXFLAGS = ["/analyze", "/Gd", "/GF", "/GR-", "/GS", "/Gy"])
|
||||
envexamples.AppendUnique(LIBS = [ "user32", "gdi32", "opengl32"])
|
||||
if envexamples["buildtype"] == "debug" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "/MTd", "/RTC1", "/Zi"])
|
||||
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
|
||||
elif envexamples["buildtype"] == "release" :
|
||||
envexamples.AppendUnique(CXXFLAGS = ["/GL", "/MT", "/Ox"])
|
||||
envexamples.AppendUnique(LINKFLAGS = ["/SUBSYSTEM:CONSOLE", "/OPT:REF", "/LTCG"])
|
||||
envexamples.AppendUnique(LIBS = ["Irrlicht"])
|
||||
|
||||
return envexamples
|
||||
|
||||
|
||||
# runs the installation process
|
||||
# @param env environment object
|
||||
# @param lib build library object
|
||||
# @param header headerfile list
|
||||
def installLibrary(env, lib, header) :
|
||||
install = []
|
||||
if lib and type(lib) == type([]) :
|
||||
lib = lib[0]
|
||||
libname = str(lib).replace("']", "").replace("['", "")
|
||||
|
||||
|
||||
if env["platform"] in ["linux", "osx-library"] :
|
||||
if env["platform"] == "osx-library" :
|
||||
versionname = libname.replace(env["SHLIBSUFFIX"], "") + "." + env["irr_libversion"] + env["SHLIBSUFFIX"]
|
||||
elif env["platform"] == "linux" :
|
||||
versionname = libname + "." + env["irr_libversion"]
|
||||
|
||||
install.append(env.Install( os.path.join(env["installdir"], "lib"), lib ))
|
||||
for i in header :
|
||||
install.append(env.Command( os.path.join(env["installdir"], "include", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
|
||||
if env["buildtarget"] == "shared" :
|
||||
install.append( env.Command(os.path.join(env["installdir"], "lib", versionname), os.path.basename(libname), "ln -s $SOURCE $TARGET") )
|
||||
|
||||
|
||||
elif env["platform"] == "osx-framework" :
|
||||
framework = os.path.join(env["installdir"], env["irr_osxframeworkname"]+".framework")
|
||||
|
||||
data = []
|
||||
data.append(env.Install( os.path.join(framework, "Versions", env["irr_libversion"], "Libraries"), lib ))
|
||||
for i in header :
|
||||
data.append(env.Command( os.path.join(framework, "Versions", env["irr_libversion"], "Headers", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
|
||||
|
||||
# remove existing links and create new ones
|
||||
install.append( env.Command(os.path.join(framework, "Irrlicht"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Libraries", os.path.basename(libname))+" $TARGET") )
|
||||
install.append( env.Command(os.path.join(framework, "Libraries"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Libraries")+" $TARGET") )
|
||||
install.append( env.Command(os.path.join(framework, "Headers"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Headers")+" $TARGET") )
|
||||
install.append( env.Command(os.path.join(framework, "Versions", "Current"), data, "rm -f $TARGET && ln -s "+os.path.join(env["irr_libversion"])+" $TARGET") )
|
||||
|
||||
|
||||
elif env["platform"] in ["win32-mingw", "win64-mingw", "win32-msvc", "win64-msvc"] :
|
||||
install.append(env.Install( os.path.join(env["installdir"], "lib"), lib ))
|
||||
for i in header :
|
||||
install.append(env.Command( os.path.join(env["installdir"], "include", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
|
||||
|
||||
|
||||
# create a package
|
||||
if env["package"] :
|
||||
nameparts = [env["platform"], env["buildtarget"], env["irr_libversion"], env["buildtype"]]
|
||||
install = env.ZipBetter( os.path.join("bin", "irrlicht-"+"-".join(nameparts)+env['ZIPSUFFIX']), install, ZIPROOT=env["installdir"])
|
||||
|
||||
NoClean(install)
|
||||
Default(install)
|
||||
|
||||
# ===================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ===================================================================================================================
|
||||
# === create build commands =========================================================================================
|
||||
env = createEnvironment()
|
||||
envlib = getLibraryBuildEnvironment(env)
|
||||
envexamples = getExampleBuildEnvironment(env)
|
||||
|
||||
|
||||
# === set the sources (we use similar structure of the Makefile) ====================================================
|
||||
# get all header files (for later installation)
|
||||
headers = Glob(os.path.join("include", "*.h"))
|
||||
|
||||
# library sources (libjpeg & bzip2 added manually, because not all files are needed)
|
||||
libjpeg = [ os.path.join(env["irr_srclibrary"], "jpeglib", i) for i in ["jcapimin.c", "jcapistd.c", "jccoefct.c", "jccolor.c", "jcdctmgr.c", "jchuff.c", "jcinit.c", "jcmainct.c", "jcmarker.c", "jcmaster.c", "jcomapi.c", "jcparam.c", "jcprepct.c", "jcsample.c", "jctrans.c", "jdapimin.c", "jdapistd.c", "jdatadst.c", "jdatasrc.c", "jdcoefct.c", "jdcolor.c", "jddctmgr.c", "jdhuff.c", "jdinput.c", "jdmainct.c", "jdmarker.c", "jdmaster.c", "jdmerge.c", "jdpostct.c", "jdsample.c", "jdtrans.c", "jerror.c", "jfdctflt.c", "jfdctfst.c", "jfdctint.c", "jidctflt.c", "jidctfst.c", "jidctint.c", "jmemmgr.c", "jmemnobs.c", "jquant1.c", "jquant2.c", "jutils.c", "jcarith.c", "jdarith.c", "jaricom.c"] ]
|
||||
libbzip2 = [ os.path.join(env["irr_srclibrary"], "bzip2", i) for i in ["blocksort.c", "huffman.c", "crctable.c", "randtable.c", "bzcompress.c", "decompress.c", "bzlib.c"] ]
|
||||
|
||||
srclibrary = Glob(os.path.join(env["irr_srclibrary"], "*.cpp")) + Glob(os.path.join(env["irr_srclibrary"], "libpng", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "lzma", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "zlib", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "aesGladman", "*.cpp")) + libjpeg + libbzip2
|
||||
|
||||
if "osx" in env["platform"] :
|
||||
srclibrary.extend(Glob(os.path.join(envlib["irr_srclibrary"], "MacOSX", "*.mm")))
|
||||
|
||||
|
||||
# sources of the examples
|
||||
srcexamples = ["01.HelloWorld", "02.Quake3Map", "03.CustomSceneNode", "04.Movement", "05.UserInterface", "06.2DGraphics", "07.Collision", "08.SpecialFX", "09.Meshviewer", "10.Shaders", "11.PerPixelLighting", "12.TerrainRendering", "13.RenderToTexture", "15.LoadIrrFile", "16.Quake3MapShader", "17.HelloWorld_Mobile", "18.SplitScreen", "19.MouseAndJoystick", "20.ManagedLights", "22.MaterialViewer", "23.SMeshHandling", "24.CursorControl", "25.XmlHandling", "26.OcclusionQuery"]
|
||||
if "win" in env["platform"] :
|
||||
srcexamples.append("14.Win32Window")
|
||||
# ===================================================================================================================
|
||||
|
||||
|
||||
|
||||
# === build and install =============================================================================================
|
||||
if env["buildtarget"] == "shared" :
|
||||
lib = envlib.SharedLibrary(env["irr_libinstallname"], srclibrary)
|
||||
elif env["buildtarget"] == "static" :
|
||||
lib = envlib.StaticLibrary(env["irr_libinstallname"], srclibrary)
|
||||
|
||||
|
||||
|
||||
# build examples
|
||||
examples = []
|
||||
for i in srcexamples :
|
||||
examples.append( envexamples.Program( os.path.join("bin", "examples-"+envlib["platform"], i.replace(".", "_")), os.path.join(env["irr_srcexamples"], i, "main.cpp")) )
|
||||
|
||||
|
||||
installLibrary(env, lib, headers)
|
||||
NoClean(examples)
|
||||
Alias("examples", examples)
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ bool binaryCompareFiles(const char * fileName1, const char * fileName2)
|
|||
|
||||
bool xmlCompareFiles(irr::io::IFileSystem * fs, const char * fileName1, const char * fileName2)
|
||||
{
|
||||
if(!fileName1 || !fileName2)
|
||||
if (!fileName1 || !fileName2)
|
||||
return false;
|
||||
|
||||
io::IXMLReaderUTF8* reader1 = fs->createXMLReaderUTF8(fileName1);
|
||||
|
@ -267,7 +267,7 @@ static float fuzzyCompareImages(irr::video::IImage * image1,
|
|||
}
|
||||
|
||||
video::ECOLOR_FORMAT format1 = image1->getColorFormat();
|
||||
if(video::ECF_A8R8G8B8 != format1 && video::ECF_R8G8B8 != format1)
|
||||
if (video::ECF_A8R8G8B8 != format1 && video::ECF_R8G8B8 != format1)
|
||||
{
|
||||
logTestString("fuzzyCompareImages: image 1 must be ECF_AR8G8B8 or ECF_R8G8B8\n");
|
||||
return 0.f;
|
||||
|
@ -287,14 +287,14 @@ static float fuzzyCompareImages(irr::video::IImage * image1,
|
|||
u32 mismatchedColours = 0;
|
||||
for (u32 pixel = 0; pixel < pixels; ++pixel)
|
||||
{
|
||||
if(video::ECF_A8R8G8B8 == format1)
|
||||
if (video::ECF_A8R8G8B8 == format1)
|
||||
image1Data++;
|
||||
|
||||
const u8 r1 = *(image1Data++);
|
||||
const u8 g1 = *(image1Data++);
|
||||
const u8 b1 = *(image1Data++);
|
||||
|
||||
if(video::ECF_A8R8G8B8 == format2)
|
||||
if (video::ECF_A8R8G8B8 == format2)
|
||||
image2Data++;
|
||||
|
||||
const u8 r2 = *(image2Data++);
|
||||
|
@ -342,17 +342,17 @@ void stabilizeScreenBackground(irr::video::IVideoDriver * driver,
|
|||
driver->endScene();
|
||||
|
||||
irr::video::IImage * screenshot = driver->createScreenShot();
|
||||
if(!screenshot)
|
||||
if (!screenshot)
|
||||
return;
|
||||
|
||||
const video::ECOLOR_FORMAT format = screenshot->getColorFormat();
|
||||
if(format != video::ECF_R8G8B8)
|
||||
if (format != video::ECF_R8G8B8)
|
||||
{
|
||||
irr::video::IImage * fixedScreenshot = driver->createImage(video::ECF_R8G8B8, screenshot->getDimension());
|
||||
screenshot->copyTo(fixedScreenshot);
|
||||
screenshot->drop();
|
||||
|
||||
if(!fixedScreenshot)
|
||||
if (!fixedScreenshot)
|
||||
return;
|
||||
|
||||
screenshot = fixedScreenshot;
|
||||
|
@ -368,14 +368,14 @@ void stabilizeScreenBackground(irr::video::IVideoDriver * driver,
|
|||
const u8 g = *(image1Data++);
|
||||
const u8 b = *(image1Data++);
|
||||
|
||||
if(r != color.getRed() || g != color.getGreen() || b != color.getBlue())
|
||||
if (r != color.getRed() || g != color.getGreen() || b != color.getBlue())
|
||||
{
|
||||
status = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(status)
|
||||
if (status)
|
||||
{
|
||||
screenshot->drop();
|
||||
return;
|
||||
|
@ -391,9 +391,9 @@ irr::core::stringc shortDriverName(irr::video::IVideoDriver * driver)
|
|||
// For OpenGL and Burning, chop the version number out. Other drivers have more stable version numbers.
|
||||
// TA: Sorry Rogerborg. burnings video also has the version number inside;-)
|
||||
// maybe you sould take the getDriverType Info for this
|
||||
if(driverName.find("OpenGL") > -1)
|
||||
if (driverName.find("OpenGL") > -1)
|
||||
driverName = "OpenGL";
|
||||
else if(driverName.find("Burning's Video") > -1)
|
||||
else if (driverName.find("Burning's Video") > -1)
|
||||
driverName = "Burning's Video";
|
||||
|
||||
return driverName;
|
||||
|
@ -434,7 +434,7 @@ bool takeScreenshotAndCompareAgainstReference(irr::video::IVideoDriver * driver,
|
|||
referenceFilename += driverName;
|
||||
referenceFilename += fileName;
|
||||
irr::video::IImage * reference = driver->createImageFromFile(referenceFilename.c_str());
|
||||
if(!reference)
|
||||
if (!reference)
|
||||
{
|
||||
logTestString("\n*** Failed to load reference image '%s'\n*** Creating from screenshot - please check this image.\n\n",
|
||||
referenceFilename.c_str());
|
||||
|
@ -468,13 +468,13 @@ bool openTestLog(bool startNewLog, const char * filename)
|
|||
{
|
||||
closeTestLog();
|
||||
|
||||
if(startNewLog)
|
||||
if (startNewLog)
|
||||
logFile = fopen(filename, "w");
|
||||
else
|
||||
logFile = fopen(filename, "a");
|
||||
|
||||
assert(logFile);
|
||||
if(!logFile)
|
||||
if (!logFile)
|
||||
logTestString("\nWARNING: unable to open the test log file %s\n", filename);
|
||||
|
||||
return (logFile != 0);
|
||||
|
@ -511,7 +511,7 @@ void logTestString(const char * format, ...)
|
|||
#endif
|
||||
|
||||
(void)printf(logString);
|
||||
if(logFile)
|
||||
if (logFile)
|
||||
{
|
||||
(void)fprintf(logFile, logString);
|
||||
(void)fflush(logFile);
|
||||
|
|
Loading…
Reference in New Issue