use the new stream type definitions to get ahead with the builder work
This commit is contained in:
parent
5c7e0d1870
commit
1b4aa98cdf
6 changed files with 95 additions and 48 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
RENDERSTATE.hpp - renderengine state manager
|
REFARRAY.hpp - abstraction providing array-like access to a list of references
|
||||||
|
|
||||||
Copyright (C) Lumiera.org
|
Copyright (C) Lumiera.org
|
||||||
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||||
|
|
@ -21,33 +21,28 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONTROL_RENDERSTATE_H
|
#ifndef LIB_REFARRAY_H
|
||||||
#define CONTROL_RENDERSTATE_H
|
#define LIB_REFARRAY_H
|
||||||
|
|
||||||
#include "proc/state.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace control {
|
|
||||||
|
namespace lib {
|
||||||
typedef proc_interface::State State;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates the logic used to get a "current render process"
|
* Abstraction: Array of const references.
|
||||||
* in accordance to the currently applicable controller settings.
|
* Typically the return type is an interface,
|
||||||
* The provided StateProxy serves to hold any mutalbe state used
|
* and the Implementation wraps some datastructure
|
||||||
* in the render process, so the rest of the render engine
|
* holding subclasses.
|
||||||
* can be stateless.
|
|
||||||
* @todo probably the state management will work different (6/08)
|
|
||||||
*/
|
*/
|
||||||
class RenderState
|
template<class E>
|
||||||
|
struct RefArray
|
||||||
{
|
{
|
||||||
public:
|
virtual E const& operator[] (uint i) const =0;
|
||||||
State& getRenderProcess () ;
|
virtual size_t size() const =0;
|
||||||
|
virtual ~RefArray() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace lib
|
||||||
} // namespace control
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -54,7 +54,7 @@ namespace engine {
|
||||||
struct BuffHandle
|
struct BuffHandle
|
||||||
{
|
{
|
||||||
typedef lumiera::StreamType::ImplFacade::DataBuffer Buff;
|
typedef lumiera::StreamType::ImplFacade::DataBuffer Buff;
|
||||||
typedef Buff* PBuff;//////TODO define the Buffer type(s)
|
typedef Buff* PBuff;
|
||||||
|
|
||||||
PBuff
|
PBuff
|
||||||
operator->() const
|
operator->() const
|
||||||
|
|
@ -81,7 +81,7 @@ namespace engine {
|
||||||
*/
|
*/
|
||||||
struct BufferDescriptor
|
struct BufferDescriptor
|
||||||
{
|
{
|
||||||
char typeID_; ///////TODO define the Buffer type(s)
|
lumiera::StreamType& sType_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#include "proc/common.hpp"
|
#include "proc/common.hpp"
|
||||||
#include "proc/state.hpp"
|
#include "proc/state.hpp"
|
||||||
#include "proc/mobject/parameter.hpp"
|
#include "proc/mobject/parameter.hpp"
|
||||||
|
#include "lib/refarray.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
@ -60,12 +61,6 @@ namespace engine {
|
||||||
|
|
||||||
typedef ProcNode* PNode;
|
typedef ProcNode* PNode;
|
||||||
|
|
||||||
template<class E>
|
|
||||||
struct RefArray ///< @todo need an implementation and then probably move it into library
|
|
||||||
{
|
|
||||||
virtual E const& operator[] (uint i) const =0;
|
|
||||||
virtual ~RefArray() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface: Description of the input and output ports,
|
* Interface: Description of the input and output ports,
|
||||||
|
|
@ -79,16 +74,16 @@ namespace engine {
|
||||||
virtual uint getNrI() const =0; ///////////TODO: indeed need a virtual function??
|
virtual uint getNrI() const =0; ///////////TODO: indeed need a virtual function??
|
||||||
virtual uint getNrO() const =0;
|
virtual uint getNrO() const =0;
|
||||||
|
|
||||||
RefArray<ChannelDescriptor>& out;
|
lib::RefArray<ChannelDescriptor>& out;
|
||||||
RefArray<InChanDescriptor>& in;
|
lib::RefArray<InChanDescriptor>& in;
|
||||||
|
|
||||||
typedef void (ProcFunc) (BuffHandle::PBuff, uint);
|
typedef void (ProcFunc) (BuffHandle::PBuff, uint);
|
||||||
|
|
||||||
ProcFunc* processFunction;
|
ProcFunc* processFunction;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WiringDescriptor (RefArray<ChannelDescriptor>& o,
|
WiringDescriptor (lib::RefArray<ChannelDescriptor>& o,
|
||||||
RefArray<InChanDescriptor>& i,
|
lib::RefArray<InChanDescriptor>& i,
|
||||||
ProcFunc pFunc)
|
ProcFunc pFunc)
|
||||||
: out(o), in(i),
|
: out(o), in(i),
|
||||||
processFunction(pFunc)
|
processFunction(pFunc)
|
||||||
|
|
|
||||||
55
src/proc/mobject/builder/renderstate.hpp
Normal file
55
src/proc/mobject/builder/renderstate.hpp
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
RENDERSTATE.hpp - renderengine state management
|
||||||
|
|
||||||
|
Copyright (C) Lumiera.org
|
||||||
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MOBJECT_BUILDER_RENDERSTATE_H
|
||||||
|
#define MOBJECT_BUILDER_RENDERSTATE_H
|
||||||
|
|
||||||
|
#include "proc/state.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace mobject {
|
||||||
|
namespace builder {
|
||||||
|
|
||||||
|
typedef proc_interface::State State;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encapsulates the logic used to get a "render process".
|
||||||
|
* The provided StateProxy serves to hold any mutalbe state used
|
||||||
|
* in the render process, so the rest of the render engine
|
||||||
|
* can be stateless.
|
||||||
|
* @todo probably the state management will work different (6/08)
|
||||||
|
*/
|
||||||
|
class RenderState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
State& getRenderProcess () ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace mobject::session
|
||||||
|
|
||||||
|
} // namespace mobject
|
||||||
|
#endif
|
||||||
|
|
@ -43,19 +43,6 @@ namespace engine {
|
||||||
|
|
||||||
class State
|
class State
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
virtual ~State() {};
|
|
||||||
|
|
||||||
/** resolves to the State object currently "in charge".
|
|
||||||
* Intended as a performance shortcut to avoid calling
|
|
||||||
* up through a chain of virtual functions when deep down
|
|
||||||
* in chained ProcNode::pull() calls. This allows derived
|
|
||||||
* classes to proxy the state interface.
|
|
||||||
*/
|
|
||||||
virtual State& getCurrentImplementation () =0;
|
|
||||||
|
|
||||||
friend class engine::StateAdapter;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** allocate a new writable buffer with type and size according to
|
/** allocate a new writable buffer with type and size according to
|
||||||
* the BufferDescriptor. The actual provider of this buffer depends
|
* the BufferDescriptor. The actual provider of this buffer depends
|
||||||
|
|
@ -86,6 +73,19 @@ namespace engine {
|
||||||
/** necessary for creating a local BuffTableChunk */
|
/** necessary for creating a local BuffTableChunk */
|
||||||
virtual BuffTableStorage& getBuffTableStorage() =0;
|
virtual BuffTableStorage& getBuffTableStorage() =0;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~State() {};
|
||||||
|
|
||||||
|
/** resolves to the State object currently "in charge".
|
||||||
|
* Intended as a performance shortcut to avoid calling
|
||||||
|
* up through a chain of virtual functions when deep down
|
||||||
|
* in chained ProcNode::pull() calls. This allows derived
|
||||||
|
* classes to proxy the state interface.
|
||||||
|
*/
|
||||||
|
virtual State& getCurrentImplementation () =0;
|
||||||
|
|
||||||
|
friend class engine::StateAdapter;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "proc/engine/procnode.hpp"
|
#include "proc/engine/procnode.hpp"
|
||||||
#include "proc/engine/bufftable.hpp"
|
#include "proc/engine/bufftable.hpp"
|
||||||
|
#include "lib/refarray.hpp"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -49,10 +50,11 @@ namespace engine {
|
||||||
|
|
||||||
/** just some crap to pass in as ctor argument... */
|
/** just some crap to pass in as ctor argument... */
|
||||||
template<class E>
|
template<class E>
|
||||||
struct DummyArray : RefArray<E>
|
struct DummyArray : lib::RefArray<E>
|
||||||
{
|
{
|
||||||
E decoy;
|
E decoy;
|
||||||
E const& operator[] (uint) const { return decoy;}
|
E const& operator[] (uint) const { return decoy;}
|
||||||
|
size_t size() const { return CHUNK_MAX;}
|
||||||
};
|
};
|
||||||
DummyArray<ChannelDescriptor> dummy1;
|
DummyArray<ChannelDescriptor> dummy1;
|
||||||
DummyArray<InChanDescriptor> dummy2;
|
DummyArray<InChanDescriptor> dummy2;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue