Lumiera  0.pre.03
»edit your freedom«
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 
35 namespace steam {
36 namespace 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 
46  typedef EngineService::QoS_Definition RenderQuality;
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 
60  POutputManager outputResolver_;
61  Timings playbackTimings_;
62  RenderQuality renderQuality_;
63 
64 
65  OutputSlot&
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 
77  engine::CalcStreams
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 
88  engine::CalcStreams
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 
151  RenderConfigurator::ConnectFunction
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
Access point for the (core) calculation service of the render engine.
virtual ~RenderConfigurator()
this is an interface
Strategy to hold all the detail knowledge necessary to establish a running render CalculationStream...
Generic frame timing specification.
Definition: timings.hpp:86
RenderConfigurator * how_to_render(POutputManager outputPossibilities, Timings playTimings)
engine::CalcStreams buildCalculationStreams(ModelPort port, OutputSlot &output)
build active rendering connections, thereby delivering each channel of the given model port into the ...
Steam-Layer implementation namespace root.
static lib::Depend< EngineService > instance
access point to the Engine Interface.
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:190
Feed buildActiveFeed(ModelPort)
Template Method: how to build an active render feed, pulling from the given exit point of the model a...
bool isFree() const
can this OutputSlot be allocated?
Definition: output-slot.cpp:52
RenderConfigurator::ConnectFunction buildRenderConfiguration(POutputManager outputPossibilities, Timings playTimings)
Factory function to build a RenderConfigurator specifically tailored for a PlayProcess, about to be started.
Lumiera error handling (C++ interface).
Handle designating a point within the model, where actually output data can be pulled.
Definition: model-port.hpp:95
Interface: Generic output sink.
Allocation & allocate()
claim this slot for exclusive use
Definition: output-slot.cpp:73
A global service to handle all external output connections.
Rendering data feed, corresponding to a single global pipe and to be delivered into a single OutputSl...
OutputSlot & getOutputFor(ModelPort port)
retrieve a suitable output sink for the data to be produced at the given model exit point...
Strategy for configuring the render process.