Custom compile for PrimitiveTree to generate GLSL code

瀏覽次數:23 次
跳到第一則未讀訊息

David Braun

未讀,
2021年3月10日 清晨7:07:122021/3/10
收件者:deap-users
I see that gp.compile calls python's eval on the str representation of a PrimitiveTree. Instead I want to compile to GLSL code.

For example, if the expr had been

lambda x, y, z: x+y*math.sin(z)

The GLSL code would be this text:

out float fragColor;

uniform float x;
uniform float y;
uniform float z;

main() {
    fragColor = x + y*sin(z);
}

I would also have functions that exist in GLSL but have no meaning in Python

fragColor = myLookup(x, y) + sin(z);

Has anyone done this kind of custom compilation?
回覆所有人
回覆作者
轉寄
0 則新訊息