| 74 | } |
| 75 | |
| 76 | inline float eval_primitive_cpu(float2 world_pos, const scene_primitive & sp) |
| 77 | { |
| 78 | float2 local_p = rotate_2d(world_pos - sp.position, -sp.rotation); |
| 79 | switch (sp.type) |
| 80 | { |
| 81 | case prim_type::circle: return sdf_circle(local_p, sp.params.x); |
| 82 | case prim_type::box: return sdf_box(local_p, {sp.params.x, sp.params.y}, sp.params.z); |
| 83 | case prim_type::capsule: return sdf_capsule(local_p, sp.params.x, sp.params.y); |
| 84 | case prim_type::segment: return sdf_segment(local_p, sp.params.x, sp.params.y); |
| 85 | case prim_type::lens: return sdf_lens(local_p, sp.params.x, sp.params.y, sp.params.z, sp.params.w); |
| 86 | case prim_type::ngon: return sdf_ngon(local_p, sp.params.x, sp.params.y); |
| 87 | case prim_type::image_sdf: return 1e10f; |
| 88 | default: return 1e10f; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | inline void uniform3f(const gl_shader_compute & shader, const std::string & name, const float3 & v) |
| 93 | { |
no test coverage detected