Tidying up.
This commit is contained in:
parent
ec08b28002
commit
b97bf52214
@ -173,7 +173,6 @@ int main(int argc, char *argv[])
|
||||
cout << endl << "Time taken = " << time.elapsed() / 1000.0f << "s" << endl << endl;
|
||||
|
||||
const int32_t extractedRegionSize = 32;
|
||||
const int32_t gapBetweenRegions = 1; // Set this to '1'
|
||||
int meshCounter = 0;
|
||||
|
||||
for (int32_t z = 0; z < volData.getDepth(); z += extractedRegionSize)
|
||||
|
@ -135,7 +135,7 @@ void OpenGLWidget::paintGL()
|
||||
for (OpenGLMeshData meshData : mMeshData)
|
||||
{
|
||||
QMatrix4x4 modelToWorldMatrix{};
|
||||
modelToWorldMatrix.translate(meshData.translation.getX(), meshData.translation.getY(), meshData.translation.getZ());
|
||||
modelToWorldMatrix.translate(meshData.translation);
|
||||
modelToWorldMatrix.scale(meshData.scale);
|
||||
shader->setUniformValue("modelToWorldMatrix", modelToWorldMatrix);
|
||||
|
||||
|
@ -31,16 +31,21 @@ distribution.
|
||||
#include <QGLWidget>
|
||||
#include <QGLShaderProgram>
|
||||
|
||||
// This structure holds all the data required
|
||||
// to render one of our meshes through OpenGL.
|
||||
struct OpenGLMeshData
|
||||
{
|
||||
GLuint noOfIndices;
|
||||
GLuint indexBuffer;
|
||||
GLuint vertexBuffer;
|
||||
GLuint vertexArrayObject;
|
||||
PolyVox::Vector3DInt32 translation;
|
||||
QVector3D translation;
|
||||
float scale;
|
||||
};
|
||||
|
||||
// Our OpenGLWidget is used by all the examples to render the extracted meshes. It is
|
||||
// fairly specific to our needs (you probably won't want to use it in your own project)
|
||||
// but should provide a useful illustration of how PolyVox meshes can be rendered.
|
||||
class OpenGLWidget : public QGLWidget
|
||||
{
|
||||
public:
|
||||
@ -51,9 +56,11 @@ public:
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
// The viewable region can be adjusted so that this example framework can be use for different volume sizes.
|
||||
// The viewable region can be adjusted so that this example framework can be used for different volume sizes.
|
||||
void setViewableRegion(PolyVox::Region viewableRegion);
|
||||
|
||||
// For our purposes we use a single shader for the whole volume, and
|
||||
// this example framework is only meant to show a single volume at a time
|
||||
void setShader(QGLShaderProgram* shader)
|
||||
{
|
||||
this->shader = shader;
|
||||
@ -100,7 +107,7 @@ public:
|
||||
|
||||
meshData.noOfIndices = vecIndices.size(); //Save this for the call to glDrawElements later
|
||||
|
||||
meshData.translation = translation;
|
||||
meshData.translation = QVector3D(translation.getX(), translation.getY(), translation.getZ());
|
||||
meshData.scale = scale;
|
||||
|
||||
mMeshData.push_back(meshData);
|
||||
@ -108,7 +115,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// Qt OpenGL functions
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
|
Loading…
x
Reference in New Issue
Block a user