mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Use PipelinePointer for rendering Shape
This commit is contained in:
parent
59a354ea8c
commit
1a3a9be605
3 changed files with 10 additions and 6 deletions
|
@ -83,6 +83,9 @@ public:
|
|||
};
|
||||
ItemKey(const Builder& builder) : ItemKey(builder._flags) {}
|
||||
|
||||
bool isShape() const { return _flags[TYPE_SHAPE]; }
|
||||
bool isLight() const { return _flags[TYPE_LIGHT]; }
|
||||
|
||||
bool isOpaque() const { return !_flags[TRANSLUCENT]; }
|
||||
bool isTransparent() const { return _flags[TRANSLUCENT]; }
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ using namespace render;
|
|||
|
||||
Shape::PipelineLib _pipelineLip;
|
||||
|
||||
const Shape::Pipeline& Shape::_pickPipeline(RenderArgs* args, const Key& key) {
|
||||
const Shape::PipelinePointer& Shape::_pickPipeline(RenderArgs* args, const Key& key) {
|
||||
assert(!_pipelineLib.empty());
|
||||
assert(args);
|
||||
assert(args->_batch);
|
||||
|
@ -27,14 +27,14 @@ const Shape::Pipeline& Shape::_pickPipeline(RenderArgs* args, const Key& key) {
|
|||
const auto& pipelineIterator = _pipelineLib.find(key);
|
||||
if (pipelineIterator == _pipelineLib.end()) {
|
||||
qDebug() << "Couldn't find a pipeline from ShapeKey ?" << key;
|
||||
return Shape::Pipeline(); // uninitialized _pipeline == nullptr
|
||||
return std::make_shared<Pipeline>();
|
||||
}
|
||||
|
||||
const auto& shapePipeline = pipelineIterator->second;
|
||||
Shape::PipelinePointer shapePipeline(&(pipelineIterator->second));
|
||||
auto& batch = args->_batch;
|
||||
|
||||
// Setup the one pipeline (to rule them all)
|
||||
batch->setPipeline(shapePipeline.pipeline);
|
||||
batch->setPipeline(shapePipeline->pipeline);
|
||||
|
||||
return shapePipeline;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ class Shape {
|
|||
public:
|
||||
using Key = ShapeKey;
|
||||
using Pipeline = ShapePipeline;
|
||||
using PipelinePointer = std::shared_ptr<Pipeline>;
|
||||
using Slots = ShapePipeline::Slots;
|
||||
using Locations = ShapePipeline::Locations;
|
||||
|
||||
|
@ -164,12 +165,12 @@ public:
|
|||
static void addPipeline(Key key, gpu::ShaderPointer& vertexShader, gpu::ShaderPointer& pixelShader) {
|
||||
_pipelineLib.addPipeline(key, vertexShader, pixelShader);
|
||||
}
|
||||
virtual const Pipeline& pickPipeline(RenderArgs* args, const Key& key) {
|
||||
virtual const PipelinePointer& pickPipeline(RenderArgs* args, const Key& key) {
|
||||
return Shape::_pickPipeline(args, key);
|
||||
}
|
||||
|
||||
protected:
|
||||
static const Pipeline& _pickPipeline(RenderArgs* args, const Key& key);
|
||||
static const PipelinePointer& _pickPipeline(RenderArgs* args, const Key& key);
|
||||
static PipelineLib _pipelineLib;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue