Define FLAMEGPU_AGENT_FUNCTION_CONDITION

Define Documentation

FLAMEGPU_AGENT_FUNCTION_CONDITION(funcName)

Macro for defining agent transition functions conditions. Must always be a device function to be called by CUDA.

Saves users from manually defining agent function conditions, e.g.:

struct SomeAgentFunctionCondition {
   // User Implemented agent function condition behaviour
    __device__ __forceinline__ bool operator()(ReadOnlyDeviceAPI *FLAMEGPU) const {
        // do something
        return something ? true : false;
    }
    // Returns a function pointer to the agent function condition wrapper for this function
    // Including it here, force instantiates the template, without requiring the user to specify the template args elsewhere
    static constexpr AgentFunctionConditionWrapper *fnPtr() { return &agent_function_condition_wrapper<SomeAgentFunctionCondition>; }
};
SomeAgentFunctionCondition_cdn_impl SomeAgentFunctionCondition;