mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Fix for Hermite display.
This commit is contained in:
parent
1a1b1ca3f3
commit
94d0612804
2 changed files with 46 additions and 20 deletions
|
@ -461,6 +461,34 @@ void MetavoxelSystem::render() {
|
||||||
_voxelBaseBatches.clear();
|
_voxelBaseBatches.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_hermiteBatches.isEmpty() && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
||||||
|
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true);
|
||||||
|
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
|
||||||
|
|
||||||
|
foreach (const HermiteBatch& batch, _hermiteBatches) {
|
||||||
|
batch.vertexBuffer->bind();
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, 0);
|
||||||
|
|
||||||
|
glDrawArrays(GL_LINES, 0, batch.vertexCount);
|
||||||
|
|
||||||
|
batch.vertexBuffer->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
|
||||||
|
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
|
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
|
||||||
|
}
|
||||||
|
_hermiteBatches.clear();
|
||||||
|
|
||||||
// give external parties a chance to join in
|
// give external parties a chance to join in
|
||||||
emit rendering();
|
emit rendering();
|
||||||
}
|
}
|
||||||
|
@ -1229,31 +1257,18 @@ void VoxelBuffer::render(bool cursor) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_hermiteCount > 0 && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
if (_hermiteCount > 0) {
|
||||||
if (!_hermiteBuffer.isCreated()) {
|
if (!_hermiteBuffer.isCreated()) {
|
||||||
_hermiteBuffer.create();
|
_hermiteBuffer.create();
|
||||||
_hermiteBuffer.bind();
|
_hermiteBuffer.bind();
|
||||||
_hermiteBuffer.allocate(_hermite.constData(), _hermite.size() * sizeof(glm::vec3));
|
_hermiteBuffer.allocate(_hermite.constData(), _hermite.size() * sizeof(glm::vec3));
|
||||||
|
_hermiteBuffer.release();
|
||||||
_hermite.clear();
|
_hermite.clear();
|
||||||
|
|
||||||
} else {
|
|
||||||
_hermiteBuffer.bind();
|
|
||||||
}
|
}
|
||||||
|
HermiteBatch hermiteBatch;
|
||||||
glVertexPointer(3, GL_FLOAT, 0, 0);
|
hermiteBatch.vertexBuffer = &_hermiteBuffer;
|
||||||
|
hermiteBatch.vertexCount = _hermiteCount;
|
||||||
Application::getInstance()->getDeferredLightingEffect()->getSimpleProgram().bind();
|
Application::getInstance()->getMetavoxels()->addHermiteBatch(hermiteBatch);
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
glNormal3f(0.0f, 1.0f, 0.0f);
|
|
||||||
|
|
||||||
glLineWidth(1.0f);
|
|
||||||
|
|
||||||
glDrawArrays(GL_LINES, 0, _hermiteCount);
|
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->getSimpleProgram().release();
|
|
||||||
|
|
||||||
_hermiteBuffer.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
class HeightfieldBaseLayerBatch;
|
class HeightfieldBaseLayerBatch;
|
||||||
class HeightfieldRendererNode;
|
class HeightfieldRendererNode;
|
||||||
class HeightfieldSplatBatch;
|
class HeightfieldSplatBatch;
|
||||||
|
class HermiteBatch;
|
||||||
class Model;
|
class Model;
|
||||||
class VoxelBatch;
|
class VoxelBatch;
|
||||||
class VoxelSplatBatch;
|
class VoxelSplatBatch;
|
||||||
|
@ -89,6 +90,8 @@ public:
|
||||||
void addVoxelBaseBatch(const VoxelBatch& batch) { _voxelBaseBatches.append(batch); }
|
void addVoxelBaseBatch(const VoxelBatch& batch) { _voxelBaseBatches.append(batch); }
|
||||||
void addVoxelSplatBatch(const VoxelSplatBatch& batch) { _voxelSplatBatches.append(batch); }
|
void addVoxelSplatBatch(const VoxelSplatBatch& batch) { _voxelSplatBatches.append(batch); }
|
||||||
|
|
||||||
|
void addHermiteBatch(const HermiteBatch& batch) { _hermiteBatches.append(batch); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void rendering();
|
void rendering();
|
||||||
|
@ -121,6 +124,7 @@ private:
|
||||||
QVector<HeightfieldSplatBatch> _heightfieldSplatBatches;
|
QVector<HeightfieldSplatBatch> _heightfieldSplatBatches;
|
||||||
QVector<VoxelBatch> _voxelBaseBatches;
|
QVector<VoxelBatch> _voxelBaseBatches;
|
||||||
QVector<VoxelSplatBatch> _voxelSplatBatches;
|
QVector<VoxelSplatBatch> _voxelSplatBatches;
|
||||||
|
QVector<HermiteBatch> _hermiteBatches;
|
||||||
|
|
||||||
ProgramObject _baseHeightfieldProgram;
|
ProgramObject _baseHeightfieldProgram;
|
||||||
int _baseHeightScaleLocation;
|
int _baseHeightScaleLocation;
|
||||||
|
@ -212,6 +216,13 @@ public:
|
||||||
int materialIndex;
|
int materialIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A batch containing Hermite data for debugging.
|
||||||
|
class HermiteBatch {
|
||||||
|
public:
|
||||||
|
QOpenGLBuffer* vertexBuffer;
|
||||||
|
int vertexCount;
|
||||||
|
};
|
||||||
|
|
||||||
/// Generic abstract base class for objects that handle a signal.
|
/// Generic abstract base class for objects that handle a signal.
|
||||||
class SignalHandler : public QObject {
|
class SignalHandler : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in a new issue