Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
render-configurator.cpp
Go to the documentation of this file.
1/*
2 RenderConfigurator - strategy to help building an actual render calculation stream
3
4 Copyright (C)
5 2011, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
22#include "lib/error.hpp"
26//#include "lib/itertools.hpp"
27
28//#include <string>
29//#include <memory>
30#include <memory>
31#include <functional>
32
33
34
35namespace steam {
36namespace play {
37
38 namespace error = lumiera::error;
39// using std::string;
40// using lumiera::Subsys;
41 using std::shared_ptr;
42 using std::bind;
43 using std::placeholders::_1;
44 using engine::EngineService;
45
47
48
49 namespace { // Implementation details...
50
51// using std::bind;
52// using std::function;
53// using std::placeholders::_1;
54// using lib::transform;
55
57 : public RenderConfigurator
58 {
59
63
64
67 {
68 REQUIRE (outputResolver_);
69 OutputSlot& slot = outputResolver_->getOutputFor (port);
70 if (!slot.isFree())
71 throw error::State{"unable to acquire a suitable output slot"
72 , LERR_(CANT_PLAY)};
73 return slot;
74 }
75
76
79 {
80 OutputSlot::Allocation& activeOutputConnection = output.allocate();
81 Timings nominalTimings = activeOutputConnection.getTimingConstraints()
82 .constrainedBy(playbackTimings_);
83
84 return activateEngine (port, nominalTimings, activeOutputConnection, renderQuality_);
85 }
86
87
89 activateEngine (ModelPort port, Timings timings, OutputSlot::Allocation& activeOutputConnection, RenderQuality quality)
90 {
91 return EngineService::instance().calculate (port, timings, activeOutputConnection, quality);
92 }
93
94
95 public:
96 LumieraRenderProcessBuilder (POutputManager outputManager, Timings playbackSpeed)
97 : outputResolver_(outputManager)
98 , playbackTimings_(playbackSpeed)
99 , renderQuality_(EngineService::QoS_DEFAULT)
100 { }
101
102 };
103
104
105
108 inline RenderConfigurator*
109 how_to_render (POutputManager outputPossibilities, Timings playTimings)
110 {
111 return new LumieraRenderProcessBuilder (outputPossibilities, playTimings);
112 }
113
114
115 } // (End) hidden service impl details
116
117
118
119
120 RenderConfigurator::~RenderConfigurator() { } // emit VTable here...
121
122
127 Feed
129 {
130 OutputSlot& slot = getOutputFor (port);
131 return Feed (buildCalculationStreams (port,slot));
132 }
133
134
135
136
152 buildRenderConfiguration (POutputManager outputPossibilities, Timings playTimings)
153 {
154 shared_ptr<RenderConfigurator> specialConfig{how_to_render (outputPossibilities,playTimings)};
155
156 return [specialConfig](ModelPort port)
157 {
158 return specialConfig->buildActiveFeed(port);
159 };
160 }
161
162
163
164}} // namespace steam::play
Template to build polymorphic value objects.
A service to schedule series of calculations, delivering the rendered data into an external output si...
Handle designating a point within the model, where actually output data can be pulled.
Rendering data feed, corresponding to a single global pipe and to be delivered into a single OutputSl...
virtual Timings getTimingConstraints()=0
Interface: Generic output sink.
Allocation & allocate()
claim this slot for exclusive use
Strategy for configuring the render process.
function< Feed(ModelPort)> ConnectFunction
Feed buildActiveFeed(ModelPort)
Template Method: how to build an active render feed, pulling from the given exit point of the model a...
virtual OutputSlot & getOutputFor(ModelPort port)=0
retrieve a suitable output sink for the data to be produced at the given model exit point.
virtual ~RenderConfigurator()
this is an interface
virtual engine::CalcStreams buildCalculationStreams(ModelPort, OutputSlot &)=0
build active rendering connections, thereby delivering each channel of the given model port into the ...
Generic frame timing specification.
Definition timings.hpp:87
Timings constrainedBy(Timings additionalConditions)
Definition timings.cpp:215
engine::CalcStreams buildCalculationStreams(ModelPort port, OutputSlot &output)
build active rendering connections, thereby delivering each channel of the given model port into the ...
engine::CalcStreams activateEngine(ModelPort port, Timings timings, OutputSlot::Allocation &activeOutputConnection, RenderQuality quality)
OutputSlot & getOutputFor(ModelPort port)
retrieve a suitable output sink for the data to be produced at the given model exit point.
Access point for the (core) calculation service of the render engine.
Lumiera error handling (C++ interface).
#define LERR_(_NAME_)
Definition error.hpp:45
LumieraError< LERR_(STATE)> State
Definition error.hpp:209
std::vector< CalcStream > CalcStreams
RenderConfigurator * how_to_render(POutputManager outputPossibilities, Timings playTimings)
RenderConfigurator::ConnectFunction buildRenderConfiguration(POutputManager outputPossibilities, Timings playTimings)
Factory function to build a RenderConfigurator specifically tailored for a PlayProcess,...
EngineService::QoS_Definition RenderQuality
shared_ptr< OutputManager > POutputManager
Steam-Layer implementation namespace root.
A global service to handle all external output connections.
Strategy to hold all the detail knowledge necessary to establish a running render CalculationStream.