Force gpu particles

This commit is contained in:
unknown 2019-04-06 14:30:11 +02:00
parent 4ecec19ad3
commit 27197cc94f
8 changed files with 13 additions and 16 deletions

View file

@ -750,10 +750,10 @@ def parse_vector(node, socket):
elif node.type == 'PARTICLE_INFO':
if socket == node.outputs[3]: # Location
particle_info['location'] = True
return 'p_location' if arm.utils.get_rp().arm_particles == 'GPU' else 'vec3(0.0)'
return 'p_location' if arm.utils.get_rp().arm_particles == 'On' else 'vec3(0.0)'
elif socket == node.outputs[5]: # Velocity
particle_info['velocity'] = True
return 'p_velocity' if arm.utils.get_rp().arm_particles == 'GPU' else 'vec3(0.0)'
return 'p_velocity' if arm.utils.get_rp().arm_particles == 'On' else 'vec3(0.0)'
elif socket == node.outputs[6]: # Angular Velocity
particle_info['angular_velocity'] = True
return 'vec3(0.0)'
@ -1051,13 +1051,13 @@ def parse_value(node, socket):
elif node.type == 'PARTICLE_INFO':
if socket == node.outputs[0]: # Index
particle_info['index'] = True
return 'p_index' if arm.utils.get_rp().arm_particles == 'GPU' else '0.0'
return 'p_index' if arm.utils.get_rp().arm_particles == 'On' else '0.0'
elif socket == node.outputs[1]: # Age
particle_info['age'] = True
return 'p_age' if arm.utils.get_rp().arm_particles == 'GPU' else '0.0'
return 'p_age' if arm.utils.get_rp().arm_particles == 'On' else '0.0'
elif socket == node.outputs[2]: # Lifetime
particle_info['lifetime'] = True
return 'p_lifetime' if arm.utils.get_rp().arm_particles == 'GPU' else '0.0'
return 'p_lifetime' if arm.utils.get_rp().arm_particles == 'On' else '0.0'
elif socket == node.outputs[4]: # Size
particle_info['size'] = True
return '1.0'

View file

@ -10,7 +10,7 @@ def write_vertpos(vert):
particle = mat_state.material.arm_particle_flag
# Particles
if particle:
if arm.utils.get_rp().arm_particles == 'GPU':
if arm.utils.get_rp().arm_particles == 'On':
make_particle.write(vert, particle_info=cycles.particle_info)
# Billboards
if billboard == 'spherical':

View file

@ -41,7 +41,7 @@ def make(context_id, rpasses, shadowmap=False):
make_inst.inst_pos(con_depth, vert)
rpdat = arm.utils.get_rp()
if mat_state.material.arm_particle_flag and rpdat.arm_particles == 'GPU':
if mat_state.material.arm_particle_flag and rpdat.arm_particles == 'On':
make_particle.write(vert, shadowmap=shadowmap)
if is_disp:

View file

@ -126,7 +126,7 @@ def make_base(con_mesh, parse_opacity):
vert.add_out('vec2 texCoord')
vert.add_uniform('float texUnpack', link='_texUnpack')
if mat_state.material.arm_tilesheet_flag:
if mat_state.material.arm_particle_flag and rpdat.arm_particles == 'GPU':
if mat_state.material.arm_particle_flag and rpdat.arm_particles == 'On':
make_particle.write_tilesheet(vert)
else:
vert.add_uniform('vec2 tilesheetOffset', '_tilesheetOffset')
@ -547,7 +547,7 @@ def make_forward(con_mesh):
frag.write('fragColor[0].rgb = tonemapFilmic(fragColor[0].rgb);')
# Particle opacity
if mat_state.material.arm_particle_flag and arm.utils.get_rp().arm_particles == 'GPU' and mat_state.material.arm_particle_fade:
if mat_state.material.arm_particle_flag and arm.utils.get_rp().arm_particles == 'On' and mat_state.material.arm_particle_fade:
frag.write('fragColor[0].rgb *= p_fade;')
def make_forward_base(con_mesh, parse_opacity=False, transluc_pass=False):

View file

@ -75,7 +75,7 @@ def write(vert, particle_info=None, shadowmap=False):
vert.write('spos.xyz += p_location;')
# Particle fade
if mat_state.material.arm_particle_flag and arm.utils.get_rp().arm_particles == 'GPU' and mat_state.material.arm_particle_fade:
if mat_state.material.arm_particle_flag and arm.utils.get_rp().arm_particles == 'On' and mat_state.material.arm_particle_fade:
vert.add_out('float p_fade')
vert.write('p_fade = sin(min((p_age / 2) * 3.141592, 3.141592));')

View file

@ -66,7 +66,7 @@ def make_gi(context_id):
# Voxelized particles
particle = mat_state.material.arm_particle_flag
if particle and rpdat.arm_particles == 'GPU':
if particle and rpdat.arm_particles == 'On':
# make_particle.write(vert, particle_info=cycles.particle_info)
frag.write_pre = True
frag.write('const float p_index = 0;')

View file

@ -488,10 +488,9 @@ class ArmRPListItem(bpy.types.PropertyGroup):
arm_skin_max_bones_auto: BoolProperty(name="Auto Bones", description="Calculate amount of maximum bones based on armatures", default=True, update=assets.invalidate_compiled_data)
arm_skin_max_bones: IntProperty(name="Max Bones", default=50, min=1, max=3000, update=assets.invalidate_shader_cache)
arm_particles: EnumProperty(
items=[('GPU', 'GPU', 'GPU'),
('CPU', 'CPU', 'CPU'),
items=[('On', 'On', 'On'),
('Off', 'Off', 'Off')],
name='Particles', description='Simulation method', default='GPU', update=assets.invalidate_shader_cache)
name='Particles', description='Enable particle simulation', default='On', update=assets.invalidate_shader_cache)
# Material override flags
arm_culling: BoolProperty(name="Culling", default=True)
arm_two_sided_area_light: BoolProperty(name="Two-Sided Area Light", description="Emit light from both faces of area plane", default=False, update=assets.invalidate_shader_cache)

View file

@ -254,8 +254,6 @@ project.addSources('Sources');
if rpdat.arm_skin != 'Off':
assets.add_khafile_def('arm_skin')
if rpdat.arm_particles == 'GPU':
assets.add_khafile_def('arm_particles_gpu')
if rpdat.arm_particles != 'Off':
assets.add_khafile_def('arm_particles')