Cam simulator feature update (#15597)

* remove redundant code

* Improve lighting, add ambient occlusion

* Add cleanup code. Dialog is now deleted when cloesd.

* change back to ambient occlusion

* Fix G8x drill sequence bug.  issue #14369

* fix bad simulation artifacts under Linux and QT. Issue #14369

* fix merge issue

* fix border artifact on buttons

* support showing path lines. revise the gui.

* add option for arbitrary solids. wip

* use vectors instead of mallocs

* Handle arbitrary stock shapes + show base shape.

* Complete the base shape display feature. eliminate co-planar artifacts.

* support window scaling. upstream issue #14334

* Apply lint fixes

* some missing lints.

* Attend pylint issues

* Apply code fixes based on @kadet1090 review

* fix some clang-tidy warnings.

* CAM: Linter cleanup round 1

---------

Co-authored-by: Chris Hennes <chennes@gmail.com>
This commit is contained in:
Shai Seger
2024-08-21 23:18:52 +03:00
committed by GitHub
parent c4a506146f
commit 778107939c
42 changed files with 2744 additions and 1067 deletions

View File

@@ -0,0 +1,60 @@
#include "MillPathLine.h"
#include "OpenGlWrapper.h"
#include "GlUtils.h"
#include "Shader.h"
namespace MillSim
{
MillPathLine::MillPathLine()
{
mVao = mVbo = 0;
}
void MillPathLine::GenerateModel()
{
mNumVerts = MillPathPointsBuffer.size();
void* vbuffer = MillPathPointsBuffer.data();
// vertex array
glGenVertexArrays(1, &mVao);
glBindVertexArray(mVao);
// vertex buffer
glGenBuffers(1, &mVbo);
glBindBuffer(GL_ARRAY_BUFFER, mVbo);
glBufferData(GL_ARRAY_BUFFER, mNumVerts * sizeof(MillPathPosition), vbuffer, GL_STATIC_DRAW);
// vertex attribs
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MillPathPosition),
(void*)offsetof(MillPathPosition, X));
glEnableVertexAttribArray(1);
glVertexAttribIPointer(1, 1, GL_INT, sizeof(MillPathPosition),
(void*)offsetof(MillPathPosition, SegmentId));
// unbind and free
glBindVertexArray(0);
MillPathPointsBuffer.clear();
}
void MillPathLine::Clear()
{
MillPathPointsBuffer.clear();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
GLDELETE_BUFFER(mVbo);
GLDELETE_VERTEXARRAY(mVao);
}
void MillPathLine::Render()
{
glBindVertexArray(mVao);
glDrawArrays(GL_LINE_STRIP, 0, mNumVerts);
}
} // namespace Millsim