FLAMEGPU/FLAMEGPU2-docs

Document Reductions of GLM agent variables

Opened this issue · 1 comments

This requires a custom reduction (assuming it works). Will be documented once tested as part of PRIMAGE.

For the time being this on hold, there aren't current plans to add support for it to PythonAPI.

The C version is pretty simple (and hopefully obvious).

FLAMEGPU_CUSTOM_REDUCTION(glm_min, a, b) {
    return glm::min(a, b);
}
FLAMEGPU_CUSTOM_REDUCTION(glm_max, a, b) {
    return glm::max(a, b);
}
FLAMEGPU_HOST_FUNCTION(host_fn) {
    const glm::vec3 min_pos = FLAMEGPU->agent("agent").reduce<glm::vec3>("xyz", glm_min, glm::vec3(std::numeric_limits<float>().max()));
    const glm::vec3 max_pos = FLAMEGPU->agent("agent").reduce<glm::vec3>("xyz", glm_max, glm::vec3(-std::numeric_limits<float>().max()));
}