Browse Source

Merge pull request #25 from Hoikas/addcolorxalpha

Port better alpha blending from PyPRP
pull/31/head v0.03
Adam Johnson 9 years ago
parent
commit
e499690f05
  1. 7
      korman/exporter/material.py

7
korman/exporter/material.py

@ -195,7 +195,7 @@ class MaterialConverter:
else: else:
# Standard layer flags ahoy # Standard layer flags ahoy
if slot.blend_type == "ADD": if slot.blend_type == "ADD":
state.blendFlags |= hsGMatState.kBlendAdd state.blendFlags |= hsGMatState.kBlendAddColorTimesAlpha
elif slot.blend_type == "MULTIPLY": elif slot.blend_type == "MULTIPLY":
state.blendFlags |= hsGMatState.kBlendMult state.blendFlags |= hsGMatState.kBlendMult
@ -432,6 +432,11 @@ class MaterialConverter:
if not slot.use_stencil: if not slot.use_stencil:
# mutually exclusive blend flags # mutually exclusive blend flags
if texture.use_alpha and has_alpha: if texture.use_alpha and has_alpha:
if slot.blend_type == "ADD":
state.blendFlags |= hsGMatState.kBlendAlphaAdd
elif slot.blend_type == "MULTIPLY":
state.blendFlags |= hsGMatState.kBlendAlphaMult
else:
state.blendFlags |= hsGMatState.kBlendAlpha state.blendFlags |= hsGMatState.kBlendAlpha
if texture.invert_alpha and has_alpha: if texture.invert_alpha and has_alpha:

Loading…
Cancel
Save