mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Merging with origin orange
This commit is contained in:
commit
746812ff78
17 changed files with 56 additions and 42 deletions
|
@ -80,8 +80,8 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
|||
|
||||
Q_ASSERT(args->_batch);
|
||||
auto& batch = *args->_batch;
|
||||
if (args->_pipeline) {
|
||||
batch.setPipeline(args->_pipeline->pipeline);
|
||||
if (args->_shapePipeline) {
|
||||
batch.setPipeline(args->_shapePipeline->pipeline);
|
||||
}
|
||||
|
||||
// FIXME: THe line width of _lineWidth is not supported anymore, we ll need a workaround
|
||||
|
|
|
@ -65,15 +65,15 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
transform.setTranslation(position);
|
||||
transform.setRotation(rotation);
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto pipeline = args->_pipeline;
|
||||
if (!pipeline) {
|
||||
pipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
auto shapePipeline = args->_shapePipeline;
|
||||
if (!shapePipeline) {
|
||||
shapePipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
}
|
||||
|
||||
if (_isSolid) {
|
||||
transform.setScale(dimensions);
|
||||
batch->setModelTransform(transform);
|
||||
geometryCache->renderSolidCubeInstance(args, *batch, cubeColor, pipeline);
|
||||
geometryCache->renderSolidCubeInstance(args, *batch, cubeColor, shapePipeline);
|
||||
} else {
|
||||
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
|
||||
if (getIsDashedLine()) {
|
||||
|
@ -109,7 +109,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
} else {
|
||||
transform.setScale(dimensions);
|
||||
batch->setModelTransform(transform);
|
||||
geometryCache->renderWireCubeInstance(args, *batch, cubeColor, pipeline);
|
||||
geometryCache->renderWireCubeInstance(args, *batch, cubeColor, shapePipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,17 +45,17 @@ void Shape3DOverlay::render(RenderArgs* args) {
|
|||
transform.setTranslation(position);
|
||||
transform.setRotation(rotation);
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto pipeline = args->_pipeline;
|
||||
if (!pipeline) {
|
||||
pipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
auto shapePipeline = args->_shapePipeline;
|
||||
if (!shapePipeline) {
|
||||
shapePipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
}
|
||||
|
||||
transform.setScale(dimensions);
|
||||
batch->setModelTransform(transform);
|
||||
if (_isSolid) {
|
||||
geometryCache->renderSolidShapeInstance(args, *batch, _shape, cubeColor, pipeline);
|
||||
geometryCache->renderSolidShapeInstance(args, *batch, _shape, cubeColor, shapePipeline);
|
||||
} else {
|
||||
geometryCache->renderWireShapeInstance(args, *batch, _shape, cubeColor, pipeline);
|
||||
geometryCache->renderWireShapeInstance(args, *batch, _shape, cubeColor, shapePipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,15 +44,15 @@ void Sphere3DOverlay::render(RenderArgs* args) {
|
|||
batch->setModelTransform(transform);
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto pipeline = args->_pipeline;
|
||||
if (!pipeline) {
|
||||
pipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
auto shapePipeline = args->_shapePipeline;
|
||||
if (!shapePipeline) {
|
||||
shapePipeline = _isSolid ? geometryCache->getOpaqueShapePipeline() : geometryCache->getWireShapePipeline();
|
||||
}
|
||||
|
||||
if (_isSolid) {
|
||||
geometryCache->renderSolidSphereInstance(args, *batch, sphereColor, pipeline);
|
||||
geometryCache->renderSolidSphereInstance(args, *batch, sphereColor, shapePipeline);
|
||||
} else {
|
||||
geometryCache->renderWireSphereInstance(args, *batch, sphereColor, pipeline);
|
||||
geometryCache->renderWireSphereInstance(args, *batch, sphereColor, shapePipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,8 +137,8 @@ void Text3DOverlay::render(RenderArgs* args) {
|
|||
// Text renderer sets its own pipeline,
|
||||
_textRenderer->draw(batch, 0, 0, getText(), textColor, glm::vec2(-1.0f), getDrawInFront());
|
||||
// so before we continue, we must reset the pipeline
|
||||
batch.setPipeline(args->_pipeline->pipeline);
|
||||
args->_pipeline->prepare(batch, args);
|
||||
batch.setPipeline(args->_shapePipeline->pipeline);
|
||||
args->_shapePipeline->prepare(batch, args);
|
||||
}
|
||||
|
||||
const render::ShapeKey Text3DOverlay::getShapeKey() {
|
||||
|
|
|
@ -555,10 +555,12 @@ void RenderableZoneEntityItemMeta::setProceduralUserData(QString userData) {
|
|||
void RenderableZoneEntityItemMeta::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
|
||||
if (!_backgroundStage) {
|
||||
_backgroundStage = args->_scene->getStage<BackgroundStage>();
|
||||
assert(_backgroundStage);
|
||||
}
|
||||
|
||||
{ // Sun
|
||||
|
|
|
@ -61,6 +61,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
|
|||
|
||||
// Background rendering decision
|
||||
auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();
|
||||
assert(backgroundStage);
|
||||
|
||||
model::SunSkyStagePointer background;
|
||||
model::SkyboxPointer skybox;
|
||||
if (backgroundStage->_currentFrame._backgrounds.size()) {
|
||||
|
|
|
@ -433,6 +433,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
|
|||
}
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
assert(lightStage->getNumLights() > 0);
|
||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
||||
const auto& globalShadow = lightAndShadow.second;
|
||||
|
|
|
@ -429,6 +429,7 @@ void PrepareDeferred::run(const RenderContextPointer& renderContext, const Input
|
|||
|
||||
// Prepare a fresh Light Frame
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
lightStage->_currentFrame.clear();
|
||||
}
|
||||
|
||||
|
@ -493,6 +494,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
|||
// Global directional light and ambient pass
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
assert(lightStage->getNumLights() > 0);
|
||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
||||
const auto& globalShadow = lightAndShadow.second;
|
||||
|
|
|
@ -575,6 +575,7 @@ void LightClusteringPass::run(const render::RenderContextPointer& renderContext,
|
|||
|
||||
// From the LightStage and the current frame, update the light cluster Grid
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
_lightClusters->updateLightStage(lightStage);
|
||||
_lightClusters->updateLightFrame(lightStage->_currentFrame, lightingModel->isPointLightEnabled(), lightingModel->isSpotLightEnabled());
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ LightPayload::~LightPayload() {
|
|||
void LightPayload::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
// Do we need to allocate the light in the stage ?
|
||||
if (LightStage::isIndexInvalid(_index)) {
|
||||
|
@ -124,6 +125,7 @@ KeyLightPayload::~KeyLightPayload() {
|
|||
void KeyLightPayload::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
// Do we need to allocate the light in the stage ?
|
||||
if (LightStage::isIndexInvalid(_index)) {
|
||||
|
|
|
@ -259,7 +259,7 @@ void MeshPartPayload::render(RenderArgs* args) {
|
|||
|
||||
gpu::Batch& batch = *(args->_batch);
|
||||
|
||||
auto locations = args->_pipeline->locations;
|
||||
auto locations = args->_shapePipeline->locations;
|
||||
assert(locations);
|
||||
|
||||
// Bind the model transform and the skinCLusterMatrices if needed
|
||||
|
@ -583,7 +583,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
gpu::Batch& batch = *(args->_batch);
|
||||
auto locations = args->_pipeline->locations;
|
||||
auto locations = args->_shapePipeline->locations;
|
||||
assert(locations);
|
||||
|
||||
bindTransform(batch, locations, args->_renderMode);
|
||||
|
|
|
@ -36,7 +36,7 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext,
|
|||
assert(renderContext->args->hasViewFrustum());
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
|
||||
assert(lightStage);
|
||||
LightStage::Index globalLightIndex { 0 };
|
||||
|
||||
const auto globalLight = lightStage->getLight(globalLightIndex);
|
||||
|
@ -68,7 +68,7 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext,
|
|||
std::vector<ShapeKey> skinnedShapeKeys{};
|
||||
|
||||
// Iterate through all inShapes and render the unskinned
|
||||
args->_pipeline = shadowPipeline;
|
||||
args->_shapePipeline = shadowPipeline;
|
||||
batch.setPipeline(shadowPipeline->pipeline);
|
||||
for (auto items : inShapes) {
|
||||
if (items.first.isSkinned()) {
|
||||
|
@ -79,13 +79,13 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext,
|
|||
}
|
||||
|
||||
// Reiterate to render the skinned
|
||||
args->_pipeline = shadowSkinnedPipeline;
|
||||
args->_shapePipeline = shadowSkinnedPipeline;
|
||||
batch.setPipeline(shadowSkinnedPipeline->pipeline);
|
||||
for (const auto& key : skinnedShapeKeys) {
|
||||
renderItems(renderContext, inShapes.at(key));
|
||||
}
|
||||
|
||||
args->_pipeline = nullptr;
|
||||
args->_shapePipeline = nullptr;
|
||||
args->_batch = nullptr;
|
||||
});
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ void RenderShadowTask::configure(const Config& configuration) {
|
|||
|
||||
void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, Output& output) {
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
const auto globalShadow = lightStage->getShadow(0);
|
||||
|
||||
// Cache old render args
|
||||
|
|
|
@ -532,7 +532,8 @@ void DebugSubsurfaceScattering::run(const render::RenderContextPointer& renderCo
|
|||
|
||||
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>("LIGHT_STAGE");
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
// const auto light = DependencyManager::get<DeferredLightingEffect>()->getLightStage()->getLight(0);
|
||||
const auto light = lightStage->getLight(0);
|
||||
|
||||
|
|
|
@ -52,19 +52,21 @@ void ZoneRendererTask::build(JobModel& task, const Varying& input, Varying& oupu
|
|||
}
|
||||
|
||||
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>("BACKGROUND_STAGE");
|
||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>();
|
||||
assert(backgroundStage);
|
||||
backgroundStage->_currentFrame.clear();
|
||||
|
||||
// call render in the correct order first...
|
||||
render::renderItems(context, inputs);
|
||||
|
||||
// Finally add the default lights and background:
|
||||
auto lightStage = context->_scene->getStage<LightStage>("LIGHT_STAGE");
|
||||
auto lightStage = context->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
|
||||
lightStage->_currentFrame.pushSunLight(0);
|
||||
lightStage->_currentFrame.pushAmbientLight(0);
|
||||
|
||||
backgroundStage->_currentFrame.pushBackground(0);
|
||||
|
||||
}
|
||||
|
||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace render {
|
|||
|
||||
std::shared_ptr<gpu::Context> _context;
|
||||
std::shared_ptr<gpu::Framebuffer> _blitFramebuffer;
|
||||
std::shared_ptr<render::ShapePipeline> _pipeline;
|
||||
std::shared_ptr<render::ShapePipeline> _shapePipeline;
|
||||
QSharedPointer<QObject> _renderData;
|
||||
std::stack<ViewFrustum> _viewFrustums;
|
||||
glm::ivec4 _viewport { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
|
|
|
@ -43,19 +43,19 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
|
|||
assert(item.getKey().isShape());
|
||||
auto key = item.getShapeKey() | globalKey;
|
||||
if (key.isValid() && !key.hasOwnPipeline()) {
|
||||
args->_pipeline = shapeContext->pickPipeline(args, key);
|
||||
if (!args->_pipeline) {
|
||||
args->_shapePipeline = shapeContext->pickPipeline(args, key);
|
||||
if (!args->_shapePipeline) {
|
||||
if (key.isCustom()) {
|
||||
if (item.defineCustomShapePipeline(*shapeContext, key)) {
|
||||
args->_pipeline = shapeContext->pickPipeline(args, key);
|
||||
args->_shapePipeline = shapeContext->pickPipeline(args, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args->_pipeline) {
|
||||
args->_pipeline->prepareShapeItem(args, key, item);
|
||||
if (args->_shapePipeline) {
|
||||
args->_shapePipeline->prepareShapeItem(args, key, item);
|
||||
item.render(args);
|
||||
}
|
||||
args->_pipeline = nullptr;
|
||||
args->_shapePipeline = nullptr;
|
||||
} else if (key.hasOwnPipeline()) {
|
||||
item.render(args);
|
||||
} else {
|
||||
|
@ -117,12 +117,12 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
|
|||
// Then render
|
||||
for (auto& pipelineKey : sortedPipelines) {
|
||||
auto& bucket = sortedShapes[pipelineKey];
|
||||
args->_pipeline = shapeContext->pickPipeline(args, pipelineKey);
|
||||
if (!args->_pipeline) {
|
||||
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
|
||||
if (!args->_shapePipeline) {
|
||||
if (pipelineKey.isCustom()) {
|
||||
if (bucket.front().defineCustomShapePipeline(*shapeContext, pipelineKey)) {
|
||||
args->_pipeline = shapeContext->pickPipeline(args, pipelineKey);
|
||||
if (!args->_pipeline) {
|
||||
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
|
||||
if (!args->_shapePipeline) {
|
||||
|
||||
} else {
|
||||
continue;
|
||||
|
@ -134,11 +134,11 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
|
|||
continue;
|
||||
}
|
||||
for (auto& item : bucket) {
|
||||
args->_pipeline->prepareShapeItem(args, pipelineKey, item);
|
||||
args->_shapePipeline->prepareShapeItem(args, pipelineKey, item);
|
||||
item.render(args);
|
||||
}
|
||||
}
|
||||
args->_pipeline = nullptr;
|
||||
args->_shapePipeline = nullptr;
|
||||
for (auto& item : ownPipelineBucket) {
|
||||
item.render(args);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue