Cleanup; fixed tons of warnings, set up the project to treat warnings as errors

This commit is contained in:
parax0 2015-11-24 03:22:37 -07:00
parent 367cb6c3d8
commit 5ffa24592c
39 changed files with 90 additions and 929 deletions

View File

@ -53,8 +53,8 @@ std::pair<bool,float> RayBoxIntersection(const CRay& Ray, const CAABox& Box)
{
// Code slightly modified from Ogre
// https://github.com/ehsan/ogre/blob/master/OgreMain/src/OgreMath.cpp
if (Box.IsNull()) return std::pair<bool,float>(false, 0);
if (Box.IsInfinite()) return std::pair<bool,float>(true, 0);
if (Box.IsNull()) return std::pair<bool,float>(false, 0.f);
if (Box.IsInfinite()) return std::pair<bool,float>(true, 0.f);
float lowt = 0.0f;
float t;
@ -68,7 +68,7 @@ std::pair<bool,float> RayBoxIntersection(const CRay& Ray, const CAABox& Box)
// Check origin inside first
if ( RayOrig > Min && RayOrig < Max )
{
return std::pair<bool, float>(true, 0);
return std::pair<bool, float>(true, 0.f);
}
// Check each face in turn, only check closest 3
@ -260,13 +260,13 @@ std::pair<bool,float> RayTriangleIntersection(const CRay& Ray,
if (denom > + std::numeric_limits<float>::epsilon())
{
if (!AllowBackfaces)
return std::pair<bool,float>(false, 0);
return std::pair<bool,float>(false, 0.f);
}
else if (denom >= - std::numeric_limits<float>::epsilon())
{
// Parallel or triangle area is close to zero when
// the plane normal not normalised.
return std::pair<bool,float>(false, 0);
return std::pair<bool,float>(false, 0.f);
}
t = FaceNormal.Dot(vtxA - Ray.Origin()) / denom;
@ -274,7 +274,7 @@ std::pair<bool,float> RayTriangleIntersection(const CRay& Ray,
if (t < 0)
{
// Intersection is behind origin
return std::pair<bool,float>(false, 0);
return std::pair<bool,float>(false, 0.f);
}
}
@ -321,12 +321,12 @@ std::pair<bool,float> RayTriangleIntersection(const CRay& Ray,
if (area > 0)
{
if (alpha < tolerance || beta < tolerance || alpha+beta > area-tolerance)
return std::pair<bool,float>(false, 0);
return std::pair<bool,float>(false, 0.f);
}
else
{
if (alpha > tolerance || beta > tolerance || alpha+beta < area-tolerance)
return std::pair<bool,float>(false, 0);
return std::pair<bool,float>(false, 0.f);
}
}

View File

@ -134,7 +134,7 @@ void CRenderer::SetBloom(EBloomMode BloomMode)
mOptions &= ~eEnableBloom;
}
void CRenderer::SetFont(CFont *pFont)
void CRenderer::SetFont(CFont* /*pFont*/)
{
}
@ -199,8 +199,8 @@ void CRenderer::RenderBloom()
CColor((u8) 53, 53, 53, 255),
CColor((u8) 17, 17, 17, 255) };
float BloomWidth = (mBloomMode == eBloom ? mBloomWidth : mViewportWidth);
float BloomHeight = (mBloomMode == eBloom ? mBloomHeight : mViewportHeight);
u32 BloomWidth = (mBloomMode == eBloom ? mBloomWidth : mViewportWidth);
u32 BloomHeight = (mBloomMode == eBloom ? mBloomHeight : mViewportHeight);
float BloomHScale = (mBloomMode == eBloom ? mBloomHScale : 0);
float BloomVScale = (mBloomMode == eBloom ? mBloomVScale : 0);

View File

@ -7,7 +7,11 @@ namespace Log
{
static const TString gskLogFilename = "primeworldeditor.log";
#pragma warning(push)
#pragma warning(disable: 4996) // Can't use fopen_s here without creating a separate init function for the log
FILE *gpLogFile = fopen(*gskLogFilename, "w");
#pragma warning(pop)
void Write(const TString& message)
{
@ -16,9 +20,11 @@ void Write(const TString& message)
time_t RawTime;
time(&RawTime);
tm *pTimeInfo = localtime(&RawTime);
tm pTimeInfo;
localtime_s(&pTimeInfo, &RawTime);
char Buffer[80];
strftime(Buffer, 80, "[%H:%M:%S]", pTimeInfo);
strftime(Buffer, 80, "[%H:%M:%S]", &pTimeInfo);
fprintf(gpLogFile, "%s %s\n", Buffer, *message);
fflush(gpLogFile);

View File

@ -3,6 +3,7 @@
#include <QStyleFactory>
#include <UI/CDarkStyle.h>
#include <Resource/factory/CTemplateLoader.h>
#include <Common/TString.h>
int main(int argc, char *argv[])
{

View File

@ -12,6 +12,7 @@ CONFIG += console
TARGET = PrimeWorldEditor
TEMPLATE = app
QMAKE_CXXFLAGS += /WX
SOURCES += \
Common/AnimUtil.cpp \
@ -58,7 +59,6 @@ SOURCES += \
Scene/CModelNode.cpp \
Scene/CSceneNode.cpp \
Scene/CStaticNode.cpp \
UI/CWorldEditorWindow.cpp \
UI/CStartWindow.cpp \
Resource/script/CScriptTemplate.cpp \
Resource/script/CScriptLayer.cpp \
@ -178,7 +178,6 @@ HEADERS += \
OpenGL/CShaderGenerator.h \
OpenGL/CVertexBuffer.h \
OpenGL/GLCommon.h \
UI/CWorldEditorWindow.h \
UI/PWEMaterialEditor.h \
UI/CStartWindow.h \
Resource/CCollisionMesh.h \
@ -325,7 +324,6 @@ HEADERS += \
Core/CLightParameters.h
FORMS += \
UI/CWorldEditorWindow.ui \
UI/CStartWindow.ui \
UI/CModelEditorWindow.ui \
UI/TestDialog.ui \

View File

@ -80,7 +80,7 @@ CModel* CAnimationParameters::GetCurrentModel(s32 nodeIndex)
if (nodeIndex == -1) nodeIndex = mNodeIndex;
CAnimSet *pSet = static_cast<CAnimSet*>(mpCharSet);
if (pSet->getNodeCount() <= nodeIndex) return nullptr;
if (pSet->getNodeCount() <= (u32) nodeIndex) return nullptr;
return pSet->getNodeModel(nodeIndex);
}

View File

@ -28,11 +28,9 @@ inline float PtsToFloat(s32 pt)
return 0.00208333f * pt;
}
CVector2f CFont::RenderString(const TString& String, CRenderer *pRenderer, float,
CVector2f, CColor FillColor, CColor StrokeColor, u32 FontSize)
CVector2f CFont::RenderString(const TString& String, CRenderer* /*pRenderer*/, float /*AspectRatio*/,
CVector2f /*Position*/, CColor FillColor, CColor StrokeColor, u32 FontSize)
{
// Not using parameter 3 (float - AspectRatio)
// Not using parameter 4 (CVector2f - Position)
// WIP
if (!smBuffersInitialized) InitBuffers();

View File

@ -98,7 +98,7 @@ void CMaterialPass::SetAnimCurrent(ERenderOptions Options, u32 PassIndex)
case eInverseMV: // Mode 0
case eSimpleMode: // Mode 10 - maybe not correct?
{
glm::mat4 mtx = glm::inverse(glm::transpose(CGraphics::sMVPBlock.ViewMatrix.ToGlmMat4()) * glm::transpose(CGraphics::sMVPBlock.ModelMatrix.ToGlmMat4()));
glm::mat4 mtx = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
mtx[0][3] = mtx[1][3] = mtx[2][3] = 0.f;
TexMtx = CMatrix4f::FromGlmMat4(mtx);
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, 0.5f,
@ -110,7 +110,7 @@ void CMaterialPass::SetAnimCurrent(ERenderOptions Options, u32 PassIndex)
case eInverseMVTranslated: // Mode 1
{
glm::mat4 mtx = glm::inverse(glm::transpose(CGraphics::sMVPBlock.ViewMatrix.ToGlmMat4()) * glm::transpose(CGraphics::sMVPBlock.ModelMatrix.ToGlmMat4()));
glm::mat4 mtx = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
TexMtx = CMatrix4f::FromGlmMat4(mtx);
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, 0.5f,
0.0f, 0.5f, 0.0f, 0.5f,
@ -163,7 +163,7 @@ void CMaterialPass::SetAnimCurrent(ERenderOptions Options, u32 PassIndex)
case eModelMatrix: // Mode 6
{
// It looks ok, but I can't tell whether it's correct...
TexMtx = CMatrix4f::FromGlmMat4(glm::transpose(CGraphics::sMVPBlock.ModelMatrix.ToGlmMat4()));
TexMtx = CMatrix4f::FromGlmMat4(glm::transpose(ModelMtx.ToGlmMat4()));
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, TexMtx[0][3] * 0.50000001f,
0.0f, 0.5f, 0.0f, TexMtx[1][3] * 0.50000001f,
0.0f, 0.0f, 0.0f, 1.0f,
@ -178,7 +178,7 @@ void CMaterialPass::SetAnimCurrent(ERenderOptions Options, u32 PassIndex)
CMatrix4f view = CGraphics::sMVPBlock.ViewMatrix;
// Oh god I seriously need a CMatrix4f inverse function.
glm::mat4 mtx = glm::inverse(glm::transpose(CGraphics::sMVPBlock.ViewMatrix.ToGlmMat4()) * glm::transpose(CGraphics::sMVPBlock.ModelMatrix.ToGlmMat4()));
glm::mat4 mtx = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
mtx[0][3] = mtx[1][3] = mtx[2][3] = 0.f;
TexMtx = CMatrix4f::FromGlmMat4(mtx);

View File

@ -261,7 +261,7 @@ u32 CTexture::FormatBPP(ETexelFormat Format)
void CTexture::CalcLinearSize()
{
float BytesPerPixel = FormatBPP(mTexelFormat) / 8.f;
mLinearSize = mWidth * mHeight * BytesPerPixel;
mLinearSize = (u32) (mWidth * mHeight * BytesPerPixel);
}
u32 CTexture::CalcTotalSize()
@ -272,7 +272,7 @@ u32 CTexture::CalcTotalSize()
for (u32 iMip = 0; iMip < mNumMipMaps; iMip++)
{
Size += MipW * MipH * BytesPerPixel;
Size += (u32) (MipW * MipH * BytesPerPixel);
MipW /= 2;
MipH /= 2;
}
@ -310,7 +310,7 @@ void CTexture::CopyGLBuffer()
glGetTexImage(GL_TEXTURE_2D, iMip, GL_RGBA, GL_UNSIGNED_BYTE, pData);
MipOffset += MipW * MipH * BytesPerPixel;
MipOffset += (u32) (MipW * MipH * BytesPerPixel);
MipW /= 2;
MipH /= 2;
}

View File

@ -188,7 +188,7 @@ void CMaterialCooker::WriteMaterialPrime(COutputStream& Out)
// Color Channels
Out.WriteLong(1);
Out.WriteLong(0x3000 | mpMat->IsLightingEnabled());
Out.WriteLong(0x3000 | (mpMat->IsLightingEnabled() ? 1 : 0));
// TEV
u32 NumPasses = mpMat->PassCount();
@ -235,7 +235,7 @@ void CMaterialCooker::WriteMaterialPrime(COutputStream& Out)
}
else
Out.WriteShort(0xFFFF);
Out.WriteShort((u16) 0xFFFF);
}
// TexGen

View File

@ -60,7 +60,7 @@ void CModelCooker::GenerateSurfaceData()
mNumVertices = mVertices.size();
}
void CModelCooker::WriteEditorModel(COutputStream& Out)
void CModelCooker::WriteEditorModel(COutputStream& /*Out*/)
{
}
@ -155,7 +155,7 @@ void CModelCooker::WriteModelPrime(COutputStream& Out)
pSurface->CenterPoint.Write(Out);
Out.WriteLong(pSurface->MaterialID);
Out.WriteShort(0x8000);
Out.WriteShort((u16) 0x8000);
u32 PrimTableSizeOffset = Out.Tell();
Out.WriteShort(0);
Out.WriteLongLong(0);
@ -183,7 +183,7 @@ void CModelCooker::WriteModelPrime(COutputStream& Out)
Out.WriteByte(pVert->MatrixIndices[iMtxAttribs]);
}
u16 VertexIndex = pVert->ArrayPosition;
u16 VertexIndex = (u16) pVert->ArrayPosition;
if (MatAttribs & ePosition)
Out.WriteShort(VertexIndex);
@ -203,7 +203,7 @@ void CModelCooker::WriteModelPrime(COutputStream& Out)
if (MatAttribs & (eTex0 << (iTex * 2)))
{
Out.WriteShort(VertexIndex + TexOffset);
TexOffset += mNumVertices;
TexOffset += (u16) mNumVertices;
}
}
}
@ -249,7 +249,7 @@ void CModelCooker::WriteCookedModel(CModel *pModel, EGame Version, COutputStream
}
}
void CModelCooker::WriteUncookedModel(CModel *pModel, COutputStream& EMDL)
void CModelCooker::WriteUncookedModel(CModel* /*pModel*/, COutputStream& /*EMDL*/)
{
}

View File

@ -392,7 +392,7 @@ void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp, const TString& dir)
enumXML.LinkEndChild(pDecl);
XMLElement *pBase = enumXML.NewElement("enum");
pBase->SetName("name", *name);
pBase->SetAttribute("name", *name);
SaveEnumerators(&enumXML, pBase, pTemp);
enumXML.LinkEndChild(pBase);
@ -414,7 +414,7 @@ void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp, const TStri
bitfieldXML.LinkEndChild(pDecl);
XMLElement *pBase = bitfieldXML.NewElement("bitfield");
pBase->SetName("name", *name);
pBase->SetAttribute("name", *name);
SaveBitFlags(&bitfieldXML, pBase, pTemp);
bitfieldXML.LinkEndChild(pBase);

View File

@ -73,7 +73,7 @@ void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex)
Encoder.WriteTXTR(TXTR);
}
void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex, ETexelFormat OutputFormat)
void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex, ETexelFormat /*OutputFormat*/)
{
// todo: support for encoding a specific format
EncodeTXTR(TXTR, pTex);
@ -89,6 +89,7 @@ ETexelFormat CTextureEncoder::GetGXFormat(ETexelFormat Format)
case eRGB565: return eGX_RGB565;
case eRGBA8: return eGX_RGBA8;
case eDXT1: return eGX_CMPR;
default: return eInvalidTexelFormat;
}
}
@ -102,5 +103,6 @@ ETexelFormat CTextureEncoder::GetFormat(ETexelFormat Format)
case eGX_IA8: return eLuminanceAlpha;
// todo rest of these
case eGX_CMPR: return eDXT1;
default: return eInvalidTexelFormat;
}
}

View File

@ -353,8 +353,7 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
if (AnimSize > 0)
{
u16 Unknown1 = mpFile->ReadShort();
u16 Unknown2 = mpFile->ReadShort();
mpFile->Seek(0x4, SEEK_CUR);
pPass->mAnimMode = (EUVAnimMode) mpFile->ReadLong();
switch (pPass->mAnimMode)

View File

@ -330,7 +330,7 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pMesh, CMaterialSet *pSet)
pSurf->CenterPoint = pSurf->AABox.Center();
if (pMesh->HasNormals())
pSurf->ReflectionDirection /= pMesh->mNumVertices;
pSurf->ReflectionDirection /= (float) pMesh->mNumVertices;
else
pSurf->ReflectionDirection = CVector3f(1.f, 0.f, 0.f);

View File

@ -270,7 +270,7 @@ CPropertyTemplate* CTemplateLoader::LoadPropertyTemplate(tinyxml2::XMLElement *p
}
// ************ SCRIPT OBJECT ************
CScriptTemplate* CTemplateLoader::LoadScriptTemplate(tinyxml2::XMLDocument *pDoc, const TString& templateName, u32 objectID)
CScriptTemplate* CTemplateLoader::LoadScriptTemplate(tinyxml2::XMLDocument *pDoc, const TString& /*templateName*/, u32 objectID)
{
CScriptTemplate *pScript = new CScriptTemplate(mpMaster);
pScript->mObjectID = objectID;

View File

@ -228,7 +228,7 @@ void CWorldLoader::LoadReturnsMLVL(CInputStream& MLVL)
{
mpWorld->mpWorldName = (CStringTable*) gResCache.GetResource(MLVL.ReadLongLong(), "STRG");
bool Check = MLVL.ReadByte();
bool Check = (MLVL.ReadByte() != 0);
if (Check)
{
MLVL.ReadString();

View File

@ -43,13 +43,11 @@ void CCollisionNode::Draw(ERenderOptions)
mpCollision->DrawWireframe();
}
void CCollisionNode::DrawAsset(ERenderOptions, u32)
void CCollisionNode::DrawAsset(ERenderOptions /*Options*/, u32 /*asset*/)
{
// Not using parameter 1 (ERenderOptions - Options)
// Not using parameter 2 (u32 - asset)
}
SRayIntersection CCollisionNode::RayNodeIntersectTest(const CRay &Ray, u32 AssetID, ERenderOptions options)
SRayIntersection CCollisionNode::RayNodeIntersectTest(const CRay& /*Ray*/, u32 /*AssetID*/, ERenderOptions /*options*/)
{
// todo
SRayIntersection Result;

View File

@ -63,7 +63,7 @@ void CLightNode::DrawAsset(ERenderOptions, u32)
// Not using parameter 2 (u32 - asset)
}
SRayIntersection CLightNode::RayNodeIntersectTest(const CRay &Ray, u32 AssetID, ERenderOptions options)
SRayIntersection CLightNode::RayNodeIntersectTest(const CRay& Ray, u32 /*AssetID*/, ERenderOptions options)
{
// Needs redo if I ever make these look like something other than boxes
bool allowBackfaces = ((options & eEnableBackfaceCull) == 0);

View File

@ -341,7 +341,7 @@ void CScriptNode::GeneratePosition()
}
}
mPosition = NewPos / NumLinks;
mPosition = NewPos / (float) NumLinks;
mPosition.x += 2.f;
}

View File

@ -106,7 +106,7 @@ void CBasicViewport::mouseReleaseEvent(QMouseEvent *pEvent)
OnMouseRelease(pEvent);
}
void CBasicViewport::mouseMoveEvent(QMouseEvent *pEvent)
void CBasicViewport::mouseMoveEvent(QMouseEvent* /*pEvent*/)
{
// todo: draggable selection rectangle
}
@ -259,7 +259,7 @@ void CBasicViewport::Render()
}
// ************ PRIVATE ************
void CBasicViewport::ProcessInput(double DeltaTime)
void CBasicViewport::ProcessInput(double /*DeltaTime*/)
{
}

View File

@ -169,7 +169,7 @@ bool CGizmo::CheckSelectedAxes(const CRay &ray)
{
// Skip surface/box check - since we use lines the boxes might be too small
SSurface *pSurf = pModel->GetSurface(iSurf);
std::pair<bool,float> surfCheck = pSurf->IntersectsRay(partRay, 0.05f);
std::pair<bool,float> surfCheck = pSurf->IntersectsRay(partRay, false, 0.05f);
if (surfCheck.first)
{

View File

@ -340,16 +340,16 @@ void CModelEditorWindow::UpdateMaterial()
if (!mpCurrentMat) return;
if (mIgnoreSignals) return;
EModelEditorWidget Widget = (EModelEditorWidget) sender()->property("ModelEditorWidgetType").toInt();
/*EModelEditorWidget Widget = (EModelEditorWidget) sender()->property("ModelEditorWidgetType").toInt();
switch (Widget)
{
/*case eAddPassButton:
case eAddPassButton:
break;
case eDeletePassButton:
break;*/
}
break;
}*/
}
void CModelEditorWindow::UpdateMaterial(int Value)

View File

@ -153,7 +153,7 @@ void CSceneViewport::Paint()
mpRenderer->EndFrame();
}
void CSceneViewport::ContextMenu(QContextMenuEvent *pEvent)
void CSceneViewport::ContextMenu(QContextMenuEvent* /*pEvent*/)
{
}

View File

@ -1,300 +0,0 @@
#include <iostream>
#include <QFileDialog>
#include <QMessageBox>
#include "CWorldEditorWindow.h"
#include <Resource/CTexture.h>
#include <Core/CResCache.h>
#include <Core/CSceneManager.h>
#include <FileIO/FileIO.h>
#include <Common/TString.h>
#include <Core/CGraphics.h>
#include <gtc/matrix_transform.hpp>
#include "CBasicViewport.h"
CWorldEditorWindow::CWorldEditorWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::CWorldEditorWindow)
{
ui->setupUi(this);
mpRenderer = new CRenderer();
mpRenderer->ToggleGrid(false);
mpActiveWorld = nullptr;
mpActiveArea = nullptr;
mRendererInitialized = false;
mpSceneManager = new CSceneManager();
mCamera.Snap(CVector3f(0, 3, 1));
mCameraMode = eFreeCamera;
mViewportKeysPressed = 0;
mShouldDrawSky = true;
/*connect(ui->CentralGLWidget, SIGNAL(ViewportResized(int,int)), this, SLOT(SetViewportSize(int,int)));
connect(ui->CentralGLWidget, SIGNAL(PaintViewport(double)), this, SLOT(PaintViewport(double)));
connect(ui->CentralGLWidget, SIGNAL(MouseClicked(QMouseEvent*)), this, SLOT(OnViewportRayCast(QMouseEvent*)));
connect(ui->CentralGLWidget, SIGNAL(MouseMoved(QMouseEvent*, float, float)), this, SLOT(OnViewportMouseMove(QMouseEvent*, float, float)));
connect(ui->CentralGLWidget, SIGNAL(KeyPressed(QKeyEvent*)), this, SLOT(OnViewportKeyPress(QKeyEvent*)));
connect(ui->CentralGLWidget, SIGNAL(KeyReleased(QKeyEvent*)), this, SLOT(OnViewportKeyRelease(QKeyEvent*)));
connect(ui->CentralGLWidget, SIGNAL(WheelScroll(int)), this, SLOT(OnViewportWheelScroll(int)));*/
}
CWorldEditorWindow::~CWorldEditorWindow()
{
delete ui;
delete mpRenderer;
delete mpSceneManager;
}
void CWorldEditorWindow::InitializeWorld(CWorld *pWorld, CGameArea *pArea)
{
mpSceneManager->SetActiveWorld(pWorld);
mpSceneManager->SetActiveArea(pArea);
mpRenderer->SetClearColor(CColor::skWhite);
// Snap camera to location of area
CTransform4f AreaTransform = pArea->GetTransform();
CVector3f AreaPosition(AreaTransform[0][3], AreaTransform[1][3], AreaTransform[2][3]);
mCamera.Snap(AreaPosition);
// Set bloom based on world version
if (pWorld != mpActiveWorld)
{
if (pWorld->Version() != eCorruption)
{
ui->menuBloom->setEnabled(false);
on_actionDisableBloom_triggered();
}
else
{
ui->menuBloom->setEnabled(true);
on_actionEnableBloom_triggered();
}
}
mpActiveWorld = pWorld;
mpActiveArea = pArea;
}
// ************ PUBLIC SLOTS ************
void CWorldEditorWindow::PaintViewport(double DeltaTime)
{
if (!mRendererInitialized)
{
mpRenderer->Init();
mRendererInitialized = true;
}
mCamera.ProcessKeyInput((EKeyInputs) mViewportKeysPressed, DeltaTime);
mCamera.LoadMatrices();
mpRenderer->BeginFrame();
mpSceneManager->AddSceneToRenderer(mpRenderer, mCamera);
if (mShouldDrawSky)
{
CModel *pSky = mpSceneManager->GetActiveSkybox();
if (pSky) mpRenderer->RenderSky(pSky, mCamera);
}
mpRenderer->RenderBuckets(mCamera);
mpRenderer->EndFrame();
}
void CWorldEditorWindow::SetViewportSize(int Width, int Height)
{
mViewportAspectRatio = (float) Width / (float) Height;
mpRenderer->SetViewportSize(Width, Height);
}
void CWorldEditorWindow::OnViewportMouseMove(QMouseEvent *pEvent, float XMovement, float YMovement)
{
int KeyInputs = 0;
if (pEvent->modifiers() & Qt::ControlModifier) KeyInputs |= eCtrlKey;
if (pEvent->modifiers() & Qt::AltModifier) KeyInputs |= eAltKey;
int MouseInputs = 0;
if (pEvent->buttons() & Qt::LeftButton) MouseInputs |= eLeftButton;
if (pEvent->buttons() & Qt::MiddleButton) MouseInputs |= eMiddleButton;
if (pEvent->buttons() & Qt::RightButton) MouseInputs |= eRightButton;
mCamera.ProcessMouseInput((EKeyInputs) KeyInputs, (EMouseInputs) MouseInputs, XMovement, YMovement);
}
void CWorldEditorWindow::OnViewportKeyPress(QKeyEvent *pEvent)
{
switch (pEvent->key())
{
case Qt::Key_Q: mViewportKeysPressed |= eQKey; break;
case Qt::Key_W: mViewportKeysPressed |= eWKey; break;
case Qt::Key_E: mViewportKeysPressed |= eEKey; break;
case Qt::Key_A: mViewportKeysPressed |= eAKey; break;
case Qt::Key_S: mViewportKeysPressed |= eSKey; break;
case Qt::Key_D: mViewportKeysPressed |= eDKey; break;
}
}
void CWorldEditorWindow::OnViewportKeyRelease(QKeyEvent *pEvent)
{
switch (pEvent->key())
{
case Qt::Key_Q: mViewportKeysPressed &= ~eQKey; break;
case Qt::Key_W: mViewportKeysPressed &= ~eWKey; break;
case Qt::Key_E: mViewportKeysPressed &= ~eEKey; break;
case Qt::Key_A: mViewportKeysPressed &= ~eAKey; break;
case Qt::Key_S: mViewportKeysPressed &= ~eSKey; break;
case Qt::Key_D: mViewportKeysPressed &= ~eDKey; break;
}
}
void CWorldEditorWindow::OnViewportWheelScroll(int ScrollAmount)
{
mCamera.Zoom(ScrollAmount / 6000.f);
}
void CWorldEditorWindow::OnViewportRayCast(QMouseEvent *pEvent)
{
// todo: ray cast
}
// ************ PRIVATE SLOTS ************
void CWorldEditorWindow::LoadScriptableLayerUI()
{
}
void CWorldEditorWindow::on_actionExit_triggered()
{
close();
}
void CWorldEditorWindow::on_actionBackface_culling_triggered()
{
mpRenderer->ToggleBackfaceCull(ui->actionBackface_culling->isChecked());
}
void CWorldEditorWindow::on_actionWorld_triggered()
{
mpRenderer->ToggleWorld(ui->actionWorld->isChecked());
}
void CWorldEditorWindow::on_actionCollision_triggered()
{
mpRenderer->ToggleWorldCollision(ui->actionCollision->isChecked());
}
void CWorldEditorWindow::on_actionObjects_triggered()
{
mpRenderer->ToggleObjects(ui->actionObjects->isChecked());
}
void CWorldEditorWindow::setupInstanceViewLayers()
{
/* if (qApp->scene.MREAArray.empty()) return;
mrea_GL *m = qApp->scene.MREAArray[0];
if (!m->isSCLYRead()) return;
u32 layer_count = m->getLayerCount();
for (u32 l = 0; l < layer_count; l++) {
QTreeWidgetItem* layer = new QTreeWidgetItem;
layer->setText(0, "Layer " + QString::number(l));
ui->InstanceViewTreeWidget->addTopLevelItem(layer);
u32 object_count = m->getObjectCount(l);
for (u32 o = 0; o < object_count; o++) {
PrimeObject object = m->getObject(l, o);
TString name = object.getStringProperty("Name");
if (name.IsEmpty()) name = "[no name]";
QTreeWidgetItem* obj = new QTreeWidgetItem;
obj->setText(0, QString::fromStdString(name));
obj->setText(1, QString::fromStdString(qApp->scene.getObjectName(object.type)));
obj->setToolTip(0, obj->text(0));
obj->setToolTip(1, obj->text(1));
layer->addChild(obj);
//layer->set
}
}*/
}
void CWorldEditorWindow::clearInstanceView()
{
//ui->InstanceViewTreeWidget->clear();
}
void CWorldEditorWindow::on_actionMaterial_Animations_triggered()
{
mpRenderer->ToggleUVAnimation(ui->actionMaterial_Animations->isChecked());
}
void CWorldEditorWindow::on_actionLights_triggered()
{
mpRenderer->ToggleLights(ui->actionLights->isChecked());
}
void CWorldEditorWindow::on_actionLightingNone_triggered()
{
CGraphics::sLightMode = CGraphics::NoLighting;
ui->actionLightingNone->setChecked(true);
ui->actionLightingBasic->setChecked(false);
ui->actionLightingWorld->setChecked(false);
}
void CWorldEditorWindow::on_actionLightingBasic_triggered()
{
CGraphics::sLightMode = CGraphics::BasicLighting;
ui->actionLightingNone->setChecked(false);
ui->actionLightingBasic->setChecked(true);
ui->actionLightingWorld->setChecked(false);
}
void CWorldEditorWindow::on_actionLightingWorld_triggered()
{
CGraphics::sLightMode = CGraphics::WorldLighting;
ui->actionLightingNone->setChecked(false);
ui->actionLightingBasic->setChecked(false);
ui->actionLightingWorld->setChecked(true);
}
void CWorldEditorWindow::on_actionSky_triggered()
{
mShouldDrawSky = ui->actionSky->isChecked();
}
void CWorldEditorWindow::on_actionOccluder_meshes_triggered()
{
mpRenderer->ToggleOccluders(ui->actionOccluder_meshes->isChecked());
}
void CWorldEditorWindow::closeEvent(QCloseEvent *)
{
emit Closed();
}
void CWorldEditorWindow::on_actionDisableBloom_triggered()
{
mpRenderer->SetBloom(CRenderer::eNoBloom);
ui->actionEnableBloom->setChecked(false);
ui->actionDisableBloom->setChecked(true);
ui->actionShowBloomMaps->setChecked(false);
}
void CWorldEditorWindow::on_actionEnableBloom_triggered()
{
mpRenderer->SetBloom(CRenderer::eBloom);
ui->actionDisableBloom->setChecked(false);
ui->actionEnableBloom->setChecked(true);
ui->actionShowBloomMaps->setChecked(false);
}
void CWorldEditorWindow::on_actionShowBloomMaps_triggered()
{
mpRenderer->SetBloom(CRenderer::eBloomMaps);
ui->actionDisableBloom->setChecked(false);
ui->actionEnableBloom->setChecked(false);
ui->actionShowBloomMaps->setChecked(true);
}

View File

@ -1,89 +0,0 @@
#ifndef CWORLDEDITORWINDOW_H
#define CWORLDEDITORWINDOW_H
#include <QMainWindow>
#include "ui_CWorldEditorWindow.h"
#include <Core/CRenderer.h>
#include <Core/CSceneManager.h>
#include <Core/CResCache.h>
namespace Ui {
class CWorldEditorWindow;
}
class CWorldEditorWindow : public QMainWindow
{
Q_OBJECT
CRenderer *mpRenderer;
CSceneManager *mpSceneManager;
CWorld *mpActiveWorld;
CToken mWorldToken;
CGameArea *mpActiveArea;
CToken mAreaToken;
bool mRendererInitialized;
CCamera mCamera;
ECameraMoveMode mCameraMode;
float mViewportAspectRatio;
int mViewportKeysPressed;
bool mShouldDrawSky;
void LoadScriptableLayerUI();
public:
CWorldEditorWindow(QWidget *parent);
~CWorldEditorWindow();
void InitializeWorld(CWorld *pWorld, CGameArea *pArea);
public slots:
void PaintViewport(double DeltaTime);
void SetViewportSize(int Width, int Height);
void OnViewportMouseMove(QMouseEvent *pEvent, float XMovement, float YMovement);
void OnViewportRayCast(QMouseEvent *pEvent);
void OnViewportKeyPress(QKeyEvent *pEvent);
void OnViewportKeyRelease(QKeyEvent *pEvent);
void OnViewportWheelScroll(int ScrollAmount);
private slots:
void on_actionExit_triggered();
void on_actionBackface_culling_triggered();
void on_actionWorld_triggered();
void on_actionCollision_triggered();
void on_actionObjects_triggered();
void on_actionMaterial_Animations_triggered();
void on_actionLights_triggered();
void on_actionLightingNone_triggered();
void on_actionLightingBasic_triggered();
void on_actionLightingWorld_triggered();
void on_actionSky_triggered();
void on_actionOccluder_meshes_triggered();
void on_actionDisableBloom_triggered();
void on_actionEnableBloom_triggered();
void on_actionShowBloomMaps_triggered();
signals:
void Closed();
private:
Ui::CWorldEditorWindow *ui;
void setupInstanceViewLayers();
void clearInstanceView();
void closeEvent(QCloseEvent *);
};
#endif // CWORLDEDITORWINDOW_H

View File

@ -1,452 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CWorldEditorWindow</class>
<widget class="QMainWindow" name="CWorldEditorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>1250</height>
</rect>
</property>
<property name="windowTitle">
<string>Prime World Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="CentralGLWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>View</string>
</property>
<widget class="QMenu" name="menuDynamic_lighting">
<property name="title">
<string>Dynamic lighting</string>
</property>
<addaction name="actionLightingNone"/>
<addaction name="actionLightingBasic"/>
<addaction name="actionLightingWorld"/>
</widget>
<widget class="QMenu" name="menuBloom">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Bloom</string>
</property>
<addaction name="actionDisableBloom"/>
<addaction name="actionEnableBloom"/>
<addaction name="actionShowBloomMaps"/>
</widget>
<addaction name="actionReset_camera"/>
<addaction name="actionBackface_culling"/>
<addaction name="separator"/>
<addaction name="actionWorld"/>
<addaction name="actionCollision"/>
<addaction name="actionObjects"/>
<addaction name="actionMaterial_Animations"/>
<addaction name="actionLights"/>
<addaction name="actionOccluder_meshes"/>
<addaction name="actionSky"/>
<addaction name="separator"/>
<addaction name="menuDynamic_lighting"/>
<addaction name="menuBloom"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
</widget>
<widget class="QDockWidget" name="ObjectPropertiesDock">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Object Properties</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_5">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>272</width>
<height>330</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="ConnectionsGroup">
<property name="title">
<string>Connections</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</widget>
</item>
<item>
<widget class="QGroupBox" name="PropertiesGroup">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Properties</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="InstanceViewDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Instance View</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_6">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTreeWidget" name="InstanceViewTreeWidget">
<property name="enabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Instance</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="actionOpen_CMDL">
<property name="text">
<string>Open CMDL</string>
</property>
</action>
<action name="actionReset_camera">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Reset camera</string>
</property>
</action>
<action name="actionBackface_culling">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Backface culling</string>
</property>
</action>
<action name="actionWorld">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>World</string>
</property>
<property name="shortcut">
<string>1</string>
</property>
</action>
<action name="actionCollision">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Collision</string>
</property>
<property name="shortcut">
<string>2</string>
</property>
</action>
<action name="actionObjects">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Objects</string>
</property>
<property name="shortcut">
<string>3</string>
</property>
</action>
<action name="actionPaths">
<property name="text">
<string>Paths</string>
</property>
</action>
<action name="actionLightmaps">
<property name="text">
<string>Lightmaps</string>
</property>
</action>
<action name="actionMaterial_Editor">
<property name="text">
<string>Material Editor</string>
</property>
</action>
<action name="actionExtract">
<property name="text">
<string>Extract</string>
</property>
</action>
<action name="actionRepack">
<property name="text">
<string>Repack</string>
</property>
</action>
<action name="actionDump_file_list">
<property name="text">
<string>Dump file list</string>
</property>
</action>
<action name="actionConvert_TXTR_to_DDS">
<property name="text">
<string>Convert TXTR to DDS</string>
</property>
</action>
<action name="actionConvert_DDS_to_TXTR">
<property name="text">
<string>Convert DDS to TXTR</string>
</property>
</action>
<action name="actionClose_all">
<property name="text">
<string>Close all</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="actionOpen_MREA">
<property name="text">
<string>Open MREA</string>
</property>
</action>
<action name="actionRead_MREA">
<property name="text">
<string>Read MREA</string>
</property>
</action>
<action name="actionMaterial_Animations">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>UV animations</string>
</property>
<property name="shortcut">
<string>4</string>
</property>
</action>
<action name="actionLights">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Lights</string>
</property>
<property name="shortcut">
<string>5</string>
</property>
</action>
<action name="actionLightingNone">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>None</string>
</property>
<property name="shortcut">
<string>Ctrl+1</string>
</property>
</action>
<action name="actionLightingBasic">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Basic</string>
</property>
<property name="shortcut">
<string>Ctrl+2</string>
</property>
</action>
<action name="actionLightingWorld">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>World lights</string>
</property>
<property name="shortcut">
<string>Ctrl+3</string>
</property>
</action>
<action name="actionSky">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Sky</string>
</property>
<property name="shortcut">
<string>7</string>
</property>
</action>
<action name="actionOccluder_meshes">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Occluder meshes</string>
</property>
<property name="shortcut">
<string>6</string>
</property>
</action>
<action name="actionDisableBloom">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>None</string>
</property>
</action>
<action name="actionEnableBloom">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Bloom</string>
</property>
</action>
<action name="actionShowBloomMaps">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Bloom Maps</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -64,7 +64,7 @@ public slots:
void OnGizmoMoved();
protected:
virtual void GizmoModeChanged(CGizmo::EGizmoMode mode) {}
virtual void GizmoModeChanged(CGizmo::EGizmoMode /*mode*/) {}
private slots:
void OnSelectObjectsTriggered();

View File

@ -148,7 +148,7 @@ void WAnimParamsEditor::SetupUI()
// Create unknown spin box
mpSpinBoxes[0] = new WIntegralSpinBox(this);
mpSpinBoxes[0]->setRange(-2147483648, 2147483647);
mpSpinBoxes[0]->setRange(INT32_MIN, INT32_MAX);
mpSpinBoxes[0]->setFocusPolicy(Qt::StrongFocus);
mpSpinBoxes[0]->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxes[0]->setValue(mParams.Unknown(0));
@ -179,7 +179,7 @@ void WAnimParamsEditor::SetupUI()
{
// Create unknown spin box
mpSpinBoxes[0] = new WIntegralSpinBox(this);
mpSpinBoxes[0]->setRange(-2147483648, 2147483647);
mpSpinBoxes[0]->setRange(INT32_MIN, INT32_MAX);
mpSpinBoxes[0]->setFocusPolicy(Qt::StrongFocus);
mpSpinBoxes[0]->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxes[0]->setValue(mParams.Unknown(0));
@ -221,7 +221,7 @@ void WAnimParamsEditor::SetupUI()
for (u32 iBox = 1; iBox < 4; iBox++)
{
mpSpinBoxes[iBox] = new WIntegralSpinBox(this);
mpSpinBoxes[iBox]->setRange(-2147483648, 2147483647);
mpSpinBoxes[iBox]->setRange(INT32_MIN, INT32_MAX);
mpSpinBoxes[iBox]->setFocusPolicy(Qt::StrongFocus);
mpSpinBoxes[iBox]->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxes[iBox]->setValue(mParams.Unknown(iBox));

View File

@ -17,7 +17,7 @@ void WIntegralSpinBox::wheelEvent(QWheelEvent *pEvent)
else QSpinBox::wheelEvent(pEvent);
}
bool WIntegralSpinBox::eventFilter(QObject *pObj, QEvent *pEvent)
bool WIntegralSpinBox::eventFilter(QObject* /*pObj*/, QEvent *pEvent)
{
if (pEvent->type() == QEvent::MouseButtonPress)
setFocus();

View File

@ -38,7 +38,7 @@ WPropertyEditor::~WPropertyEditor()
}
void WPropertyEditor::resizeEvent(QResizeEvent *pEvent)
void WPropertyEditor::resizeEvent(QResizeEvent* /*pEvent*/)
{
CreateLabelText();
}
@ -127,7 +127,7 @@ void WPropertyEditor::CreateEditor()
CLongProperty *pLongCast = static_cast<CLongProperty*>(mpProperty);
QSpinBox *pSpinBox = new WIntegralSpinBox(this);
pSpinBox->setRange(-2147483648, 2147483647);
pSpinBox->setRange(INT32_MIN, INT32_MAX);
pSpinBox->setFocusPolicy(Qt::StrongFocus);
pSpinBox->setContextMenuPolicy(Qt::NoContextMenu);
pSpinBox->setValue(pLongCast->Get());

View File

@ -86,7 +86,7 @@ bool WResourceSelector::event(QEvent *pEvent)
return false;
}
bool WResourceSelector::eventFilter(QObject *pObj, QEvent *pEvent)
bool WResourceSelector::eventFilter(QObject* /*pObj*/, QEvent *pEvent)
{
if (pEvent->type() == QEvent::MouseMove)
if (mEnablePreviewPanel)
@ -211,7 +211,7 @@ void WResourceSelector::OnBrowseButtonClicked()
{
QString all = "All allowed extensions (";
for (u32 iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
for (int iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
{
if (iExt > 0) all += " ";
all += "*." + mSupportedExtensions[iExt];
@ -220,7 +220,7 @@ void WResourceSelector::OnBrowseButtonClicked()
filter += all + ";;";
}
for (u32 iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
for (int iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
{
if (iExt > 0) filter += ";;";
filter += UICommon::ExtensionFilterString(mSupportedExtensions[iExt]);

View File

@ -11,7 +11,7 @@ CLayerModel::~CLayerModel()
{
}
int CLayerModel::rowCount(const QModelIndex &parent) const
int CLayerModel::rowCount(const QModelIndex& /*parent*/) const
{
if (!mpArea) return 0;
if (mHasGenerateLayer) return mpArea->GetScriptLayerCount() + 1;
@ -38,7 +38,7 @@ CScriptLayer* CLayerModel::Layer(const QModelIndex& index) const
if (!mpArea) return nullptr;
u32 NumLayers = mpArea->GetScriptLayerCount();
if (index.row() < NumLayers)
if (index.row() < (int) NumLayers)
return mpArea->GetScriptLayer(index.row());
if (mHasGenerateLayer && (index.row() == NumLayers))
return mpArea->GetGeneratorLayer();

View File

@ -43,27 +43,27 @@ QVariant CLayersInstanceModel::headerData(int section, Qt::Orientation orientati
return QVariant::Invalid;
}
QModelIndex CLayersInstanceModel::index(int row, int column, const QModelIndex &parent) const
QModelIndex CLayersInstanceModel::index(int /*row*/, int /*column*/, const QModelIndex& /*parent*/) const
{
return QModelIndex();
}
QModelIndex CLayersInstanceModel::parent(const QModelIndex &child) const
QModelIndex CLayersInstanceModel::parent(const QModelIndex& /*child*/) const
{
return QModelIndex();
}
int CLayersInstanceModel::rowCount(const QModelIndex &parent) const
int CLayersInstanceModel::rowCount(const QModelIndex& /*parent*/) const
{
return 0;
}
int CLayersInstanceModel::columnCount(const QModelIndex &parent) const
int CLayersInstanceModel::columnCount(const QModelIndex& /*parent*/) const
{
return 3;
}
QVariant CLayersInstanceModel::data(const QModelIndex &index, int role) const
QVariant CLayersInstanceModel::data(const QModelIndex& /*index*/, int /*role*/) const
{
return QVariant::Invalid;
}
@ -75,22 +75,22 @@ void CLayersInstanceModel::SetEditor(CWorldEditor *pEditor)
mpArea = (pEditor ? pEditor->ActiveArea() : nullptr);
}
void CLayersInstanceModel::NodeCreated(CSceneNode *pNode)
void CLayersInstanceModel::NodeCreated(CSceneNode* /*pNode*/)
{
emit layoutChanged();
}
void CLayersInstanceModel::NodeDeleted(CSceneNode *pNode)
void CLayersInstanceModel::NodeDeleted(CSceneNode* /*pNode*/)
{
emit layoutChanged();
}
CScriptLayer* CLayersInstanceModel::IndexLayer(const QModelIndex& index) const
CScriptLayer* CLayersInstanceModel::IndexLayer(const QModelIndex& /*index*/) const
{
return nullptr;
}
CScriptObject* CLayersInstanceModel::IndexObject(const QModelIndex& index) const
CScriptObject* CLayersInstanceModel::IndexObject(const QModelIndex& /*index*/) const
{
return nullptr;
}

View File

@ -34,7 +34,7 @@ int CLinkModel::rowCount(const QModelIndex&) const
else return 0;
}
int CLinkModel::columnCount(const QModelIndex &parent) const
int CLinkModel::columnCount(const QModelIndex& /*parent*/) const
{
return 3;
}

View File

@ -86,7 +86,7 @@ QModelIndex CTypesInstanceModel::index(int row, int column, const QModelIndex &p
if (mModelType == eLayers)
{
CScriptLayer *pLayer = mpArea->GetScriptLayer(parent.row());
if (row >= pLayer->GetNumObjects())
if ((u32) row >= pLayer->GetNumObjects())
return QModelIndex();
else
return createIndex(row, column, (*pLayer)[row]);
@ -95,7 +95,7 @@ QModelIndex CTypesInstanceModel::index(int row, int column, const QModelIndex &p
else if (mModelType == eTypes)
{
const std::list<CScriptObject*>& list = mTemplateList[parent.row()]->ObjectList();
if (row >= list.size())
if ((u32) row >= list.size())
return QModelIndex();
else
{
@ -146,7 +146,7 @@ QModelIndex CTypesInstanceModel::parent(const QModelIndex &child) const
{
CScriptTemplate *pTemp = pObj->Template();
for (u32 iTemp = 0; iTemp < mTemplateList.size(); iTemp++)
for (int iTemp = 0; iTemp < mTemplateList.size(); iTemp++)
{
if (mTemplateList[iTemp] == pTemp)
return createIndex(iTemp, 0, (iTemp << TYPES_ROW_INDEX_SHIFT) | 1);
@ -193,7 +193,7 @@ int CTypesInstanceModel::rowCount(const QModelIndex &parent) const
return 0;
}
int CTypesInstanceModel::columnCount(const QModelIndex &parent) const
int CTypesInstanceModel::columnCount(const QModelIndex& /*parent*/) const
{
return 3;
}

View File

@ -9,7 +9,7 @@ CRotateNodeCommand::CRotateNodeCommand()
{
}
CRotateNodeCommand::CRotateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& nodes, const CVector3f& pivot, const CQuaternion& delta, ETransformSpace transformSpace)
CRotateNodeCommand::CRotateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& nodes, const CVector3f& /*pivot*/, const CQuaternion& delta, ETransformSpace transformSpace)
: QUndoCommand("Rotate"),
mpEditor(pEditor),
mCommandEnded(false)
@ -54,7 +54,7 @@ bool CRotateNodeCommand::mergeWith(const QUndoCommand *other)
if ((mpEditor == pCmd->mpEditor) && (mNodeList.size() == pCmd->mNodeList.size()))
{
for (u32 iNode = 0; iNode < mNodeList.size(); iNode++)
for (int iNode = 0; iNode < mNodeList.size(); iNode++)
{
mNodeList[iNode].newPos = pCmd->mNodeList[iNode].newPos;
mNodeList[iNode].newRot = pCmd->mNodeList[iNode].newRot;

View File

@ -9,7 +9,7 @@ CScaleNodeCommand::CScaleNodeCommand()
{
}
CScaleNodeCommand::CScaleNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& nodes, const CVector3f& pivot, const CVector3f& delta)
CScaleNodeCommand::CScaleNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& nodes, const CVector3f& /*pivot*/, const CVector3f& delta)
: QUndoCommand("Scale"),
mpEditor(pEditor),
mCommandEnded(false)
@ -54,7 +54,7 @@ bool CScaleNodeCommand::mergeWith(const QUndoCommand *other)
if ((mpEditor == pCmd->mpEditor) && (mNodeList.size() == pCmd->mNodeList.size()))
{
for (u32 iNode = 0; iNode < mNodeList.size(); iNode++)
for (int iNode = 0; iNode < mNodeList.size(); iNode++)
{
mNodeList[iNode].newPos = pCmd->mNodeList[iNode].newPos;
mNodeList[iNode].newScale = pCmd->mNodeList[iNode].newScale;

View File

@ -52,7 +52,7 @@ bool CTranslateNodeCommand::mergeWith(const QUndoCommand *other)
if ((mpEditor == pCmd->mpEditor) && (mNodeList.size() == pCmd->mNodeList.size()))
{
for (u32 iNode = 0; iNode < mNodeList.size(); iNode++)
for (int iNode = 0; iNode < mNodeList.size(); iNode++)
mNodeList[iNode].newPos = pCmd->mNodeList[iNode].newPos;
return true;