#}
#}
+ if alias == 'ent_cubemap': return 21
+
return 0
#}
sr_functions = { 0: 'trigger' }
#}
+class ent_cubemap(Structure):#{
+ _fields_ = [("co",c_float*3),
+ ("resolution",c_uint32), #placeholder
+ ("live",c_uint32), #placeholder
+ ("texture_id",c_uint32), #engine
+ ("framebuffer_id",c_uint32),#engine
+ ("renderbuffer_id",c_uint32),#engine
+ ("placeholder",c_uint32*2)]
+#}
+
def obj_ent_type( obj ):
#{
if obj.type == 'ARMATURE': return 'mdl_armature'
elif obj.type == 'LIGHT': return 'ent_light'
elif obj.type == 'CAMERA': return 'ent_camera'
+ elif obj.type == 'LIGHT_PROBE' and obj.data.type == 'CUBEMAP':
+ return 'ent_cubemap'
else: return obj.SR_data.ent_type
#}
return texture_index
#}
-def sr_compile_material( mat ):
-#{
+def sr_compile_material( mat ):#{
if mat == None:
return 0
if mat.name in sr_compile.material_cache:
m.flags = flags
m.surface_prop = int(mat.SR_data.surface_prop)
+ inf = material_info( mat )
if mat.SR_data.shader == 'standard': m.shader = 0
if mat.SR_data.shader == 'standard_cutout': m.shader = 1
if mat.SR_data.shader == 'fxglow':#{
m.shader = 7
#}
-
- inf = material_info( mat )
- if mat.SR_data.shader == 'standard' or \
- mat.SR_data.shader == 'standard_cutout' or \
- mat.SR_data.shader == 'terrain_blend' or \
- mat.SR_data.shader == 'vertex_blend' or \
- mat.SR_data.shader == 'fxglow': #{
+ if mat.SR_data.shader == 'cubemap':#{
+ m.shader = 8
+ m.tex_none0 = sr_entity_id( mat.SR_data.cubemap )
+
+ m.colour[0] = pow( mat.SR_data.tint[0], 1.0/2.2 )
+ m.colour[1] = pow( mat.SR_data.tint[1], 1.0/2.2 )
+ m.colour[2] = pow( mat.SR_data.tint[2], 1.0/2.2 )
+ m.colour[3] = pow( mat.SR_data.tint[3], 1.0/2.2 )
+ #}
+
+ if mat.SR_data.shader in ['standard', 'standard_cutout', 'terrain_blend', \
+ 'vertex_blend', 'fxglow', 'cubemap' ]: #{
if 'tex_diffuse' in inf:
m.tex_diffuse = sr_compile_texture(inf['tex_diffuse'])
#}
relay.targets[3][1] = obj_data.target3_event
sr_ent_push( relay )
#}
+ elif ent_type == 'ent_cubemap':#{
+ cubemap = ent_cubemap()
+ co = obj.matrix_world @ Vector((0,0,0))
+ cubemap.co[0] = co[0]
+ cubemap.co[1] = co[2]
+ cubemap.co[2] = -co[1]
+ cubemap.resolution = 0
+ cubemap.live = 60
+ sr_ent_push( cubemap )
+ #}
#}
#}
box.prop( active_mat.SR_data, "shore_colour" )
box.prop( active_mat.SR_data, "ocean_colour" )
#}
+ elif active_mat.SR_data.shader == "cubemap":#{
+ box = _.layout.box()
+ box.prop( active_mat.SR_data, "cubemap" )
+ box.prop( active_mat.SR_data, "tint" )
+ #}
#}
#}
('invisible','Invisible',''),
('boundary','Boundary',''),
('fxglow','FX Glow',''),
+ ('cubemap','Cubemap','')
])
surface_prop: bpy.props.EnumProperty(
default=Vector((0.0,0.006,0.03)),\
description="Water colour in the deep bits"\
)
+ tint: bpy.props.FloatVectorProperty( \
+ name="Tint",\
+ subtype='COLOR',\
+ min=0.0,max=1.0,\
+ size=4,\
+ default=Vector((1.0,1.0,1.0,1.0)),\
+ description="Reflection tint"\
+ )
+
+ cubemap: bpy.props.PointerProperty( \
+ type=bpy.types.Object, name="cubemap", \
+ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_cubemap']))
#}
# ---------------------------------------------------------------------------- #