当前位置: 首页>>代码示例>>C++>>正文


C++ RenderArgs类代码示例

本文整理汇总了C++中RenderArgs的典型用法代码示例。如果您正苦于以下问题:C++ RenderArgs类的具体用法?C++ RenderArgs怎么用?C++ RenderArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RenderArgs类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());

    auto config = std::static_pointer_cast<Config>(renderContext->jobConfig);

    const auto& inItems = inputs.get0();
    const auto& lightingModel = inputs.get1();

    RenderArgs* args = renderContext->args;

    gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
        args->_batch = &batch;
        
        // Setup camera, projection and viewport for all items
        batch.setViewportTransform(args->_viewport);
        batch.setStateScissorRect(args->_viewport);

        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);

        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);

        // Setup lighting model for all items;
        batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());

        renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn);
        args->_batch = nullptr;
    });

    config->setNumDrawn((int)inItems.size());
}
开发者ID:ChristophHaag,项目名称:hifi,代码行数:35,代码来源:RenderDeferredTask.cpp

示例2: assert

 void ExtractFrustums::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output) {
    assert(renderContext->args);
    assert(renderContext->args->_context);

    RenderArgs* args = renderContext->args;

    const auto& shadowFrame = inputs;

    // Return view frustum
    auto& viewFrustum = output[VIEW_FRUSTUM].edit<ViewFrustumPointer>();
    if (!viewFrustum) {
        viewFrustum = std::make_shared<ViewFrustum>(args->getViewFrustum());
    } else {
        *viewFrustum = args->getViewFrustum();
    }

    // Return shadow frustum
    LightStage::ShadowPointer globalShadow;
    if (shadowFrame && !shadowFrame->_objects.empty() && shadowFrame->_objects[0]) {
        globalShadow = shadowFrame->_objects[0];
    }
    for (auto i = 0; i < SHADOW_CASCADE_FRUSTUM_COUNT; i++) {
        auto& shadowFrustum = output[SHADOW_CASCADE0_FRUSTUM+i].edit<ViewFrustumPointer>();
        if (globalShadow && i<(int)globalShadow->getCascadeCount()) {
            auto& cascade = globalShadow->getCascade(i);
            shadowFrustum = cascade.getFrustum();
        } else {
            shadowFrustum.reset();
        }
    }
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:31,代码来源:RenderCommonTask.cpp

示例3: assert

void DrawQuadVolume::run(const render::RenderContextPointer& renderContext, const glm::vec3 vertices[8],
                         const gpu::BufferView& indices, int indexCount) {
    assert(renderContext->args);
    assert(renderContext->args->_context);
    if (_isUpdateEnabled) {
        auto& streamVertices = _meshVertices.edit<std::array<glm::vec3, 8U> >();
        std::copy(vertices, vertices + 8, streamVertices.begin());
    }

    RenderArgs* args = renderContext->args;
    gpu::doInBatch("DrawQuadVolume::run", args->_context, [&](gpu::Batch& batch) {
        args->_batch = &batch;
        batch.setViewportTransform(args->_viewport);
        batch.setStateScissorRect(args->_viewport);

        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);

        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);
        batch.setPipeline(getPipeline());
        batch.setIndexBuffer(indices);

        batch._glUniform4f(0, _color.x, _color.y, _color.z, 1.0f);
        batch.setInputStream(0, _meshStream);
        batch.drawIndexed(gpu::LINES, indexCount, 0U);

        args->_batch = nullptr;
    });
}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:32,代码来源:DrawTask.cpp

示例4: assert

void ExtractFrustums::run(const render::RenderContextPointer& renderContext, Output& output) {
    assert(renderContext->args);
    assert(renderContext->args->_context);

    RenderArgs* args = renderContext->args;

    // Return view frustum
    auto& viewFrustum = output[VIEW_FRUSTUM].edit<ViewFrustumPointer>();
    if (!viewFrustum) {
        viewFrustum = std::make_shared<ViewFrustum>(args->getViewFrustum());
    } else {
        *viewFrustum = args->getViewFrustum();
    }

    // Return shadow frustum
    auto lightStage = args->_scene->getStage<LightStage>(LightStage::getName());
    for (auto i = 0; i < SHADOW_CASCADE_FRUSTUM_COUNT; i++) {
        auto& shadowFrustum = output[SHADOW_CASCADE0_FRUSTUM+i].edit<ViewFrustumPointer>();
        if (lightStage) {
            auto globalShadow = lightStage->getCurrentKeyShadow();

            if (globalShadow && i<(int)globalShadow->getCascadeCount()) {
                auto& cascade = globalShadow->getCascade(i);
                shadowFrustum = cascade.getFrustum();
            } else {
                shadowFrustum.reset();
            }
        } else {
            shadowFrustum.reset();
        }
    }
}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:32,代码来源:RenderCommonTask.cpp

示例5: assert

void BlurGaussianDepthAware::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& SourceAndDepth, gpu::FramebufferPointer& blurredFramebuffer) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());

    RenderArgs* args = renderContext->args;

    auto& sourceFramebuffer = SourceAndDepth.get0();
    auto& depthTexture = SourceAndDepth.get1();

    BlurInOutResource::Resources blurringResources;
    if (!_inOutResources.updateResources(sourceFramebuffer, blurringResources)) {
        // early exit if no valid blurring resources
        return;
    }
    
    blurredFramebuffer = blurringResources.finalFramebuffer;

    auto blurVPipeline = getBlurVPipeline();
    auto blurHPipeline = getBlurHPipeline();

    auto sourceViewport = args->_viewport;

    _parameters->setWidthHeight(sourceViewport.z, sourceViewport.w, args->_context->isStereo());
    glm::ivec2 textureSize(blurringResources.sourceTexture->getDimensions());
    _parameters->setTexcoordTransform(gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(textureSize, sourceViewport));
    _parameters->setDepthPerspective(args->getViewFrustum().getProjection()[1][1]);
    _parameters->setLinearDepthPosFar(args->getViewFrustum().getFarClip());

    gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
        batch.enableStereo(false);
        batch.setViewportTransform(sourceViewport);

        batch.setUniformBuffer(BlurTask_ParamsSlot, _parameters->_parametersBuffer);

        batch.setResourceTexture(BlurTask_DepthSlot, depthTexture);

        batch.setFramebuffer(blurringResources.blurringFramebuffer);
        // batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0));

        batch.setPipeline(blurVPipeline);
        batch.setResourceTexture(BlurTask_SourceSlot, blurringResources.sourceTexture);
        batch.draw(gpu::TRIANGLE_STRIP, 4);

        batch.setFramebuffer(blurringResources.finalFramebuffer);
        if (_inOutResources._generateOutputFramebuffer) {
            // batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0));
        }

        batch.setPipeline(blurHPipeline);
        batch.setResourceTexture(BlurTask_SourceSlot, blurringResources.blurringTexture);
        batch.draw(gpu::TRIANGLE_STRIP, 4);

        batch.setResourceTexture(BlurTask_SourceSlot, nullptr);
        batch.setResourceTexture(BlurTask_DepthSlot, nullptr);
        batch.setUniformBuffer(BlurTask_ParamsSlot, nullptr);
    });
}
开发者ID:AlexanderOtavka,项目名称:hifi,代码行数:57,代码来源:BlurTask.cpp

示例6: renderOperation

bool OctreeRenderer::renderOperation(OctreeElementPointer element, void* extraData) {
    RenderArgs* args = static_cast<RenderArgs*>(extraData);
    if (element->isInView(args->getViewFrustum())) {
        if (element->hasContent()) {
            if (element->calculateShouldRender(args->getViewFrustum(), args->_sizeScale, args->_boundaryLevelAdjust)) {
                args->_renderer->renderElement(element, args);
            } else {
                return false; // if we shouldn't render, then we also should stop recursing.
            }
        }
        return true; // continue recursing
    }
    // if not in view stop recursing
    return false;
}
开发者ID:AlexanderOtavka,项目名称:hifi,代码行数:15,代码来源:OctreeRenderer.cpp

示例7: assert

void RenderShadowTask::run(const SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
    assert(sceneContext);
    RenderArgs* args = renderContext->args;

    // sanity checks
    if (!sceneContext->_scene || !args) {
        return;
    }

    auto lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage();
    const auto globalShadow = lightStage->getShadow(0);

    // If the global light is not set, bail
    if (!globalShadow) {
        return;
    }

    // Cache old render args
    RenderArgs::RenderMode mode = args->_renderMode;

    auto nearClip = args->getViewFrustum().getNearClip();
    float nearDepth = -args->_boomOffset.z;
    const int SHADOW_FAR_DEPTH = 20;
    globalShadow->setKeylightFrustum(args->getViewFrustum(), nearDepth, nearClip + SHADOW_FAR_DEPTH);

    // Set the keylight render args
    args->pushViewFrustum(*(globalShadow->getFrustum()));
    args->_renderMode = RenderArgs::SHADOW_RENDER_MODE;

    // TODO: Allow runtime manipulation of culling ShouldRenderFunctor

    for (auto job : _jobs) {
        job.run(sceneContext, renderContext);
    }

    // Reset the render args
    args->popViewFrustum();
    args->_renderMode = mode;
};
开发者ID:kencooke,项目名称:hifi,代码行数:39,代码来源:RenderShadowTask.cpp

示例8: run

void DrawBounds::run(const RenderContextPointer& renderContext,
    const Inputs& items) {
    RenderArgs* args = renderContext->args;

    uint32_t numItems = (uint32_t) items.size();
    if (numItems == 0) {
        return;
    }

    static const uint32_t sizeOfItemBound = sizeof(ItemBound);
    if (!_drawBuffer) {
        _drawBuffer = std::make_shared<gpu::Buffer>(sizeOfItemBound);
    }

    _drawBuffer->setData(numItems * sizeOfItemBound, (const gpu::Byte*) items.data());

    gpu::doInBatch("DrawBounds::run", args->_context, [&](gpu::Batch& batch) {
        args->_batch = &batch;

        // Setup projection
        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);
        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);
        batch.setModelTransform(Transform());

        // Bind program
        batch.setPipeline(getPipeline());

        glm::vec4 color(glm::vec3(0.0f), -(float) numItems);
        batch._glUniform4fv(_colorLocation, 1, (const float*)(&color));
        batch.setResourceBuffer(0, _drawBuffer);

        static const int NUM_VERTICES_PER_CUBE = 24;
        batch.draw(gpu::LINES, NUM_VERTICES_PER_CUBE * numItems, 0);
    });
}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:39,代码来源:DrawTask.cpp

示例9: assert

void HitEffect::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());
    RenderArgs* args = renderContext->args;

    gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {

        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);
        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);
        batch.setModelTransform(Transform());

        batch.setPipeline(getHitEffectPipeline());

        glm::vec4 color(0.0f, 0.0f, 0.0f, 1.0f);
        glm::vec2 bottomLeft(-1.0f, -1.0f);
        glm::vec2 topRight(1.0f, 1.0f);
        DependencyManager::get<GeometryCache>()->renderQuad(batch, bottomLeft, topRight, color);
    });
}
开发者ID:AlexanderOtavka,项目名称:hifi,代码行数:23,代码来源:HitEffect.cpp

示例10: run

void DrawForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
    RenderArgs* args = renderContext->args;

    const auto& inItems = inputs.get0();
    const auto& lightingModel = inputs.get1();

    gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
        args->_batch = &batch;


        // Setup projection
        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);
        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);
        batch.setModelTransform(Transform());

        // Setup lighting model for all items;
        batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());

        // From the lighting model define a global shapeKey ORED with individiual keys
        ShapeKey::Builder keyBuilder;
        if (lightingModel->isWireframeEnabled()) {
            keyBuilder.withWireframe();
        }
        ShapeKey globalKey = keyBuilder.build();
        args->_globalShapeKey = globalKey._flags.to_ulong();

        // Render items
        renderStateSortShapes(renderContext, _shapePlumber, inItems, -1, globalKey);

        args->_batch = nullptr;
        args->_globalShapeKey = 0;
    });
}
开发者ID:howard-stearns,项目名称:hifi,代码行数:37,代码来源:RenderForwardTask.cpp

示例11: assert

void Antialiasing::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());
    
    RenderArgs* args = renderContext->args;

    auto& deferredFrameTransform = inputs.get0();
    auto& sourceBuffer = inputs.get1();
    auto& linearDepthBuffer = inputs.get2();
    auto& velocityBuffer = inputs.get3();
    
    int width = sourceBuffer->getWidth();
    int height = sourceBuffer->getHeight();

    if (_antialiasingBuffers->get(0)) {
        if (_antialiasingBuffers->get(0)->getSize() != uvec2(width, height)) {// || (sourceBuffer && (_antialiasingBuffer->getRenderBuffer(1) != sourceBuffer->getRenderBuffer(0)))) {
            _antialiasingBuffers->edit(0).reset();
            _antialiasingBuffers->edit(1).reset();
            _antialiasingTextures[0].reset();
            _antialiasingTextures[1].reset();
        }
    }

    if (!_antialiasingBuffers->get(0)) {
        // Link the antialiasing FBO to texture
        for (int i = 0; i < 2; i++) {
            auto& antiAliasingBuffer = _antialiasingBuffers->edit(i);
            antiAliasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("antialiasing"));
            auto format = gpu::Element::COLOR_SRGBA_32; // DependencyManager::get<FramebufferCache>()->getLightingTexture()->getTexelFormat();
            auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
            _antialiasingTextures[i] = gpu::Texture::createRenderBuffer(format, width, height, gpu::Texture::SINGLE_MIP, defaultSampler);
            antiAliasingBuffer->setRenderBuffer(0, _antialiasingTextures[i]);
        }
    }
    
    gpu::doInBatch("Antialiasing::run", args->_context, [&](gpu::Batch& batch) {
        batch.enableStereo(false);
        batch.setViewportTransform(args->_viewport);

        // TAA step
        getAntialiasingPipeline();
        batch.setResourceFramebufferSwapChainTexture(AntialiasingPass_HistoryMapSlot, _antialiasingBuffers, 0);
        batch.setResourceTexture(AntialiasingPass_SourceMapSlot, sourceBuffer->getRenderBuffer(0));
        batch.setResourceTexture(AntialiasingPass_VelocityMapSlot, velocityBuffer->getVelocityTexture());
        // This is only used during debug
        batch.setResourceTexture(AntialiasingPass_DepthMapSlot, linearDepthBuffer->getLinearDepthTexture());

        batch.setUniformBuffer(AntialiasingPass_ParamsSlot, _params);
        batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, deferredFrameTransform->getFrameTransformBuffer());
        
        batch.setFramebufferSwapChain(_antialiasingBuffers, 1);
        batch.setPipeline(getAntialiasingPipeline());       
        batch.draw(gpu::TRIANGLE_STRIP, 4);

        // Blend step
        batch.setResourceTexture(AntialiasingPass_SourceMapSlot, nullptr);

        batch.setFramebuffer(sourceBuffer);
        if (_params->isDebug()) {
            batch.setPipeline(getDebugBlendPipeline());
        }  else {
            batch.setPipeline(getBlendPipeline());
            // Disable sharpen if FXAA
            batch._glUniform1f(_sharpenLoc, _sharpen * _params.get().regionInfo.z);
        }
        batch.setResourceFramebufferSwapChainTexture(AntialiasingPass_NextMapSlot, _antialiasingBuffers, 1);
        batch.draw(gpu::TRIANGLE_STRIP, 4);
        batch.advance(_antialiasingBuffers);
        
        batch.setUniformBuffer(AntialiasingPass_ParamsSlot, nullptr);
        batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, nullptr);

        batch.setResourceTexture(AntialiasingPass_DepthMapSlot, nullptr);
        batch.setResourceTexture(AntialiasingPass_HistoryMapSlot, nullptr);
        batch.setResourceTexture(AntialiasingPass_VelocityMapSlot, nullptr);
        batch.setResourceTexture(AntialiasingPass_NextMapSlot, nullptr);
    });
    
    args->popViewFrustum();
}
开发者ID:ZappoMan,项目名称:hifi,代码行数:80,代码来源:AntialiasingEffect.cpp

示例12: assert

void DrawSceneOctree::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());
    RenderArgs* args = renderContext->args;
    auto& scene = renderContext->_scene;

    std::static_pointer_cast<Config>(renderContext->jobConfig)->numAllocatedCells = (int)scene->getSpatialTree().getNumAllocatedCells();
    std::static_pointer_cast<Config>(renderContext->jobConfig)->numFreeCells = (int)scene->getSpatialTree().getNumFreeCells();

    gpu::doInBatch("DrawSceneOctree::run", args->_context, [&](gpu::Batch& batch) {
        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);
        batch.setViewportTransform(args->_viewport);

        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat, true);
        batch.setModelTransform(Transform());

        // bind the one gpu::Pipeline we need
        batch.setPipeline(getDrawCellBoundsPipeline());
        batch.setInputFormat(_cellBoundsFormat);

        std::vector<ivec4> cellBounds;
        auto drawCellBounds = [this, &cellBounds, &scene](const std::vector<gpu::Stamp>& cells) {
            cellBounds.reserve(cellBounds.size() + cells.size());
            for (const auto& cellID : cells) {
                auto cell = scene->getSpatialTree().getConcreteCell(cellID);
                auto cellLoc = cell.getlocation();
                glm::ivec4 cellLocation(cellLoc.pos.x, cellLoc.pos.y, cellLoc.pos.z, cellLoc.depth);

                bool empty = cell.isBrickEmpty() || !cell.hasBrick();
                if (empty) {
                    if (!_showEmptyCells) {
                        continue;
                    }
                    cellLocation.w *= -1.0;
                } else if (!empty && !_showVisibleCells) {
                    continue;
                }
                cellBounds.push_back(cellLocation);
            }
        };

        drawCellBounds(inSelection.cellSelection.insideCells);
        drawCellBounds(inSelection.cellSelection.partialCells);
        auto size = cellBounds.size() * sizeof(ivec4);
        if (size > _cellBoundsBuffer->getSize()) {
            _cellBoundsBuffer->resize(size);
        }
        _cellBoundsBuffer->setSubData(0, cellBounds);
        batch.setInputBuffer(0, _cellBoundsBuffer, 0, sizeof(ivec4));
        batch.drawInstanced((uint32_t)cellBounds.size(), gpu::LINES, 24);

        // Draw the LOD Reticle
        {
            float angle = glm::degrees(getPerspectiveAccuracyAngle(args->_sizeScale, args->_boundaryLevelAdjust));
            Transform crosshairModel;
            crosshairModel.setTranslation(glm::vec3(0.0, 0.0, -1000.0));
            crosshairModel.setScale(1000.0f * tanf(glm::radians(angle))); // Scaling at the actual tan of the lod angle => Multiplied by TWO
            batch.resetViewTransform();
            batch.setModelTransform(crosshairModel);
            batch.setPipeline(getDrawLODReticlePipeline());
            batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
        }
    });
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:68,代码来源:DrawSceneOctree.cpp

示例13: assert

void DrawItemSelection::run(const SceneContextPointer& sceneContext,
    const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
    assert(renderContext->args);
    assert(renderContext->args->hasViewFrustum());
    RenderArgs* args = renderContext->args;
    auto& scene = sceneContext->_scene;

    gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
        glm::mat4 projMat;
        Transform viewMat;
        args->getViewFrustum().evalProjectionMatrix(projMat);
        args->getViewFrustum().evalViewTransform(viewMat);
        batch.setViewportTransform(args->_viewport);

        batch.setProjectionTransform(projMat);
        batch.setViewTransform(viewMat);
        batch.setModelTransform(Transform());

        // bind the one gpu::Pipeline we need
        batch.setPipeline(getDrawItemBoundPipeline());

        if (_showInsideItems) {
            for (const auto& itemID : inSelection.insideItems) {
                auto& item = scene->getItem(itemID);
                auto itemBound = item.getBound();
                auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
                glm::ivec4 cellLocation(0, 0, 0, itemCell.depth);

                batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
                batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
                batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));

                batch.draw(gpu::LINES, 24, 0);
            }
        }

        if (_showInsideSubcellItems) {
            for (const auto& itemID : inSelection.insideSubcellItems) {
                auto& item = scene->getItem(itemID);
                auto itemBound = item.getBound();
                auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
                glm::ivec4 cellLocation(0, 0, 1, itemCell.depth);

                batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
                batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
                batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));

                batch.draw(gpu::LINES, 24, 0);
            }
        }

        if (_showPartialItems) {
            for (const auto& itemID : inSelection.partialItems) {
                auto& item = scene->getItem(itemID);
                auto itemBound = item.getBound();
                auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
                glm::ivec4 cellLocation(0, 0, 0, itemCell.depth);

                batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
                batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
                batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));

                batch.draw(gpu::LINES, 24, 0);
            }
        }

        if (_showPartialSubcellItems) {
            for (const auto& itemID : inSelection.partialSubcellItems) {
                auto& item = scene->getItem(itemID);
                auto itemBound = item.getBound();
                auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
                glm::ivec4 cellLocation(0, 0, 1, itemCell.depth);
                batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
                batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
                batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));

                batch.draw(gpu::LINES, 24, 0);
            }
        }
    });
}
开发者ID:AlexanderOtavka,项目名称:hifi,代码行数:81,代码来源:DrawSceneOctree.cpp


注:本文中的RenderArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。