accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift_blender / sr_shader.py
1 print( "sr_shader" )
2
3 def shader_prop_f32( msg, key, order, value ):
4 #{
5 vec = (c_float*4)()
6
7 for i in range(order):
8 #{
9 vec[i] = value[i]
10 #}
11
12 sr_lib.vg_msg_wkvnum( byref(msg), key.encode(), k_vg_msg_f32, order, vec )
13 #}
14
15 def shader_prop_rgba( msg, key, value ):
16 #{
17 colour = (c_float*4)()
18
19 for i in range(4):
20 #{
21 if i < len(value):
22 colour[i] = pow( value[i], 1.0/2.2 )
23 else:
24 colour[i] = 1.0 if i==3 else 0.0
25 #}
26
27 sr_lib.vg_msg_wkvnum( byref(msg), key.encode(), k_vg_msg_f32, 4, colour )
28 #}
29
30 def shader_prop_u32( msg, key, value ):
31 #{
32 cval = c_uint32( value )
33 sr_lib.vg_msg_wkvnum( byref(msg), key.encode(), \
34 k_vg_msg_u32, 1, byref(cval) )
35 #}
36
37 def shader_prop_texture( msg, key, value ):
38 #{
39 shader_prop_u32( msg, key, sr_compile_texture( value ) )
40 #}