BatchMicroNode Class Reference
#include <micronodes.h>
BatchMicroNode is the base class for custom micro nodes which shall receive a batch of input values in their Process method and compute the corresponding output values. You should prefer this over a BasicMicroNode when the Process method consists of just a few simple operations: Then the calling overhead of nodes is significant, and it can be reduced when a single call to Process handles a whole batch of values. Of course this only holds when there is a proper batch of values, for example in the context of shading there's usually just one set of values.
To implement a
BatchMicroNode
, you have to derive a new class from
BatchMicroNode
and add a function template
{
Result<void>
Process(Batch<...>&)} (no const in front of Batch) to that class with a list of those ports between the angular brackets which shall be accessed by the node. Within the Process method you have to write a for loop over the batch as in the example shown below. The ports have to be defined by MAXON_PORT macros in a micro node group class. Usually the
BatchMicroNode
class is a member of that micro node group class:
There is the helper class OperatorNode to simplify the implementation of a core node class consisting of a single BatchMicroNode . If you want to implement a core node class consisting of a single BatchMicroNode which just invokes an existing C++ function or operator (as in the example with the + operator) you can also use one of the macros MAXON_CORENODE_FUNCTION, MAXON_CORENODE_OPERATOR_UNARY and MAXON_CORENODE_OPERATOR_BINARY.
公共成员函数 |
|
MAXON_SECONDARG (,, template< typename PORTMODE >) static void Process() | |
template<typename MN > | |
void | PrivateInit () |
![]() |
|
enum maxon::corenodes::MicroNode::TYPE | MAXON_ENUM_ORDERED_FLAGS_CLASS ( TYPE ) |
enum maxon::corenodes::MicroNode::FLAGS | MAXON_ENUM_FLAGS_CLASS ( FLAGS ) |
const Base & | ToBase () const |
Base & | ToBase () |
Bool | HasSameClass (const MicroNode &other) const |
const MicroNodeInterface * | GetNode () const |
MicroNodeInterface * | GetNode () |
TYPE | GetType () const |
FLAGS | GetFlags () const |
enum maxon::corenodes::MicroNode::PORTSACCESS_FLAGS | MAXON_ENUM_FLAGS_CLASS ( PORTSACCESS_FLAGS ) |
Public Attributes |
|
Base | _base |
ProcessFn | _fProcess [1] |
corenodes::details::InitUserDataFn | _fInitUserData |
corenodes::details::GetLlvmAssemblyFn | _fGetLlvmAssembly |
![]() |
|
class maxon::corenodes::MicroNode::Base | MAXON_ENUM_FLAGS_CLASS |
静态公共属性 |
|
static const TYPE | MICRONODE_TYPE |
static const WIRETYPE | IS_TARGET_OF |
static const WIRETYPE | IS_SOURCE_OF |
![]() |
|
static const TYPE | INPUT_TYPE_MASK |
static const TYPE | OUTPUT_TYPE_MASK |
static const FLAGS | MICRONODE_FLAGS |
Static Private Member Functions |
|
template<typename MN , typename MT , MT METHOD, typename PORTS > | |
static ProcessFn | GetProcessFn ( Result < void >(MN::*)( PORTS &,) const, MicroNode::Base &node) |
template<typename MN , typename MT , MT METHOD> | |
static ProcessFn | GetProcessFn (void(*)(), MicroNode::Base &) |
Additional Inherited Members |
|
![]() |
|
static void | InitUserData () |
static void | GetLlvmAssembly (const LlvmGlobalsReceiver &) |
using MicroNodeClass = BatchMicroNode |
using Batch = PortsAccess < PORTSACCESS_FLAGS::BATCH , PORTS...> |
You have to use
{Batch<...>&} as the parameter type of the Process method of a
BatchMicroNode
.
PORTS | The ports which shall be accessed within the Process method. |
using ProcessFn = Result <void>(*)(const MicroNode *, const void*,) |
|
static private |
|
static private |
MAXON_SECONDARG | ( | template< typename PORTMODE > | ) |
void PrivateInit | ( | ) |
|
Base _base |
|
|
ProcessFn _fProcess[1] |
corenodes::details::InitUserDataFn _fInitUserData |
corenodes::details::GetLlvmAssemblyFn _fGetLlvmAssembly |