Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 8 files). Show all
Unified · Split
| @@ -25,7 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "MetavoxelSystem.h" |
| 26 | 26 | #include "renderer/Model.h" |
| 27 | 27 | |
| 28 | −REGISTER_META_OBJECT(PointMetavoxelRendererImplementation) | |
| 28 | +REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation) | |
| 29 | 29 | REGISTER_META_OBJECT(SphereRenderer) |
| 30 | 30 | REGISTER_META_OBJECT(StaticModelRenderer) |
| 31 | 31 | |
| @@ -33,8 +33,10 @@ static int bufferPointVectorMetaTypeId = qRegisterMetaType<BufferPointVector>(); · 1 unmodified line | ||
| 33 | 33 | |
| 34 | 34 | void MetavoxelSystem::init() { |
| 35 | 35 | MetavoxelClientManager::init(); |
| 36 | − PointMetavoxelRendererImplementation::init(); | |
| 37 | − _pointBufferAttribute = AttributeRegistry::getInstance()->registerAttribute(new PointBufferAttribute()); | |
| 36 | + DefaultMetavoxelRendererImplementation::init(); | |
| 37 | + _pointBufferAttribute = AttributeRegistry::getInstance()->registerAttribute(new BufferDataAttribute("pointBuffer")); | |
| 38 | + _heightfieldBufferAttribute = AttributeRegistry::getInstance()->registerAttribute( | |
| 39 | + new BufferDataAttribute("heightfieldBuffer")); | |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | MetavoxelLOD MetavoxelSystem::getLOD() { |
| @@ -42,28 +44,31 @@ MetavoxelLOD MetavoxelSystem::getLOD() { · 1 unmodified line | ||
| 42 | 44 | return _lod; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | −class SpannerSimulateVisitor : public SpannerVisitor { | |
| 47 | +class SimulateVisitor : public MetavoxelVisitor { | |
| 46 | 48 | public: |
| 47 | 49 | |
| 48 | − SpannerSimulateVisitor(float deltaTime); | |
| 50 | + SimulateVisitor(float deltaTime, const MetavoxelLOD& lod); | |
| 49 | 51 | |
| 50 | − virtual bool visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize); | |
| 52 | + virtual int visit(MetavoxelInfo& info); | |
| 51 | 53 | |
| 52 | 54 | private: |
| 53 | 55 | |
| 54 | 56 | float _deltaTime; |
| 55 | 57 | }; |
| 56 | 58 | |
| 57 | −SpannerSimulateVisitor::SpannerSimulateVisitor(float deltaTime) : | |
| 58 | − SpannerVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getSpannersAttribute(), | |
| 59 | − QVector<AttributePointer>(), QVector<AttributePointer>(), QVector<AttributePointer>(), | |
| 60 | − Application::getInstance()->getMetavoxels()->getLOD()), | |
| 59 | +SimulateVisitor::SimulateVisitor(float deltaTime, const MetavoxelLOD& lod) : | |
| 60 | + MetavoxelVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getRendererAttribute(), | |
| 61 | + QVector<AttributePointer>(), lod), | |
| 61 | 62 | _deltaTime(deltaTime) { |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | −bool SpannerSimulateVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { | |
| 65 | − spanner->getRenderer()->simulate(_deltaTime); | |
| 66 | − return true; | |
| 65 | +int SimulateVisitor::visit(MetavoxelInfo& info) { | |
| 66 | + if (!info.isLeaf) { | |
| 67 | + return DEFAULT_ORDER; | |
| 68 | + } | |
| 69 | + static_cast<MetavoxelRenderer*>(info.inputValues.at(0).getInlineValue< | |
| 70 | + SharedObjectPointer>().data())->getImplementation()->simulate(*_data, _deltaTime, info, _lod); | |
| 71 | + return STOP_RECURSION; | |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | 74 | void MetavoxelSystem::simulate(float deltaTime) { |
| @@ -76,28 +81,8 @@ void MetavoxelSystem::simulate(float deltaTime) { · 6 unmodified lines | ||
| 76 | 81 | BASE_LOD_THRESHOLD * Menu::getInstance()->getAvatarLODDistanceMultiplier()); |
| 77 | 82 | } |
| 78 | 83 | |
| 79 | − SpannerSimulateVisitor spannerSimulateVisitor(deltaTime); | |
| 80 | − guide(spannerSimulateVisitor); | |
| 81 | −} | |
| 82 | − | |
| 83 | −class SpannerRenderVisitor : public SpannerVisitor { | |
| 84 | −public: | |
| 85 | − | |
| 86 | − SpannerRenderVisitor(); | |
| 87 | − | |
| 88 | − virtual bool visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize); | |
| 89 | −}; | |
| 90 | − | |
| 91 | −SpannerRenderVisitor::SpannerRenderVisitor() : | |
| 92 | − SpannerVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getSpannersAttribute(), | |
| 93 | − QVector<AttributePointer>(), QVector<AttributePointer>(), QVector<AttributePointer>(), | |
| 94 | − Application::getInstance()->getMetavoxels()->getLOD(), | |
| 95 | − encodeOrder(Application::getInstance()->getViewFrustum()->getDirection())) { | |
| 96 | −} | |
| 97 | − | |
| 98 | −bool SpannerRenderVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { | |
| 99 | − spanner->getRenderer()->render(1.0f, SpannerRenderer::DEFAULT_MODE, clipMinimum, clipSize); | |
| 100 | − return true; | |
| 84 | + SimulateVisitor simulateVisitor(deltaTime, getLOD()); | |
| 85 | + guideToAugmented(simulateVisitor); | |
| 101 | 86 | } |
| 102 | 87 | |
| 103 | 88 | class RenderVisitor : public MetavoxelVisitor { |
| @@ -125,9 +110,6 @@ int RenderVisitor::visit(MetavoxelInfo& info) { · 21 unmodified lines | ||
| 125 | 110 | void MetavoxelSystem::render() { |
| 126 | 111 | RenderVisitor renderVisitor(getLOD()); |
| 127 | 112 | guideToAugmented(renderVisitor); |
| 128 | − | |
| 129 | − SpannerRenderVisitor spannerRenderVisitor; | |
| 130 | − guide(spannerRenderVisitor); | |
| 131 | 113 | } |
| 132 | 114 | |
| 133 | 115 | MetavoxelClient* MetavoxelSystem::createClient(const SharedNodePointer& node) { |
| @@ -239,6 +221,9 @@ void MetavoxelSystemClient::sendDatagram(const QByteArray& data) { · 105 unmodified lines | ||
| 239 | 221 | Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::METAVOXELS).updateValue(data.size()); |
| 240 | 222 | } |
| 241 | 223 | |
| 224 | +BufferData::~BufferData() { | |
| 225 | +} | |
| 226 | + | |
| 242 | 227 | PointBuffer::PointBuffer(const BufferPointVector& points) : |
| 243 | 228 | _points(points) { |
| 244 | 229 | } |
| @@ -269,34 +254,76 @@ void PointBuffer::render() { · 24 unmodified lines | ||
| 269 | 254 | _buffer.release(); |
| 270 | 255 | } |
| 271 | 256 | |
| 272 | −PointBufferAttribute::PointBufferAttribute() : | |
| 273 | − InlineAttribute<PointBufferPointer>("pointBuffer") { | |
| 257 | +HeightfieldBuffer::HeightfieldBuffer(const QByteArray& height, const QByteArray& color, const QByteArray& normal) : | |
| 258 | + _height(height), | |
| 259 | + _color(color), | |
| 260 | + _normal(normal), | |
| 261 | + _heightTexture(QOpenGLTexture::Target2D), | |
| 262 | + _colorTexture(QOpenGLTexture::Target2D), | |
| 263 | + _normalTexture(QOpenGLTexture::Target2D) { | |
| 264 | +} | |
| 265 | + | |
| 266 | +void HeightfieldBuffer::render() { | |
| 267 | + // initialize textures, etc. on first render | |
| 268 | + if (!_heightTexture.isCreated()) { | |
| 269 | + int heightSize = glm::sqrt(_height.size()); | |
| 270 | + _heightTexture.setSize(heightSize, heightSize); | |
| 271 | + _heightTexture.setFormat(QOpenGLTexture::LuminanceFormat); | |
| 272 | + _heightTexture.allocateStorage(); | |
| 273 | + _heightTexture.setData(QOpenGLTexture::Luminance, QOpenGLTexture::UInt8, _height.data()); | |
| 274 | + _height.clear(); | |
| 275 | + | |
| 276 | + int colorSize = glm::sqrt(_color.size() / 3); | |
| 277 | + _colorTexture.setSize(colorSize, colorSize); | |
| 278 | + _colorTexture.setFormat(QOpenGLTexture::RGBFormat); | |
| 279 | + _colorTexture.allocateStorage(); | |
| 280 | + _colorTexture.setData(QOpenGLTexture::BGR, QOpenGLTexture::UInt8, _color.data()); | |
| 281 | + _color.clear(); | |
| 282 | + | |
| 283 | + int normalSize = glm::sqrt(_normal.size() / 3); | |
| 284 | + _normalTexture.setSize(normalSize, normalSize); | |
| 285 | + _normalTexture.setFormat(QOpenGLTexture::RGBFormat); | |
| 286 | + _normalTexture.allocateStorage(); | |
| 287 | + _normalTexture.setData(QOpenGLTexture::BGR, QOpenGLTexture::UInt8, _normal.data()); | |
| 288 | + _normal.clear(); | |
| 289 | + } | |
| 290 | + | |
| 274 | 291 | } |
| 275 | 292 | |
| 276 | −bool PointBufferAttribute::merge(void*& parent, void* children[], bool postRead) const { | |
| 277 | − PointBufferPointer firstChild = decodeInline<PointBufferPointer>(children[0]); | |
| 293 | +BufferDataAttribute::BufferDataAttribute(const QString& name) : | |
| 294 | + InlineAttribute<BufferDataPointer>(name) { | |
| 295 | +} | |
| 296 | + | |
| 297 | +bool BufferDataAttribute::merge(void*& parent, void* children[], bool postRead) const { | |
| 298 | + BufferDataPointer firstChild = decodeInline<BufferDataPointer>(children[0]); | |
| 278 | 299 | for (int i = 1; i < MERGE_COUNT; i++) { |
| 279 | − if (firstChild != decodeInline<PointBufferPointer>(children[i])) { | |
| 280 | − *(PointBufferPointer*)&parent = _defaultValue; | |
| 300 | + if (firstChild != decodeInline<BufferDataPointer>(children[i])) { | |
| 301 | + *(BufferDataPointer*)&parent = _defaultValue; | |
| 281 | 302 | return false; |
| 282 | 303 | } |
| 283 | 304 | } |
| 284 | − *(PointBufferPointer*)&parent = firstChild; | |
| 305 | + *(BufferDataPointer*)&parent = firstChild; | |
| 285 | 306 | return true; |
| 286 | 307 | } |
| 287 | 308 | |
| 288 | −void PointMetavoxelRendererImplementation::init() { | |
| 289 | − if (!_program.isLinked()) { | |
| 290 | − _program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert"); | |
| 291 | − _program.link(); | |
| 309 | +void DefaultMetavoxelRendererImplementation::init() { | |
| 310 | + if (!_pointProgram.isLinked()) { | |
| 311 | + _pointProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert"); | |
| 312 | + _pointProgram.link(); | |
| 292 | 313 | |
| 293 | − _program.bind(); | |
| 294 | − _pointScaleLocation = _program.uniformLocation("pointScale"); | |
| 295 | − _program.release(); | |
| 314 | + _pointProgram.bind(); | |
| 315 | + _pointScaleLocation = _pointProgram.uniformLocation("pointScale"); | |
| 316 | + _pointProgram.release(); | |
| 317 | + | |
| 318 | + _heightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + | |
| 319 | + "shaders/metavoxel_heightfield.vert"); | |
| 320 | + _heightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + | |
| 321 | + "shaders/metavoxel_heightfield.frag"); | |
| 322 | + _heightfieldProgram.link(); | |
| 296 | 323 | } |
| 297 | 324 | } |
| 298 | 325 | |
| 299 | −PointMetavoxelRendererImplementation::PointMetavoxelRendererImplementation() { | |
| 326 | +DefaultMetavoxelRendererImplementation::DefaultMetavoxelRendererImplementation() { | |
| 300 | 327 | } |
| 301 | 328 | |
| 302 | 329 | class PointAugmentVisitor : public MetavoxelVisitor { |
| @@ -344,7 +371,7 @@ int PointAugmentVisitor::visit(MetavoxelInfo& info) { · 41 unmodified lines | ||
| 344 | 371 | if (info.size >= _pointLeafSize) { |
| 345 | 372 | BufferPointVector swapPoints; |
| 346 | 373 | _points.swap(swapPoints); |
| 347 | − info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(PointBufferPointer( | |
| 374 | + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer( | |
| 348 | 375 | new PointBuffer(swapPoints)))); |
| 349 | 376 | } |
| 350 | 377 | return STOP_RECURSION; |
| @@ -356,12 +383,30 @@ bool PointAugmentVisitor::postVisit(MetavoxelInfo& info) { · 5 unmodified lines | ||
| 356 | 383 | } |
| 357 | 384 | BufferPointVector swapPoints; |
| 358 | 385 | _points.swap(swapPoints); |
| 359 | − info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(PointBufferPointer( | |
| 386 | + info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer( | |
| 360 | 387 | new PointBuffer(swapPoints)))); |
| 361 | 388 | return true; |
| 362 | 389 | } |
| 363 | 390 | |
| 364 | −void PointMetavoxelRendererImplementation::augment(MetavoxelData& data, const MetavoxelData& previous, | |
| 391 | +class HeightfieldAugmentVisitor : public MetavoxelVisitor { | |
| 392 | +public: | |
| 393 | + | |
| 394 | + HeightfieldAugmentVisitor(const MetavoxelLOD& lod); | |
| 395 | + | |
| 396 | + virtual int visit(MetavoxelInfo& info); | |
| 397 | +}; | |
| 398 | + | |
| 399 | +HeightfieldAugmentVisitor::HeightfieldAugmentVisitor(const MetavoxelLOD& lod) : | |
| 400 | + MetavoxelVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getHeightfieldAttribute() << | |
| 401 | + AttributeRegistry::getInstance()->getHeightfieldColorAttribute(), QVector<AttributePointer>() << | |
| 402 | + Application::getInstance()->getMetavoxels()->getHeightfieldBufferAttribute(), lod) { | |
| 403 | +} | |
| 404 | + | |
| 405 | +int HeightfieldAugmentVisitor::visit(MetavoxelInfo& info) { | |
| 406 | + return STOP_RECURSION; | |
| 407 | +} | |
| 408 | + | |
| 409 | +void DefaultMetavoxelRendererImplementation::augment(MetavoxelData& data, const MetavoxelData& previous, | |
| 365 | 410 | MetavoxelInfo& info, const MetavoxelLOD& lod) { |
| 366 | 411 | // copy the previous buffers |
| 367 | 412 | MetavoxelData expandedPrevious = previous; |
| @@ -377,12 +422,62 @@ void PointMetavoxelRendererImplementation::augment(MetavoxelData& data, const Me · 9 unmodified lines | ||
| 377 | 422 | |
| 378 | 423 | PointAugmentVisitor visitor(lod); |
| 379 | 424 | data.guideToDifferent(expandedPrevious, visitor); |
| 425 | + | |
| 426 | + | |
| 427 | +} | |
| 428 | + | |
| 429 | +class SpannerSimulateVisitor : public SpannerVisitor { | |
| 430 | +public: | |
| 431 | + | |
| 432 | + SpannerSimulateVisitor(float deltaTime, const MetavoxelLOD& lod); | |
| 433 | + | |
| 434 | + virtual bool visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize); | |
| 435 | + | |
| 436 | +private: | |
| 437 | + | |
| 438 | + float _deltaTime; | |
| 439 | +}; | |
| 440 | + | |
| 441 | +SpannerSimulateVisitor::SpannerSimulateVisitor(float deltaTime, const MetavoxelLOD& lod) : | |
| 442 | + SpannerVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getSpannersAttribute(), | |
| 443 | + QVector<AttributePointer>(), QVector<AttributePointer>(), QVector<AttributePointer>(), lod), | |
| 444 | + _deltaTime(deltaTime) { | |
| 445 | +} | |
| 446 | + | |
| 447 | +bool SpannerSimulateVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { | |
| 448 | + spanner->getRenderer()->simulate(_deltaTime); | |
| 449 | + return true; | |
| 450 | +} | |
| 451 | + | |
| 452 | +void DefaultMetavoxelRendererImplementation::simulate(MetavoxelData& data, float deltaTime, | |
| 453 | + MetavoxelInfo& info, const MetavoxelLOD& lod) { | |
| 454 | + SpannerSimulateVisitor spannerSimulateVisitor(deltaTime, lod); | |
| 455 | + data.guide(spannerSimulateVisitor); | |
| 380 | 456 | } |
| 381 | 457 | |
| 382 | −class PointRenderVisitor : public MetavoxelVisitor { | |
| 458 | +class SpannerRenderVisitor : public SpannerVisitor { | |
| 383 | 459 | public: |
| 384 | 460 | |
| 385 | − PointRenderVisitor(const MetavoxelLOD& lod); | |
| 461 | + SpannerRenderVisitor(const MetavoxelLOD& lod); | |
| 462 | + | |
| 463 | + virtual bool visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize); | |
| 464 | +}; | |
| 465 | + | |
| 466 | +SpannerRenderVisitor::SpannerRenderVisitor(const MetavoxelLOD& lod) : | |
| 467 | + SpannerVisitor(QVector<AttributePointer>() << AttributeRegistry::getInstance()->getSpannersAttribute(), | |
| 468 | + QVector<AttributePointer>(), QVector<AttributePointer>(), QVector<AttributePointer>(), | |
| 469 | + lod, encodeOrder(Application::getInstance()->getViewFrustum()->getDirection())) { | |
| 470 | +} | |
| 471 | + | |
| 472 | +bool SpannerRenderVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { | |
| 473 | + spanner->getRenderer()->render(1.0f, SpannerRenderer::DEFAULT_MODE, clipMinimum, clipSize); | |
| 474 | + return true; | |
| 475 | +} | |
| 476 | + | |
| 477 | +class BufferRenderVisitor : public MetavoxelVisitor { | |
| 478 | +public: | |
| 479 | + | |
| 480 | + BufferRenderVisitor(const AttributePointer& attribute, const MetavoxelLOD& lod); | |
| 386 | 481 | |
| 387 | 482 | virtual int visit(MetavoxelInfo& info); |
| 388 | 483 | |
| @@ -391,21 +486,23 @@ private: · 2 unmodified lines | ||
| 391 | 486 | int _order; |
| 392 | 487 | }; |
| 393 | 488 | |
| 394 | −PointRenderVisitor::PointRenderVisitor(const MetavoxelLOD& lod) : | |
| 395 | − MetavoxelVisitor(QVector<AttributePointer>() << Application::getInstance()->getMetavoxels()->getPointBufferAttribute(), | |
| 396 | − QVector<AttributePointer>(), lod), | |
| 489 | +BufferRenderVisitor::BufferRenderVisitor(const AttributePointer& attribute, const MetavoxelLOD& lod) : | |
| 490 | + MetavoxelVisitor(QVector<AttributePointer>() << attribute, QVector<AttributePointer>(), lod), | |
| 397 | 491 | _order(encodeOrder(Application::getInstance()->getViewFrustum()->getDirection())) { |
| 398 | 492 | } |
| 399 | 493 | |
| 400 | −int PointRenderVisitor::visit(MetavoxelInfo& info) { | |
| 401 | − PointBufferPointer buffer = info.inputValues.at(0).getInlineValue<PointBufferPointer>(); | |
| 494 | +int BufferRenderVisitor::visit(MetavoxelInfo& info) { | |
| 495 | + BufferDataPointer buffer = info.inputValues.at(0).getInlineValue<BufferDataPointer>(); | |
| 402 | 496 | if (buffer) { |
| 403 | 497 | buffer->render(); |
| 404 | 498 | } |
| 405 | 499 | return info.isLeaf ? STOP_RECURSION : _order; |
| 406 | 500 | } |
| 407 | 501 | |
| 408 | −void PointMetavoxelRendererImplementation::render(MetavoxelData& data, MetavoxelInfo& info, const MetavoxelLOD& lod) { | |
| 502 | +void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, MetavoxelInfo& info, const MetavoxelLOD& lod) { | |
| 503 | + SpannerRenderVisitor spannerRenderVisitor(lod); | |
| 504 | + data.guide(spannerRenderVisitor); | |
| 505 | + | |
| 409 | 506 | int viewport[4]; |
| 410 | 507 | glGetIntegerv(GL_VIEWPORT, viewport); |
| 411 | 508 | const int VIEWPORT_WIDTH_INDEX = 2; |
| @@ -416,8 +513,8 @@ void PointMetavoxelRendererImplementation::render(MetavoxelData& data, Metavoxel · 4 unmodified lines | ||
| 416 | 513 | float worldDiagonal = glm::distance(Application::getInstance()->getViewFrustum()->getNearBottomLeft(), |
| 417 | 514 | Application::getInstance()->getViewFrustum()->getNearTopRight()); |
| 418 | 515 | |
| 419 | − _program.bind(); | |
| 420 | − _program.setUniformValue(_pointScaleLocation, viewportDiagonal * | |
| 516 | + _pointProgram.bind(); | |
| 517 | + _pointProgram.setUniformValue(_pointScaleLocation, viewportDiagonal * | |
| 421 | 518 | Application::getInstance()->getViewFrustum()->getNearClip() / worldDiagonal); |
| 422 | 519 | |
| 423 | 520 | glEnableClientState(GL_VERTEX_ARRAY); |
| @@ -428,10 +525,8 @@ void PointMetavoxelRendererImplementation::render(MetavoxelData& data, Metavoxel · 4 unmodified lines | ||
| 428 | 525 | |
| 429 | 526 | glDisable(GL_BLEND); |
| 430 | 527 | |
| 431 | − PointRenderVisitor visitor(lod); | |
| 432 | − data.guide(visitor); | |
| 433 | − | |
| 434 | − glEnable(GL_BLEND); | |
| 528 | + BufferRenderVisitor pointRenderVisitor(Application::getInstance()->getMetavoxels()->getPointBufferAttribute(), lod); | |
| 529 | + data.guide(pointRenderVisitor); | |
| 435 | 530 | |
| 436 | 531 | glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); |
| 437 | 532 | |
| @@ -439,11 +534,18 @@ void PointMetavoxelRendererImplementation::render(MetavoxelData& data, Metavoxel · 1 unmodified line | ||
| 439 | 534 | glDisableClientState(GL_COLOR_ARRAY); |
| 440 | 535 | glDisableClientState(GL_NORMAL_ARRAY); |
| 441 | 536 | |
| 442 | − _program.release(); | |
| 537 | + _pointProgram.release(); | |
| 538 | + | |
| 539 | + BufferRenderVisitor heightfieldRenderVisitor(Application::getInstance()->getMetavoxels()->getHeightfieldBufferAttribute(), | |
| 540 | + lod); | |
| 541 | + data.guide(heightfieldRenderVisitor); | |
| 542 | + | |
| 543 | + glEnable(GL_BLEND); | |
| 443 | 544 | } |
| 444 | − | |
| 445 | −ProgramObject PointMetavoxelRendererImplementation::_program; | |
| 446 | −int PointMetavoxelRendererImplementation::_pointScaleLocation; | |
| 545 | + | |
| 546 | +ProgramObject DefaultMetavoxelRendererImplementation::_pointProgram; | |
| 547 | +int DefaultMetavoxelRendererImplementation::_pointScaleLocation; | |
| 548 | +ProgramObject DefaultMetavoxelRendererImplementation::_heightfieldProgram; | |
| 447 | 549 | |
| 448 | 550 | static void enableClipPlane(GLenum plane, float x, float y, float z, float w) { |
| 449 | 551 | GLdouble coefficients[] = { x, y, z, w }; |