MCPcopy Create free account
hub / github.com/ddiakopoulos/polymer / eval_primitive_cpu

Function eval_primitive_cpu

apps/2dpt/2dpt.cpp:76–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76inline 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
92inline void uniform3f(const gl_shader_compute & shader, const std::string & name, const float3 & v)
93{

Callers 1

Calls 7

rotate_2dFunction · 0.85
sdf_circleFunction · 0.85
sdf_boxFunction · 0.85
sdf_capsuleFunction · 0.85
sdf_segmentFunction · 0.85
sdf_lensFunction · 0.85
sdf_ngonFunction · 0.85

Tested by

no test coverage detected