PathSimulator: Fix many compiler warnings
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="ResetSimulation">
|
||||
<Methode Name="ResetSimulation" NoArgs="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
ResetSimulation():
|
||||
|
||||
@@ -55,7 +55,7 @@ int CAMSimPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
}
|
||||
|
||||
|
||||
PyObject* CAMSimPy::ResetSimulation(PyObject* args)
|
||||
PyObject* CAMSimPy::ResetSimulation()
|
||||
{
|
||||
CAMSim* sim = getCAMSimPtr();
|
||||
sim->resetSimulation();
|
||||
|
||||
@@ -119,6 +119,7 @@ void DlgCAMSimulator::addTool(const std::vector<float> toolProfilePoints,
|
||||
float diameter,
|
||||
float resolution)
|
||||
{
|
||||
Q_UNUSED(resolution)
|
||||
std::string toolCmd = "T" + std::to_string(toolNumber);
|
||||
mMillSimulator->AddGcodeLine(toolCmd.c_str());
|
||||
if (!mMillSimulator->ToolExists(toolNumber)) {
|
||||
@@ -128,6 +129,7 @@ void DlgCAMSimulator::addTool(const std::vector<float> toolProfilePoints,
|
||||
|
||||
void DlgCAMSimulator::hideEvent(QHideEvent* ev)
|
||||
{
|
||||
Q_UNUSED(ev)
|
||||
mAnimating = false;
|
||||
}
|
||||
|
||||
@@ -194,6 +196,7 @@ void DlgCAMSimulator::renderNow()
|
||||
if (mAnimating) {
|
||||
renderLater();
|
||||
}
|
||||
(void)fps;
|
||||
}
|
||||
|
||||
void DlgCAMSimulator::setAnimating(bool animating)
|
||||
@@ -232,9 +235,11 @@ SimStock::SimStock(float px, float py, float pz, float lx, float ly, float lz, f
|
||||
, mLx(lx)
|
||||
, mLy(ly)
|
||||
, mLz(1.01 * lz)
|
||||
{}
|
||||
{
|
||||
(void)res;
|
||||
}
|
||||
|
||||
SimStock::~SimStock()
|
||||
{}
|
||||
|
||||
} // namespace CAMSimulator
|
||||
} // namespace CAMSimulator
|
||||
|
||||
@@ -45,7 +45,7 @@ EndMill::EndMill(const std::vector<float>& toolProfile, int toolid, float diamet
|
||||
}
|
||||
|
||||
// make sure last point is at 0,0 else, add it
|
||||
bool missingCenterPoint = fabs(toolProfile[nPoints * 2 - 2]) > 0.0001f;
|
||||
bool missingCenterPoint = fabs(toolProfile[nPoints * 2 - 2]) > 0.0001F;
|
||||
if (missingCenterPoint) {
|
||||
nPoints++;
|
||||
}
|
||||
@@ -59,10 +59,10 @@ EndMill::EndMill(const std::vector<float>& toolProfile, int toolid, float diamet
|
||||
// copy profile points
|
||||
mHandleAllocation = true;
|
||||
for (int i = 0; i < srcBuffSize; i++) {
|
||||
profilePoints[i] = toolProfile[i] + 0.01f; // add some width to reduce simulation artifacts
|
||||
profilePoints[i] = toolProfile[i] + 0.01F; // add some width to reduce simulation artifacts
|
||||
}
|
||||
if (missingCenterPoint) {
|
||||
profilePoints[srcBuffSize] = profilePoints[srcBuffSize + 1] = 0.0f;
|
||||
profilePoints[srcBuffSize] = profilePoints[srcBuffSize + 1] = 0.0F;
|
||||
}
|
||||
|
||||
MirrorPointBuffer();
|
||||
@@ -105,7 +105,7 @@ EndMill::GenerateArcSegmentDL(float radius, float angleRad, float zShift, Shape*
|
||||
{
|
||||
int nFullPoints = PROFILE_BUFFER_POINTS(nPoints);
|
||||
retShape->ExtrudeProfileRadial(profilePoints,
|
||||
PROFILE_BUFFER_POINTS(nPoints),
|
||||
nFullPoints,
|
||||
radius,
|
||||
angleRad,
|
||||
zShift,
|
||||
|
||||
@@ -43,7 +43,7 @@ GCodeParser::~GCodeParser()
|
||||
bool GCodeParser::Parse(const char* filename)
|
||||
{
|
||||
Operations.clear();
|
||||
lastState = {eNop, -1, 0, 0, 0, 0, 0, 0};
|
||||
lastState = {eNop, -1, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
lastTool = -1;
|
||||
|
||||
FILE* fl;
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
|
||||
public:
|
||||
std::vector<MillMotion> Operations;
|
||||
MillMotion lastState = {eNop};
|
||||
MillMotion lastLastState = {eNop};
|
||||
MillMotion lastState = {eNop, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
MillMotion lastLastState = {eNop, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
|
||||
protected:
|
||||
const char* GetNextToken(const char* ptr, GCToken* token);
|
||||
|
||||
@@ -30,17 +30,17 @@
|
||||
using namespace MillSim;
|
||||
|
||||
GuiItem guiItems[] = {
|
||||
{0, 0, 360, 554, 0},
|
||||
{0, 0, 448, 540, 1},
|
||||
{0, 0, 170, 540, 'P', true},
|
||||
{0, 0, 170, 540, 'S', false},
|
||||
{0, 0, 210, 540, 'T'},
|
||||
{0, 0, 250, 540, 'F'},
|
||||
{0, 0, 290, 540, ' '},
|
||||
{0, 0, 620, 540, 0, false, 0},
|
||||
{0, 0, 660, 540, 0, false, 0},
|
||||
{0, 0, 645, 540, 0, false, 0},
|
||||
{0, 0, 640, 540, 0, true, 0},
|
||||
{0, 0, 360, 554, 0, false, false, {}},
|
||||
{0, 0, 448, 540, 1, false, false, {}},
|
||||
{0, 0, 170, 540, 'P', true, false, {}},
|
||||
{0, 0, 170, 540, 'S', false, false, {}},
|
||||
{0, 0, 210, 540, 'T', false, false, {}},
|
||||
{0, 0, 250, 540, 'F', false, false, {}},
|
||||
{0, 0, 290, 540, ' ', false, false, {}},
|
||||
{0, 0, 620, 540, 0, false, false, {}},
|
||||
{0, 0, 660, 540, 0, false, false, {}},
|
||||
{0, 0, 645, 540, 0, false, false, {}},
|
||||
{0, 0, 640, 540, 0, true, false, {}},
|
||||
};
|
||||
|
||||
#define NUM_GUI_ITEMS (sizeof(guiItems) / sizeof(GuiItem))
|
||||
@@ -108,7 +108,7 @@ bool GuiDisplay::InutGui()
|
||||
return false;
|
||||
}
|
||||
mTexture.LoadImage(buffer, TEX_SIZE, TEX_SIZE);
|
||||
for (int i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
for (unsigned long i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
guiItems[i].texItem = *tLoader.GetTextureItem(i);
|
||||
GenerateGlItem(&(guiItems[i]));
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void GuiDisplay::RenderItem(int itemId)
|
||||
|
||||
void GuiDisplay::MouseCursorPos(int x, int y)
|
||||
{
|
||||
for (int i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
for (unsigned long i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
GuiItem* g = &(guiItems[i]);
|
||||
if (g->actionKey == 0) {
|
||||
continue;
|
||||
@@ -172,7 +172,7 @@ void GuiDisplay::MousePressed(int button, bool isPressed, bool isSimRunning)
|
||||
if (button == MS_MOUSE_LEFT) {
|
||||
if (isPressed) {
|
||||
mPressedItem = eGuiItemMax;
|
||||
for (int i = 1; i < NUM_GUI_ITEMS; i++) {
|
||||
for (unsigned long i = 1; i < NUM_GUI_ITEMS; i++) {
|
||||
GuiItem* g = &(guiItems[i]);
|
||||
if (g->mouseOver && !g->hidden) {
|
||||
mPressedItem = (eGuiItems)i;
|
||||
@@ -196,6 +196,8 @@ void GuiDisplay::MousePressed(int button, bool isPressed, bool isSimRunning)
|
||||
|
||||
void GuiDisplay::MouseDrag(int buttons, int dx, int dy)
|
||||
{
|
||||
(void)buttons;
|
||||
(void)dy;
|
||||
if (mPressedItem == eGuiItemThumb) {
|
||||
GuiItem* g = &(guiItems[eGuiItemThumb]);
|
||||
int newx = g->sx + dx;
|
||||
@@ -237,7 +239,7 @@ void GuiDisplay::Render(float progress)
|
||||
mShader.UpdateTextureSlot(0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
for (int i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
for (unsigned long i = 0; i < NUM_GUI_ITEMS; i++) {
|
||||
RenderItem(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,24 +56,11 @@ float MillPathSegment::mResolution = 1;
|
||||
float MillPathSegment::mSmallRadStep = (PI / 8);
|
||||
|
||||
MillPathSegment::MillPathSegment(EndMill* _endmill, MillMotion* from, MillMotion* to)
|
||||
: mShearMat {1.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f}
|
||||
: mShearMat {{1.0F, 0.0F, 0.0F, 0.0F},
|
||||
{0.0F, 1.0F, 0.0F, 0.0F},
|
||||
{0.0F, 0.0F, 1.0F, 0.0F},
|
||||
{0.0F, 0.0F, 0.0F, 1.0F}}
|
||||
{
|
||||
|
||||
MotionPosToVec(mStartPos, from);
|
||||
MotionPosToVec(mDiff, to);
|
||||
vec3_sub(mDiff, mDiff, mStartPos);
|
||||
@@ -239,4 +226,4 @@ float MillPathSegment::SetQuality(float quality, float maxStockDimension)
|
||||
}
|
||||
return mResolution;
|
||||
}
|
||||
} // namespace MillSim
|
||||
} // namespace MillSim
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace MillSim {
|
||||
|
||||
MillSimulation::MillSimulation()
|
||||
{
|
||||
mCurMotion = { eNop, -1, 0, 0, 0, 0, 0, 0 };
|
||||
mCurMotion = { eNop, -1, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F };
|
||||
guiDisplay.SetMillSimulator(this);
|
||||
}
|
||||
|
||||
@@ -38,16 +38,18 @@ namespace MillSim {
|
||||
// MillSim::MillPathSegment* p = *i;
|
||||
// delete p;
|
||||
//}
|
||||
for (int i = 0; i < MillPathSegments.size(); i++)
|
||||
for (std::size_t i = 0; i < MillPathSegments.size(); i++) {
|
||||
delete MillPathSegments[i];
|
||||
}
|
||||
MillPathSegments.clear();
|
||||
}
|
||||
|
||||
void MillSimulation::Clear()
|
||||
{
|
||||
mCodeParser.Operations.clear();
|
||||
for (int i = 0; i < mToolTable.size(); i++)
|
||||
for (std::size_t i = 0; i < mToolTable.size(); i++) {
|
||||
delete mToolTable[i];
|
||||
}
|
||||
mToolTable.clear();
|
||||
mCurStep = 0;
|
||||
mPathStep = -1;
|
||||
@@ -103,7 +105,7 @@ namespace MillSim {
|
||||
|
||||
EndMill* MillSimulation::GetTool(int toolId)
|
||||
{
|
||||
for (int i = 0; i < mToolTable.size(); i++)
|
||||
for (std::size_t i = 0; i < mToolTable.size(); i++)
|
||||
{
|
||||
if (mToolTable[i]->toolId == toolId)
|
||||
{
|
||||
@@ -495,8 +497,9 @@ namespace MillSim {
|
||||
|
||||
// setup light object and generate tools
|
||||
mlightObject.GenerateBoxStock(-0.5f, -0.5f, -0.5f, 1, 1, 1);
|
||||
for (int i = 0; i < mToolTable.size(); i++)
|
||||
for (std::size_t i = 0; i < mToolTable.size(); i++) {
|
||||
mToolTable[i]->GenerateDisplayLists(quality);
|
||||
}
|
||||
|
||||
// init gui elements
|
||||
guiDisplay.InutGui();
|
||||
@@ -598,4 +601,4 @@ namespace MillSim {
|
||||
CalcSegmentPositions();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ protected:
|
||||
std::vector<MillPathSegment*> MillPathSegments;
|
||||
std::ostringstream mFpsStream;
|
||||
|
||||
MillMotion mZeroPos = {eNop, -1, 0, 0, 100, 0, 0, 0};
|
||||
MillMotion mCurMotion = {eNop, -1, 0, 0, 0, 0, 0, 0};
|
||||
MillMotion mDestMotion = {eNop, -1, 0, 0, 0, 0, 0, 0};
|
||||
MillMotion mZeroPos = {eNop, -1, 0.0F, 0.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
MillMotion mCurMotion = {eNop, -1, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
MillMotion mDestMotion = {eNop, -1, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
|
||||
|
||||
StockObject mStockObject;
|
||||
StockObject mlightObject;
|
||||
@@ -146,4 +146,4 @@ protected:
|
||||
bool mSingleStep = false;
|
||||
};
|
||||
} // namespace MillSim
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -85,6 +85,7 @@ void Shader::UpdateTextureSlot(int slot)
|
||||
bool CheckCompileResult(int shader)
|
||||
{
|
||||
#ifdef QT_OPENGL_LIB
|
||||
(void)shader;
|
||||
return false;
|
||||
#else
|
||||
char log[1024];
|
||||
@@ -269,4 +270,4 @@ const char* FragShaderFlat =
|
||||
" FragColor = vec4(objectColor, 1.0); \n"
|
||||
"} \n";
|
||||
|
||||
} // namespace MillSim
|
||||
} // namespace MillSim
|
||||
|
||||
@@ -52,7 +52,7 @@ TextureLoader::TextureLoader(std::string imgFolder, std::vector<std::string> fil
|
||||
return;
|
||||
}
|
||||
memset(mRawData, 0x80, buffsize);
|
||||
for (int i = 0; i < fileNames.size(); i++) {
|
||||
for (std::size_t i = 0; i < fileNames.size(); i++) {
|
||||
QImage pixmap((imgFolder + fileNames[i]).c_str());
|
||||
AddImage(&(texItems[i]), pixmap, mRawData, textureSize);
|
||||
}
|
||||
@@ -66,7 +66,6 @@ bool TextureLoader::AddImage(TextureItem* texItem,
|
||||
{
|
||||
int width = pixmap.width();
|
||||
int height = pixmap.height();
|
||||
int buffLen = width * height;
|
||||
buffPos += stride * texItem->ty + texItem->tx;
|
||||
for (int i = 0; i < height; i++) {
|
||||
unsigned int* line = reinterpret_cast<unsigned int *>(pixmap.scanLine(i));
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace MillSim
|
||||
|
||||
struct TextureItem
|
||||
{
|
||||
int tx, ty; // texture location
|
||||
int w, h; // item size
|
||||
int tx{}, ty{}; // texture location
|
||||
int w{}, h{}; // item size
|
||||
};
|
||||
|
||||
class TextureLoader
|
||||
|
||||
Reference in New Issue
Block a user