mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
Provide the option to display lower detail metavoxel data as points.
This commit is contained in:
parent
049a00b85b
commit
b5b82ed387
5 changed files with 122 additions and 91 deletions
|
@ -425,7 +425,9 @@ Menu::Menu() :
|
||||||
|
|
||||||
QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels");
|
QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels");
|
||||||
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false,
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false,
|
||||||
Application::getInstance()->getMetavoxels(), SLOT(updateHermiteDisplay()));
|
Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData()));
|
||||||
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::LowerDetailAsPoints, 0, false,
|
||||||
|
Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData()));
|
||||||
|
|
||||||
QMenu* handOptionsMenu = developerMenu->addMenu("Hands");
|
QMenu* handOptionsMenu = developerMenu->addMenu("Hands");
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false);
|
||||||
|
|
|
@ -414,6 +414,7 @@ namespace MenuOption {
|
||||||
const QString Log = "Log";
|
const QString Log = "Log";
|
||||||
const QString Logout = "Logout";
|
const QString Logout = "Logout";
|
||||||
const QString LowVelocityFilter = "Low Velocity Filter";
|
const QString LowVelocityFilter = "Low Velocity Filter";
|
||||||
|
const QString LowerDetailAsPoints = "Lower Detail as Points";
|
||||||
const QString MetavoxelEditor = "Metavoxel Editor...";
|
const QString MetavoxelEditor = "Metavoxel Editor...";
|
||||||
const QString Metavoxels = "Metavoxels";
|
const QString Metavoxels = "Metavoxels";
|
||||||
const QString Mirror = "Mirror";
|
const QString Mirror = "Mirror";
|
||||||
|
|
|
@ -137,15 +137,13 @@ void MetavoxelSystem::render() {
|
||||||
emit rendering();
|
emit rendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetavoxelSystem::updateHermiteDisplay() {
|
void MetavoxelSystem::refreshVoxelData() {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||||
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
if (node->getType() == NodeType::MetavoxelServer) {
|
||||||
if (node->getType() == NodeType::MetavoxelServer) {
|
QMutexLocker locker(&node->getMutex());
|
||||||
QMutexLocker locker(&node->getMutex());
|
MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData());
|
||||||
MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData());
|
if (client) {
|
||||||
if (client) {
|
QMetaObject::invokeMethod(client, "refreshVoxelData");
|
||||||
QMetaObject::invokeMethod(client, "refreshVoxelData");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -642,8 +640,47 @@ void PointBuffer::render(bool cursor) {
|
||||||
_buffer.release();
|
_buffer.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelPointBuffer::VoxelPointBuffer(const BufferPointVector& points) :
|
VoxelPointBuffer::VoxelPointBuffer(const BufferPointVector& points, const QVector<glm::vec3>& hermite) :
|
||||||
PointBuffer(points) {
|
PointBuffer(points),
|
||||||
|
_hermite(hermite),
|
||||||
|
_hermiteCount(hermite.size()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void renderHermiteData(QVector<glm::vec3>& hermite, int hermiteCount, QOpenGLBuffer& hermiteBuffer) {
|
||||||
|
if (hermiteCount > 0 && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
||||||
|
if (!hermiteBuffer.isCreated()) {
|
||||||
|
hermiteBuffer.create();
|
||||||
|
hermiteBuffer.bind();
|
||||||
|
hermiteBuffer.allocate(hermite.constData(), hermite.size() * sizeof(glm::vec3));
|
||||||
|
hermite.clear();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
hermiteBuffer.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, 0);
|
||||||
|
|
||||||
|
Application::getInstance()->getDeferredLightingEffect()->getSimpleProgram().bind();
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
glLineWidth(2.0f);
|
||||||
|
|
||||||
|
glDrawArrays(GL_LINES, 0, hermiteCount);
|
||||||
|
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
|
||||||
|
DefaultMetavoxelRendererImplementation::getBaseVoxelProgram().bind();
|
||||||
|
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
hermiteBuffer.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelPointBuffer::render(bool cursor) {
|
void VoxelPointBuffer::render(bool cursor) {
|
||||||
|
@ -656,6 +693,8 @@ void VoxelPointBuffer::render(bool cursor) {
|
||||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
|
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
|
||||||
|
|
||||||
DefaultMetavoxelRendererImplementation::getBaseVoxelProgram().bind();
|
DefaultMetavoxelRendererImplementation::getBaseVoxelProgram().bind();
|
||||||
|
|
||||||
|
renderHermiteData(_hermite, _hermiteCount, _hermiteBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int HeightfieldBuffer::HEIGHT_BORDER = 1;
|
const int HeightfieldBuffer::HEIGHT_BORDER = 1;
|
||||||
|
@ -1136,40 +1175,7 @@ void VoxelBuffer::render(bool cursor) {
|
||||||
_vertexBuffer.release();
|
_vertexBuffer.release();
|
||||||
_indexBuffer.release();
|
_indexBuffer.release();
|
||||||
|
|
||||||
if (_hermiteCount > 0 && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
|
renderHermiteData(_hermite, _hermiteCount, _hermiteBuffer);
|
||||||
if (!_hermiteBuffer.isCreated()) {
|
|
||||||
_hermiteBuffer.create();
|
|
||||||
_hermiteBuffer.bind();
|
|
||||||
_hermiteBuffer.allocate(_hermite.constData(), _hermite.size() * sizeof(glm::vec3));
|
|
||||||
_hermite.clear();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_hermiteBuffer.bind();
|
|
||||||
}
|
|
||||||
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
glDisableClientState(GL_NORMAL_ARRAY);
|
|
||||||
|
|
||||||
glVertexPointer(3, GL_FLOAT, 0, 0);
|
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->getSimpleProgram().bind();
|
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
glNormal3f(0.0f, 1.0f, 0.0f);
|
|
||||||
|
|
||||||
glLineWidth(2.0f);
|
|
||||||
|
|
||||||
glDrawArrays(GL_LINES, 0, _hermiteCount);
|
|
||||||
|
|
||||||
glLineWidth(1.0f);
|
|
||||||
|
|
||||||
DefaultMetavoxelRendererImplementation::getBaseVoxelProgram().bind();
|
|
||||||
|
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
|
||||||
|
|
||||||
_hermiteBuffer.release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferDataAttribute::BufferDataAttribute(const QString& name) :
|
BufferDataAttribute::BufferDataAttribute(const QString& name) :
|
||||||
|
@ -1638,11 +1644,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
if (!info.isLeaf) {
|
if (!info.isLeaf) {
|
||||||
return DEFAULT_ORDER;
|
return DEFAULT_ORDER;
|
||||||
}
|
}
|
||||||
|
const int EDGES_PER_CUBE = 12;
|
||||||
|
|
||||||
BufferData* buffer = NULL;
|
BufferData* buffer = NULL;
|
||||||
VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>();
|
VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>();
|
||||||
VoxelMaterialDataPointer material = info.inputValues.at(1).getInlineValue<VoxelMaterialDataPointer>();
|
VoxelMaterialDataPointer material = info.inputValues.at(1).getInlineValue<VoxelMaterialDataPointer>();
|
||||||
VoxelHermiteDataPointer hermite = info.inputValues.at(2).getInlineValue<VoxelHermiteDataPointer>();
|
VoxelHermiteDataPointer hermite = info.inputValues.at(2).getInlineValue<VoxelHermiteDataPointer>();
|
||||||
if (color && hermite && material) {
|
|
||||||
|
if (color && hermite && (material || !Menu::getInstance()->isOptionChecked(MenuOption::LowerDetailAsPoints))) {
|
||||||
QVector<VoxelPoint> vertices;
|
QVector<VoxelPoint> vertices;
|
||||||
QVector<int> indices;
|
QVector<int> indices;
|
||||||
QVector<glm::vec3> hermiteSegments;
|
QVector<glm::vec3> hermiteSegments;
|
||||||
|
@ -1677,7 +1686,6 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
QVector<AxisIndex> planeIndices(expanded * expanded);
|
QVector<AxisIndex> planeIndices(expanded * expanded);
|
||||||
QVector<AxisIndex> lastPlaneIndices(expanded * expanded);
|
QVector<AxisIndex> lastPlaneIndices(expanded * expanded);
|
||||||
|
|
||||||
const int EDGES_PER_CUBE = 12;
|
|
||||||
EdgeCrossing crossings[EDGES_PER_CUBE];
|
EdgeCrossing crossings[EDGES_PER_CUBE];
|
||||||
|
|
||||||
float highest = size - 1.0f;
|
float highest = size - 1.0f;
|
||||||
|
@ -2182,6 +2190,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
|
|
||||||
} else if (color && hermite) {
|
} else if (color && hermite) {
|
||||||
BufferPointVector points;
|
BufferPointVector points;
|
||||||
|
QVector<glm::vec3> hermiteSegments;
|
||||||
|
|
||||||
const QVector<QRgb>& colorContents = color->getContents();
|
const QVector<QRgb>& colorContents = color->getContents();
|
||||||
const QVector<QRgb>& hermiteContents = hermite->getContents();
|
const QVector<QRgb>& hermiteContents = hermite->getContents();
|
||||||
|
@ -2201,6 +2210,9 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
const QRgb* hermiteData = hermiteContents.constData();
|
const QRgb* hermiteData = hermiteContents.constData();
|
||||||
int hermiteStride = hermite->getSize() * VoxelHermiteData::EDGE_COUNT;
|
int hermiteStride = hermite->getSize() * VoxelHermiteData::EDGE_COUNT;
|
||||||
int hermiteArea = hermiteStride * hermite->getSize();
|
int hermiteArea = hermiteStride * hermite->getSize();
|
||||||
|
bool displayHermite = Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData);
|
||||||
|
|
||||||
|
EdgeCrossing crossings[EDGES_PER_CUBE];
|
||||||
|
|
||||||
for (int z = 0; z < limit; z++) {
|
for (int z = 0; z < limit; z++) {
|
||||||
const QRgb* colorY = colorZ;
|
const QRgb* colorY = colorZ;
|
||||||
|
@ -2218,80 +2230,90 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
}
|
}
|
||||||
const QRgb* hermiteBase = hermiteData + z * hermiteArea + y * hermiteStride +
|
const QRgb* hermiteBase = hermiteData + z * hermiteArea + y * hermiteStride +
|
||||||
x * VoxelHermiteData::EDGE_COUNT;
|
x * VoxelHermiteData::EDGE_COUNT;
|
||||||
glm::vec3 normal;
|
|
||||||
glm::vec3 position;
|
|
||||||
int crossingCount = 0;
|
int crossingCount = 0;
|
||||||
if (a0 != a1) {
|
if (a0 != a1) {
|
||||||
QRgb hermite = hermiteBase[0];
|
QRgb hermite = hermiteBase[0];
|
||||||
position += glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 0.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 0.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a0 != a2) {
|
if (a0 != a2) {
|
||||||
QRgb hermite = hermiteBase[1];
|
QRgb hermite = hermiteBase[1];
|
||||||
position += glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a0 != a4) {
|
if (a0 != a4) {
|
||||||
QRgb hermite = hermiteBase[2];
|
QRgb hermite = hermiteBase[2];
|
||||||
position += glm::vec3(0.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(0.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a1 != a3) {
|
if (a1 != a3) {
|
||||||
QRgb hermite = hermiteBase[VoxelHermiteData::EDGE_COUNT + 1];
|
QRgb hermite = hermiteBase[VoxelHermiteData::EDGE_COUNT + 1];
|
||||||
position += glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a1 != a5) {
|
if (a1 != a5) {
|
||||||
QRgb hermite = hermiteBase[VoxelHermiteData::EDGE_COUNT + 2];
|
QRgb hermite = hermiteBase[VoxelHermiteData::EDGE_COUNT + 2];
|
||||||
position += glm::vec3(1.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(1.0f, 0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a2 != a3) {
|
if (a2 != a3) {
|
||||||
QRgb hermite = hermiteBase[hermiteStride];
|
QRgb hermite = hermiteBase[hermiteStride];
|
||||||
position += glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 0.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 0.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a2 != a6) {
|
if (a2 != a6) {
|
||||||
QRgb hermite = hermiteBase[hermiteStride + 2];
|
QRgb hermite = hermiteBase[hermiteStride + 2];
|
||||||
position += glm::vec3(0.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(0.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a3 != a7) {
|
if (a3 != a7) {
|
||||||
QRgb hermite = hermiteBase[hermiteStride + VoxelHermiteData::EDGE_COUNT + 2];
|
QRgb hermite = hermiteBase[hermiteStride + VoxelHermiteData::EDGE_COUNT + 2];
|
||||||
position += glm::vec3(1.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(1.0f, 1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a4 != a5) {
|
if (a4 != a5) {
|
||||||
QRgb hermite = hermiteBase[hermiteArea];
|
QRgb hermite = hermiteBase[hermiteArea];
|
||||||
position += glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 1.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 0.0f, 1.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a4 != a6) {
|
if (a4 != a6) {
|
||||||
QRgb hermite = hermiteBase[hermiteArea + 1];
|
QRgb hermite = hermiteBase[hermiteArea + 1];
|
||||||
position += glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(0.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a5 != a7) {
|
if (a5 != a7) {
|
||||||
QRgb hermite = hermiteBase[hermiteArea + VoxelHermiteData::EDGE_COUNT + 1];
|
QRgb hermite = hermiteBase[hermiteArea + VoxelHermiteData::EDGE_COUNT + 1];
|
||||||
position += glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(1.0f, qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
}
|
}
|
||||||
if (a6 != a7) {
|
if (a6 != a7) {
|
||||||
QRgb hermite = hermiteBase[hermiteArea + hermiteStride];
|
QRgb hermite = hermiteBase[hermiteArea + hermiteStride];
|
||||||
position += glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 1.0f);
|
EdgeCrossing& crossing = crossings[crossingCount++];
|
||||||
normal += unpackNormal(hermite);
|
crossing.point = glm::vec3(qAlpha(hermite) * EIGHT_BIT_MAXIMUM_RECIPROCAL, 1.0f, 1.0f);
|
||||||
crossingCount++;
|
crossing.normal = unpackNormal(hermite);
|
||||||
|
}
|
||||||
|
glm::vec3 normal;
|
||||||
|
glm::vec3 position;
|
||||||
|
for (int i = 0; i < crossingCount; i++) {
|
||||||
|
const EdgeCrossing& crossing = crossings[i];
|
||||||
|
position += crossing.point;
|
||||||
|
normal += crossing.normal;
|
||||||
|
if (displayHermite) {
|
||||||
|
glm::vec3 base = glm::vec3(minimum) + (glm::vec3(x, y, z) + crossing.point) * step;
|
||||||
|
hermiteSegments.append(base);
|
||||||
|
hermiteSegments.append(base + crossing.normal * step);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
normal = safeNormalize(normal);
|
normal = safeNormalize(normal);
|
||||||
BufferPoint point = { minimum + (glm::vec4(x, y, z, 1.0f) +
|
BufferPoint point = { minimum + (glm::vec4(x, y, z, 1.0f) +
|
||||||
|
@ -2309,7 +2331,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) {
|
||||||
}
|
}
|
||||||
colorZ += area;
|
colorZ += area;
|
||||||
}
|
}
|
||||||
buffer = new VoxelPointBuffer(points);
|
buffer = new VoxelPointBuffer(points, hermiteSegments);
|
||||||
}
|
}
|
||||||
BufferDataPointer pointer(buffer);
|
BufferDataPointer pointer(buffer);
|
||||||
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
|
||||||
|
|
|
@ -58,7 +58,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void updateHermiteDisplay();
|
void refreshVoxelData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -150,9 +150,15 @@ private:
|
||||||
class VoxelPointBuffer : public PointBuffer {
|
class VoxelPointBuffer : public PointBuffer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VoxelPointBuffer(const BufferPointVector& points);
|
VoxelPointBuffer(const BufferPointVector& points, const QVector<glm::vec3>& hermite);
|
||||||
|
|
||||||
virtual void render(bool cursor = false);
|
virtual void render(bool cursor = false);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QVector<glm::vec3> _hermite;
|
||||||
|
int _hermiteCount;
|
||||||
|
QOpenGLBuffer _hermiteBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Contains the information necessary to render a heightfield block.
|
/// Contains the information necessary to render a heightfield block.
|
||||||
|
|
|
@ -1657,11 +1657,11 @@ bool VoxelColorAttribute::merge(void*& parent, void* children[], bool postRead)
|
||||||
src += (1 + offset1);
|
src += (1 + offset1);
|
||||||
int a0 = qAlpha(v0), a1 = qAlpha(v1), a2 = qAlpha(v2), a3 = qAlpha(v3),
|
int a0 = qAlpha(v0), a1 = qAlpha(v1), a2 = qAlpha(v2), a3 = qAlpha(v3),
|
||||||
a4 = qAlpha(v4), a5 = qAlpha(v5), a6 = qAlpha(v6), a7 = qAlpha(v7);
|
a4 = qAlpha(v4), a5 = qAlpha(v5), a6 = qAlpha(v6), a7 = qAlpha(v7);
|
||||||
int alphaTotal = a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7;
|
if (a0 == 0) {
|
||||||
if (alphaTotal == 0) {
|
|
||||||
*dest++ = qRgba(0, 0, 0, 0);
|
*dest++ = qRgba(0, 0, 0, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
int alphaTotal = a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7;
|
||||||
*dest++ = qRgba(
|
*dest++ = qRgba(
|
||||||
(qRed(v0) * a0 + qRed(v1) * a1 + qRed(v2) * a2 + qRed(v3) * a3 +
|
(qRed(v0) * a0 + qRed(v1) * a1 + qRed(v2) * a2 + qRed(v3) * a3 +
|
||||||
qRed(v4) * a4 + qRed(v5) * a5 + qRed(v6) * a6 + qRed(v7) * a7) / alphaTotal,
|
qRed(v4) * a4 + qRed(v5) * a5 + qRed(v6) * a6 + qRed(v7) * a7) / alphaTotal,
|
||||||
|
|
Loading…
Reference in a new issue