History

Hermite data computation.

Andrzej Kapolka committed 12 years ago

Commit f02f95c1 parent 2b2bc912 files · +101 −23Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 2 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+26−4
@@ -1019,7 +1019,13 @@ void VoxelBuffer::render(bool cursor) { · 1018 unmodified lines
10191019 glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VoxelPoint), &point->color);
10201020 glNormalPointer(GL_BYTE, sizeof(VoxelPoint), &point->normal);
10211021
1022− glDrawRangeElements(GL_QUADS, 0, _vertexCount - 1, _indexCount, GL_UNSIGNED_INT, 0);
1022+ //glDrawRangeElements(GL_QUADS, 0, _vertexCount - 1, _indexCount, GL_UNSIGNED_INT, 0);
1023+
1024+ glPointSize(5.0f);
1025+
1026+ glDrawArrays(GL_POINTS, 0, _vertexCount);
1027+
1028+ glPointSize(1.0f);
10231029
10241030 _vertexBuffer.release();
10251031 _indexBuffer.release();
@@ -1554,7 +1560,9 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 528 unmodified lines
15541560 }
15551561 VoxelBuffer* buffer = NULL;
15561562 VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>();
1557− if (color) {
1563+ VoxelMaterialDataPointer material = info.inputValues.at(1).getInlineValue<VoxelMaterialDataPointer>();
1564+ VoxelHermiteDataPointer hermite = info.inputValues.at(2).getInlineValue<VoxelHermiteDataPointer>();
1565+ if (color && material && hermite) {
15581566 QVector<VoxelPoint> vertices;
15591567 QVector<int> indices;
15601568
@@ -1569,6 +1577,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 8 unmodified lines
15691577
15701578 const QRgb* src = contents.constData();
15711579
1580+ float scale = info.size / highest;
15721581 const int ALPHA_OFFSET = 24;
15731582 const int MAX_ALPHA_TOTAL = EIGHT_BIT_MAXIMUM * 8;
15741583 for (int z = 0; z < highest; z++) {
@@ -1586,14 +1595,16 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 11 unmodified lines
15861595 if (alphaTotal == 0 || alphaTotal == MAX_ALPHA_TOTAL) {
15871596 continue; // no corners set/all corners set
15881597 }
1589−
1598+ VoxelPoint point = { info.minimum + glm::vec3(x + 0.5f, y + 0.5f, z + 0.5f) * scale,
1599+ { 0, 0, 0 }, { 0, 127, 0} };
1600+ vertices.append(point);
15901601 }
15911602 src++;
15921603 }
15931604 src += size;
15941605 }
15951606
1596− buffer = new VoxelBuffer(vertices, indices);
1607+ buffer = new VoxelBuffer(vertices, indices, material->getMaterials());
15971608 }
15981609 info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
15991610 return STOP_RECURSION;
@@ -1817,6 +1828,17 @@ void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, Metavox · 217 unmodified lines
18171828 glDisable(GL_ALPHA_TEST);
18181829 glDisable(GL_CULL_FACE);
18191830 glEnable(GL_BLEND);
1831+
1832+ glEnableClientState(GL_VERTEX_ARRAY);
1833+ glEnableClientState(GL_COLOR_ARRAY);
1834+ glEnableClientState(GL_NORMAL_ARRAY);
1835+
1836+ BufferRenderVisitor voxelRenderVisitor(Application::getInstance()->getMetavoxels()->getVoxelBufferAttribute());
1837+ data.guide(voxelRenderVisitor);
1838+
1839+ glDisableClientState(GL_VERTEX_ARRAY);
1840+ glDisableClientState(GL_COLOR_ARRAY);
1841+ glDisableClientState(GL_NORMAL_ARRAY);
18201842 }
18211843
18221844 ProgramObject DefaultMetavoxelRendererImplementation::_pointProgram;