Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1019,7 +1019,13 @@ void VoxelBuffer::render(bool cursor) { · 1018 unmodified lines | |||
| 1019 | glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VoxelPoint), &point->color); | 1019 | glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(VoxelPoint), &point->color); |
| 1020 | glNormalPointer(GL_BYTE, sizeof(VoxelPoint), &point->normal); | 1020 | glNormalPointer(GL_BYTE, sizeof(VoxelPoint), &point->normal); |
| 1021 | 1021 | ||
| 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); | ||
| 1023 | 1029 | ||
| 1024 | _vertexBuffer.release(); | 1030 | _vertexBuffer.release(); |
| 1025 | _indexBuffer.release(); | 1031 | _indexBuffer.release(); |
| @@ -1554,7 +1560,9 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 528 unmodified lines | |||
| 1554 | } | 1560 | } |
| 1555 | VoxelBuffer* buffer = NULL; | 1561 | VoxelBuffer* buffer = NULL; |
| 1556 | VoxelColorDataPointer color = info.inputValues.at(0).getInlineValue<VoxelColorDataPointer>(); | 1562 | 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) { | ||
| 1558 | QVector<VoxelPoint> vertices; | 1566 | QVector<VoxelPoint> vertices; |
| 1559 | QVector<int> indices; | 1567 | QVector<int> indices; |
| 1560 | 1568 | ||
| @@ -1569,6 +1577,7 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 8 unmodified lines | |||
| 1569 | 1577 | ||
| 1570 | const QRgb* src = contents.constData(); | 1578 | const QRgb* src = contents.constData(); |
| 1571 | 1579 | ||
| 1580 | float scale = info.size / highest; | ||
| 1572 | const int ALPHA_OFFSET = 24; | 1581 | const int ALPHA_OFFSET = 24; |
| 1573 | const int MAX_ALPHA_TOTAL = EIGHT_BIT_MAXIMUM * 8; | 1582 | const int MAX_ALPHA_TOTAL = EIGHT_BIT_MAXIMUM * 8; |
| 1574 | for (int z = 0; z < highest; z++) { | 1583 | for (int z = 0; z < highest; z++) { |
| @@ -1586,14 +1595,16 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 11 unmodified lines | |||
| 1586 | if (alphaTotal == 0 || alphaTotal == MAX_ALPHA_TOTAL) { | 1595 | if (alphaTotal == 0 || alphaTotal == MAX_ALPHA_TOTAL) { |
| 1587 | continue; // no corners set/all corners set | 1596 | continue; // no corners set/all corners set |
| 1588 | } | 1597 | } |
| 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); | ||
| 1590 | } | 1601 | } |
| 1591 | src++; | 1602 | src++; |
| 1592 | } | 1603 | } |
| 1593 | src += size; | 1604 | src += size; |
| 1594 | } | 1605 | } |
| 1595 | 1606 | ||
| 1596 | buffer = new VoxelBuffer(vertices, indices); | 1607 | buffer = new VoxelBuffer(vertices, indices, material->getMaterials()); |
| 1597 | } | 1608 | } |
| 1598 | info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); | 1609 | info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer))); |
| 1599 | return STOP_RECURSION; | 1610 | return STOP_RECURSION; |
| @@ -1817,6 +1828,17 @@ void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, Metavox · 217 unmodified lines | |||
| 1817 | glDisable(GL_ALPHA_TEST); | 1828 | glDisable(GL_ALPHA_TEST); |
| 1818 | glDisable(GL_CULL_FACE); | 1829 | glDisable(GL_CULL_FACE); |
| 1819 | glEnable(GL_BLEND); | 1830 | 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); | ||
| 1820 | } | 1842 | } |
| 1821 | 1843 | ||
| 1822 | ProgramObject DefaultMetavoxelRendererImplementation::_pointProgram; | 1844 | ProgramObject DefaultMetavoxelRendererImplementation::_pointProgram; |