Commit 45a8e00f authored by cutealien's avatar cutealien

Fix a bunch of warnings (mostly about constructor initializer order)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4479 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5f4c2795
......@@ -15,7 +15,7 @@ namespace video
//! Constructor of empty image
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
:Data(0), Size(size), Format(format), DeleteMemory(true), IsCompressed(false), HasMipMaps(false)
:Data(0), Size(size), Format(format), IsCompressed(false), HasMipMaps(false), DeleteMemory(true)
{
initData();
}
......@@ -24,7 +24,7 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
//! Constructor from raw data
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* data,
bool ownForeignMemory, bool deleteForeignMemory, bool compressed, bool mipMaps)
: Data(0), Size(size), Format(format), DeleteMemory(deleteForeignMemory), IsCompressed(compressed), HasMipMaps(mipMaps)
: Data(0), Size(size), Format(format), IsCompressed(compressed), HasMipMaps(mipMaps), DeleteMemory(deleteForeignMemory)
{
if (ownForeignMemory)
{
......
......@@ -505,11 +505,11 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceLinux* device)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
BridgeCalls(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), CurrentRendertargetSize(0,0),
ColorFormat(ECF_R8G8B8), CurrentTarget(ERT_FRAME_BUFFER), Params(params),
BridgeCalls(0), X11Device(device), DeviceType(EIDT_X11)
X11Device(device), DeviceType(EIDT_X11)
{
#ifdef _DEBUG
setDebugName("COpenGLDriver");
......@@ -625,7 +625,7 @@ COpenGLDriver::~COpenGLDriver()
if (CgContext)
cgDestroyContext(CgContext);
#endif
if (BridgeCalls)
delete BridgeCalls;
......@@ -685,10 +685,10 @@ bool COpenGLDriver::genericDriverInit()
CurrentTexture.clear();
// load extensions
initExtensions(Params.Stencilbuffer);
if (!BridgeCalls)
BridgeCalls = new COpenGLCallBridge(this);
if (queryFeature(EVDF_ARB_GLSL))
{
char buf[32];
......@@ -764,7 +764,7 @@ bool COpenGLDriver::genericDriverInit()
Quad2DIndices[3] = 0;
Quad2DIndices[4] = 1;
Quad2DIndices[5] = 2;
Line2DIndices[0] = 0;
Line2DIndices[1] = 1;
......@@ -2505,7 +2505,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();
......@@ -3362,7 +3362,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
// be sure to leave in texture stage 0
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)
{
......@@ -3588,7 +3588,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
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
......@@ -5088,19 +5088,19 @@ const SMaterial& COpenGLDriver::getCurrentMaterial() const
{
return Material;
}
COpenGLCallBridge* COpenGLDriver::getBridgeCalls() const
{
return BridgeCalls;
}
#ifdef _IRR_COMPILE_WITH_CG_
const CGcontext& COpenGLDriver::getCgContext()
{
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),
......@@ -5125,19 +5125,19 @@ COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver),
glCullFace(GL_BACK);
glDisable(GL_CULL_FACE);
glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW);
if(Driver->MultiTextureExtension)
{
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
Driver->extGlClientActiveTexture(GL_TEXTURE0_ARB);
}
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_VERTEX_ARRAY);
......@@ -5165,7 +5165,7 @@ void COpenGLCallBridge::setAlphaTest(bool enable)
glEnable(GL_ALPHA_TEST);
else
glDisable(GL_ALPHA_TEST);
AlphaTest = enable;
}
}
......@@ -5189,7 +5189,7 @@ void COpenGLCallBridge::setBlend(bool enable)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
Blend = enable;
}
}
......@@ -5244,7 +5244,7 @@ void COpenGLCallBridge::setCullFaceFunc(GLenum mode)
if(CullFaceMode != mode)
{
glCullFace(mode);
CullFaceMode = mode;
}
}
......@@ -5257,7 +5257,7 @@ void COpenGLCallBridge::setCullFace(bool enable)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
CullFace = enable;
}
}
......@@ -5267,11 +5267,11 @@ void COpenGLCallBridge::setDepthFunc(GLenum mode)
if(DepthFunc != mode)
{
glDepthFunc(mode);
DepthFunc = mode;
}
}
void COpenGLCallBridge::setDepthMask(bool enable)
{
if(DepthMask != enable)
......@@ -5280,7 +5280,7 @@ void COpenGLCallBridge::setDepthMask(bool enable)
glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
DepthMask = enable;
}
}
......@@ -5293,11 +5293,11 @@ void COpenGLCallBridge::setDepthTest(bool enable)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
DepthTest = enable;
}
}
void COpenGLCallBridge::setMatrixMode(GLenum mode)
{
if (MatrixMode != mode)
......@@ -5306,7 +5306,7 @@ void COpenGLCallBridge::setMatrixMode(GLenum mode)
MatrixMode = mode;
}
}
void COpenGLCallBridge::setActiveTexture(GLenum texture)
{
if (Driver->MultiTextureExtension && ActiveTexture != texture)
......@@ -5324,7 +5324,7 @@ void COpenGLCallBridge::setClientActiveTexture(GLenum texture)
ClientActiveTexture = texture;
}
}
void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline)
{
if (stage < MATERIAL_MAX_TEXTURES)
......@@ -5342,7 +5342,7 @@ void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline)
}
else if(fixedPipeline)
glDisable(GL_TEXTURE_2D);
TextureFixedPipeline[stage] = fixedPipeline;
Texture[stage] = Driver->CurrentTexture[stage];
}
......
......@@ -288,7 +288,7 @@ namespace video
//! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates, bool fixedPipeline);
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline);
......@@ -419,10 +419,10 @@ namespace video
//! Get ZBuffer bits.
GLenum getZBufferBits() const;
//! Get current material.
const SMaterial& getCurrentMaterial() const;
//! Get bridge calls.
COpenGLCallBridge* getBridgeCalls() const;
......@@ -432,8 +432,6 @@ namespace video
#endif
private:
// Bridge calls.
COpenGLCallBridge* BridgeCalls;
//! clears the zbuffer and color buffer
void clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuffer, SColor color);
......@@ -478,6 +476,9 @@ namespace video
void renderArray(const void* indexList, u32 primitiveCount,
scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
// Bridge calls.
COpenGLCallBridge* BridgeCalls;
core::stringw Name;
core::matrix4 Matrices[ETS_COUNT];
core::array<u8> ColorBuffer;
......@@ -630,10 +631,10 @@ namespace video
E_DEVICE_TYPE DeviceType;
};
//! This bridge between Irlicht pseudo OpenGL calls
//! and true OpenGL calls.
class COpenGLCallBridge
{
public:
......@@ -660,7 +661,7 @@ namespace video
void setCullFaceFunc(GLenum mode);
void setCullFace(bool enable);
// Depth calls.
void setDepthFunc(GLenum mode);
......@@ -668,19 +669,19 @@ namespace video
void setDepthMask(bool enable);
void setDepthTest(bool enable);
// Matrix calls.
void setMatrixMode(GLenum mode);
// Texture calls.
void setActiveTexture(GLenum texture);
void setClientActiveTexture(GLenum texture);
void setTexture(u32 stage, bool fixedPipeline);
private:
COpenGLDriver* Driver;
......@@ -699,13 +700,13 @@ namespace video
GLenum CullFaceMode;
bool CullFace;
GLenum DepthFunc;
bool DepthMask;
bool DepthTest;
GLenum MatrixMode;
GLenum ActiveTexture;
GLenum ClientActiveTexture;
......
......@@ -44,7 +44,7 @@ COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* drive
IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial,
s32 userData)
: Driver(driver), CallBack(callback), Program(0), Program2(0), BaseMaterial(0), UserData(userData)
: Driver(driver), CallBack(callback), BaseMaterial(0), Program(0), Program2(0), UserData(userData)
{
#ifdef _DEBUG
setDebugName("COpenGLSLMaterialRenderer");
......
......@@ -24,8 +24,8 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), MipmapLegacyMode(true),
IsRenderTarget(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true), IsCompressed(false)
IsRenderTarget(false), IsCompressed(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true)
{
#ifdef _DEBUG
setDebugName("COpenGLTexture");
......@@ -35,7 +35,7 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
getImageValues(origImage);
if (ColorFormat == ECF_DXT1 || ColorFormat == ECF_DXT2 || ColorFormat == ECF_DXT3 || ColorFormat == ECF_DXT4 || ColorFormat == ECF_DXT5)
{
{
if(!Driver->queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
{
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
......@@ -81,8 +81,8 @@ COpenGLTexture::COpenGLTexture(const io::path& name, COpenGLDriver* driver)
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), HasMipMaps(true),
MipmapLegacyMode(true), IsRenderTarget(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true), IsCompressed(false)
MipmapLegacyMode(true), IsRenderTarget(false), IsCompressed(false),
AutomaticMipmapUpdate(false), ReadOnlyLock(false), KeepImage(true)
{
#ifdef _DEBUG
setDebugName("COpenGLTexture");
......@@ -354,7 +354,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// make sure we don't change the internal format of existing images
if (!newTexture)
InternalFormat=oldInternalFormat;
Driver->setActiveTexture(0, this);
Driver->getBridgeCalls()->setTexture(0, true);
......@@ -399,7 +399,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// enable bilinear filter without mipmaps
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
StatesCache.BilinearFilter = true;
StatesCache.TrilinearFilter = false;
StatesCache.MipMapStatus = false;
......@@ -460,10 +460,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
AutomaticMipmapUpdate=false;
if (IsCompressed && !mipmapData)
{
if (image->hasMipMaps())
mipmapData = static_cast<u8*>(image->lock())+compressedDataSize;
else
HasMipMaps = false;
}
regenerateMipMapLevels(mipmapData);
}
......@@ -473,12 +475,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// enable bilinear mipmap filter
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
StatesCache.BilinearFilter = true;
StatesCache.TrilinearFilter = false;
StatesCache.MipMapStatus = true;
}
}
}
if (Driver->testGLError())
os::Printer::log("Could not glTexImage2D", ELL_ERROR);
......@@ -823,22 +825,22 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d<u32>& size,
// generate color texture
glGenTextures(1, &TextureName);
Driver->setActiveTexture(0, this);
Driver->getBridgeCalls()->setTexture(0, true);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, FilteringType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if(FilteringType == GL_NEAREST)
StatesCache.BilinearFilter = false;
else
StatesCache.BilinearFilter = true;
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
StatesCache.WrapV = ETC_CLAMP_TO_EDGE;
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, ImageSize.Width,
ImageSize.Height, 0, PixelFormat, PixelType, 0);
#ifdef _DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment