2007-08-08 04:50:02 +02:00
|
|
|
/*
|
2024-03-27 16:23:53 +01:00
|
|
|
PROC-NODE.hpp - Key abstraction of the Render Engine: a Processing Node
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-03-10 04:25:03 +01:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-08-08 04:50:02 +02:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2007-08-08 04:50:02 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-08-08 04:50:02 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-08-08 04:50:02 +02:00
|
|
|
*/
|
|
|
|
|
|
2024-03-27 16:23:53 +01:00
|
|
|
/** @file proc-node.hpp
|
2008-06-24 05:19:11 +02:00
|
|
|
** Interface to the processing nodes and the render nodes network.
|
|
|
|
|
**
|
|
|
|
|
** Actually, there are three different interfaces to consider
|
2024-05-06 23:51:48 +02:00
|
|
|
** - the ProcNode#pull is the invocation interface. It is function-call style
|
|
|
|
|
** - the builder interface, comprised by the NodeFactory and the WiringFactory.
|
|
|
|
|
** - the actual processing function is supposed to be a C function and will be
|
|
|
|
|
** hooked up within a thin wrapper.
|
2008-06-24 05:19:11 +02:00
|
|
|
**
|
|
|
|
|
** By using the builder interface, concrete node and wiring descriptor classes are created,
|
|
|
|
|
** based on some templates. These concrete classes form the "glue" to tie the node network
|
2009-08-29 16:13:42 +02:00
|
|
|
** together and contain much of the operation behaviour in a hard wired fashion.
|
2024-06-21 16:14:24 +02:00
|
|
|
**
|
|
|
|
|
** @todo WIP-WIP-WIP 2024 Node-Invocation is reworked from ground up for the »Playback Vertical Slice«
|
|
|
|
|
**
|
2008-06-24 05:19:11 +02:00
|
|
|
** @see nodefactory.hpp
|
|
|
|
|
** @see operationpoint.hpp
|
|
|
|
|
*/
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2024-06-21 16:14:24 +02:00
|
|
|
#ifndef STEAM_ENGINE_PROC_NODE_H
|
|
|
|
|
#define STEAM_ENGINE_PROC_NODE_H
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2011-12-01 23:32:34 +01:00
|
|
|
#include "lib/error.hpp"
|
2018-11-15 23:42:43 +01:00
|
|
|
#include "steam/common.hpp"
|
|
|
|
|
#include "steam/asset/proc.hpp"
|
|
|
|
|
#include "steam/mobject/parameter.hpp"
|
2024-06-24 23:49:55 +02:00
|
|
|
//#include "steam/engine/state-closure-obsolete.hpp" ///////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
|
|
|
|
#include "steam/engine/state-closure.hpp" /////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2018-11-15 23:42:43 +01:00
|
|
|
#include "steam/engine/channel-descriptor.hpp"
|
2024-06-23 19:40:39 +02:00
|
|
|
#include "steam/engine/turnout-system.hpp"
|
2008-12-20 05:59:55 +01:00
|
|
|
#include "lib/frameid.hpp"
|
2010-03-08 04:43:24 +01:00
|
|
|
#include "lib/ref-array.hpp"
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2008-06-24 05:19:11 +02:00
|
|
|
#include <vector>
|
2007-08-08 04:50:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
namespace steam {
|
2008-05-27 07:22:27 +02:00
|
|
|
namespace engine {
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2008-05-27 07:22:27 +02:00
|
|
|
using std::vector;
|
2008-10-14 05:33:48 +02:00
|
|
|
using lumiera::NodeID;
|
2008-05-27 07:22:27 +02:00
|
|
|
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-05-27 07:22:27 +02:00
|
|
|
class ProcNode;
|
2008-06-14 04:19:58 +02:00
|
|
|
typedef ProcNode* PNode;
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-06-14 04:19:58 +02:00
|
|
|
|
2024-06-23 19:40:39 +02:00
|
|
|
class Port
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~Port(); ///< this is an interface
|
|
|
|
|
|
|
|
|
|
virtual TurnoutSystem enactTurnout() =0;
|
|
|
|
|
};
|
2008-06-14 04:19:58 +02:00
|
|
|
|
|
|
|
|
/**
|
2008-06-29 15:32:19 +02:00
|
|
|
* Interface: Description of the input and output ports,
|
|
|
|
|
* processing function and predecessor nodes for a given ProcNode.
|
2012-02-04 22:20:21 +01:00
|
|
|
*
|
|
|
|
|
* @todo the design of this part is messy in several respects.
|
|
|
|
|
* Basically, its left-over from a first prototypical implementation from 2008
|
|
|
|
|
* As of 1/2012, we're re-shaping that engine interface and invocation with a top-down approach,
|
|
|
|
|
* starting from the player. Anyhow, you can expect the basic setup to remain as-is: there will
|
2024-05-06 23:51:48 +02:00
|
|
|
* be a ProcNode and a Connectivity descriptor, telling how it's connected to its predecessors,
|
|
|
|
|
* and defining how the Node is supposed to operate
|
2024-06-21 16:14:24 +02:00
|
|
|
*
|
|
|
|
|
* @todo WIP-WIP-WIP 2024 Node-Invocation is reworked from ground up for the »Playback Vertical Slice«
|
2008-06-14 04:19:58 +02:00
|
|
|
*/
|
2024-05-06 23:51:48 +02:00
|
|
|
class Connectivity
|
2008-06-14 04:19:58 +02:00
|
|
|
{
|
2012-02-04 22:20:21 +01:00
|
|
|
public: /* === public information record describing the node graph === */
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-10-17 04:29:15 +02:00
|
|
|
uint nrO;
|
2008-10-17 05:48:02 +02:00
|
|
|
uint nrI;
|
2008-07-16 05:09:04 +02:00
|
|
|
|
2008-10-17 05:48:02 +02:00
|
|
|
lib::RefArray<ChannelDescriptor>& out;
|
|
|
|
|
lib::RefArray<InChanDescriptor>& in;
|
2008-07-20 20:08:08 +02:00
|
|
|
|
2009-09-05 03:04:00 +02:00
|
|
|
typedef asset::Proc::ProcFunc ProcFunc;
|
2008-07-20 20:08:08 +02:00
|
|
|
|
2008-10-17 04:29:15 +02:00
|
|
|
ProcFunc* procFunction;
|
2008-07-20 20:08:08 +02:00
|
|
|
|
2008-10-14 05:33:48 +02:00
|
|
|
NodeID const& nodeID;
|
|
|
|
|
|
2024-05-06 23:51:48 +02:00
|
|
|
virtual ~Connectivity() {}
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-10-17 04:29:15 +02:00
|
|
|
|
2008-06-14 04:19:58 +02:00
|
|
|
protected:
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2024-05-06 23:51:48 +02:00
|
|
|
Connectivity (lib::RefArray<ChannelDescriptor>& o,
|
2008-10-17 05:48:02 +02:00
|
|
|
lib::RefArray<InChanDescriptor>& i,
|
2008-10-14 05:33:48 +02:00
|
|
|
ProcFunc pFunc, NodeID const& nID)
|
2008-07-21 03:25:06 +02:00
|
|
|
: out(o), in(i),
|
2008-10-17 04:29:15 +02:00
|
|
|
procFunction(pFunc),
|
2008-10-14 05:33:48 +02:00
|
|
|
nodeID(nID)
|
2009-09-04 01:59:44 +02:00
|
|
|
{
|
|
|
|
|
nrO = out.size();
|
|
|
|
|
nrI = in.size();
|
|
|
|
|
}
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-07-21 03:25:06 +02:00
|
|
|
|
2012-02-04 22:20:21 +01:00
|
|
|
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2012-02-04 22:20:21 +01:00
|
|
|
/* ==== strategy API for configuring the node operation ==== */
|
|
|
|
|
|
|
|
|
|
friend class ProcNode; /////////////////////////////////TODO 1/12 : wouldn't it be better to extract that API into a distinct strategy?
|
|
|
|
|
|
2008-06-29 15:32:19 +02:00
|
|
|
/** the wiring-dependent part of the node operation.
|
|
|
|
|
* Includes the creation of a one-way state object on the stack
|
2008-10-09 05:23:24 +02:00
|
|
|
* holding the actual buffer pointers and issuing the recursive pull() calls
|
2008-06-29 15:32:19 +02:00
|
|
|
* @see NodeWiring#callDown default implementation
|
|
|
|
|
*/
|
2024-06-24 23:49:55 +02:00
|
|
|
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation
|
2009-09-05 04:10:51 +02:00
|
|
|
virtual BuffHandle
|
2024-06-21 16:14:24 +02:00
|
|
|
callDown (StateClosure_OBSOLETE& currentProcess, uint requiredOutputNr) const =0;
|
2024-06-24 23:49:55 +02:00
|
|
|
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-06-14 04:19:58 +02:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2008-06-24 05:19:11 +02:00
|
|
|
|
|
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
/**
|
|
|
|
|
* Key abstraction of the Render Engine: A Data processing Node
|
2009-09-05 18:15:58 +02:00
|
|
|
*
|
|
|
|
|
* @todo it's not clear as of 9/09 if ProcNode shall be an ABC/Interface
|
|
|
|
|
* It might be used as ABC (as was the original intention) when implementing
|
|
|
|
|
* several query/information functions. In that case, the ctor will become protected.
|
|
|
|
|
* The alternative would be to push down these information-retrieval part into a
|
2024-05-06 23:51:48 +02:00
|
|
|
* configurable element within Connectivity, in which case we even might drop
|
2012-02-04 22:20:21 +01:00
|
|
|
* ProcNode as a frontend entirely.
|
2024-06-21 16:14:24 +02:00
|
|
|
* @todo WIP-WIP-WIP 2024 Node-Invocation is reworked from ground up for the »Playback Vertical Slice«
|
2007-08-09 18:51:47 +02:00
|
|
|
*/
|
|
|
|
|
class ProcNode
|
2018-03-24 05:35:13 +01:00
|
|
|
: util::NonCopyable
|
2007-08-09 18:51:47 +02:00
|
|
|
{
|
2008-06-14 04:19:58 +02:00
|
|
|
typedef mobject::Parameter<double> Param; //////TODO: just a placeholder for automation as of 6/2008
|
2007-08-09 18:51:47 +02:00
|
|
|
vector<Param> params;
|
2008-06-24 05:19:11 +02:00
|
|
|
|
2024-05-06 23:51:48 +02:00
|
|
|
const Connectivity& wiringConfig_;
|
2008-06-24 05:19:11 +02:00
|
|
|
|
2009-09-05 18:15:58 +02:00
|
|
|
public:
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2024-05-06 23:51:48 +02:00
|
|
|
ProcNode (Connectivity const& wd)
|
2008-06-24 05:19:11 +02:00
|
|
|
: wiringConfig_(wd)
|
|
|
|
|
{ }
|
2008-05-27 07:22:27 +02:00
|
|
|
|
2009-09-05 18:15:58 +02:00
|
|
|
virtual ~ProcNode() {}; /////////////////////////TODO: do we still intend to build a hierarchy below ProcNode???
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-05-27 07:22:27 +02:00
|
|
|
|
2008-06-14 04:19:58 +02:00
|
|
|
|
2008-05-27 07:22:27 +02:00
|
|
|
public:
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2009-09-05 04:10:51 +02:00
|
|
|
bool isValid() const;
|
2008-05-27 07:22:27 +02:00
|
|
|
|
2009-09-04 01:59:44 +02:00
|
|
|
/** output channel count */
|
|
|
|
|
uint nrO() { return wiringConfig_.nrO; }
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2009-09-04 01:59:44 +02:00
|
|
|
|
2009-09-05 04:10:51 +02:00
|
|
|
|
2008-06-14 04:19:58 +02:00
|
|
|
/** Engine Core operation: render and pull output from this node.
|
2009-08-29 16:13:42 +02:00
|
|
|
* On return, currentProcess will hold onto output buffer(s)
|
2008-08-04 05:42:55 +02:00
|
|
|
* containing the calculated result frames. In case this node
|
2009-08-29 16:13:42 +02:00
|
|
|
* calculates a multichannel output, only one channel can be
|
2008-08-04 05:42:55 +02:00
|
|
|
* retrieved by such a \c pull() call, but you can expect data
|
|
|
|
|
* of the other channels to be processed and fed to cache.
|
2024-05-06 23:51:48 +02:00
|
|
|
* @param currentProcess the current processing state for
|
2008-06-24 05:19:11 +02:00
|
|
|
* managing buffers and accessing current parameter values
|
2008-10-13 04:33:10 +02:00
|
|
|
* @param requestedOutputNr the output channel requested
|
|
|
|
|
* (in case this node delivers more than one output channel)
|
2009-08-29 16:13:42 +02:00
|
|
|
* @return handle to the buffer containing the calculated result.
|
2008-05-27 07:22:27 +02:00
|
|
|
*/
|
2024-06-24 23:49:55 +02:00
|
|
|
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation
|
2008-07-11 19:40:11 +02:00
|
|
|
BuffHandle
|
2024-06-21 16:14:24 +02:00
|
|
|
pull (StateClosure_OBSOLETE& currentProcess, uint requestedOutputNr=0) const
|
2008-06-14 04:19:58 +02:00
|
|
|
{
|
2008-10-13 04:33:10 +02:00
|
|
|
return this->wiringConfig_.callDown (currentProcess, requestedOutputNr);
|
2008-06-14 04:19:58 +02:00
|
|
|
}
|
2024-06-24 23:49:55 +02:00
|
|
|
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2008-06-24 05:19:11 +02:00
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
};
|
2008-06-24 05:19:11 +02:00
|
|
|
|
2009-09-05 04:10:51 +02:00
|
|
|
|
2024-06-21 16:14:24 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation
|
2009-09-05 18:15:58 +02:00
|
|
|
inline bool
|
2009-09-05 04:10:51 +02:00
|
|
|
ProcNode::isValid() const
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("ProcNode validity self-check");
|
|
|
|
|
return false; //////////////////////////TODO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
}} // namespace steam::engine
|
2024-06-21 16:14:24 +02:00
|
|
|
#endif /*STEAM_ENGINE_PROC_NODE_H*/
|