Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Reductions of GLM agent variables #68

Open
ptheywood opened this issue Oct 20, 2021 · 1 comment
Open

Document Reductions of GLM agent variables #68

ptheywood opened this issue Oct 20, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ptheywood
Copy link
Member

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

@ptheywood ptheywood added the enhancement New feature or request label Oct 20, 2021
@Robadob Robadob self-assigned this Nov 30, 2021
@Robadob
Copy link
Member

Robadob commented Feb 1, 2022

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()));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants