Browse Source

Partially revert the emissive stuff.

pull/210/head
Adam Johnson 4 years ago
parent
commit
3abb36b4c4
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 26
      korman/exporter/material.py
  2. 9
      korman/exporter/mesh.py

26
korman/exporter/material.py

@ -147,16 +147,6 @@ class MaterialConverter:
"transformCtl": self._export_layer_transform_animation,
}
def calc_material_ambient(self, bo, bm) -> hsColorRGBA:
emit_scale = bm.emit * 0.5
if emit_scale > 0.0:
return hsColorRGBA(bm.diffuse_color.r * emit_scale,
bm.diffuse_color.g * emit_scale,
bm.diffuse_color.b * emit_scale,
1.0)
else:
return utils.color(bpy.context.scene.world.ambient_color)
def _can_export_texslot(self, slot):
if slot is None or not slot.use:
return False
@ -1176,15 +1166,25 @@ class MaterialConverter:
def get_bump_layer(self, bo):
return self._bump_mats.get(bo, None)
def get_material_ambient(self, bo, bm) -> hsColorRGBA:
emit_scale = bm.emit * 0.5
if emit_scale > 0.0:
return hsColorRGBA(bm.diffuse_color.r * emit_scale,
bm.diffuse_color.g * emit_scale,
bm.diffuse_color.b * emit_scale,
1.0)
else:
return utils.color(bpy.context.scene.world.ambient_color)
def get_material_preshade(self, bo, bm, color=None) -> hsColorRGBA:
if bo.plasma_modifiers.lighting.rt_lights or bm.emit:
if bo.plasma_modifiers.lighting.rt_lights:
return hsColorRGBA.kBlack
if color is None:
color = bm.diffuse_color
return utils.color(color)
def get_material_runtime(self, bo, bm, color=None) -> hsColorRGBA:
if bm.emit:
if not bo.plasma_modifiers.lighting.rt_lights:
return hsColorRGBA.kBlack
if color is None:
color = bm.diffuse_color
@ -1235,7 +1235,7 @@ class MaterialConverter:
state.shadeFlags |= hsGMatState.kShadeEmissive
# Colors
layer.ambient = self.calc_material_ambient(bo, bm)
layer.ambient = self.get_material_ambient(bo, bm)
layer.preshade = self.get_material_preshade(bo, bm)
layer.runtime = self.get_material_runtime(bo, bm)
layer.specular = utils.color(bm.specular_color)

9
korman/exporter/mesh.py

@ -279,8 +279,13 @@ class MeshConverter(_MeshManager):
# TODO: if this is an avatar, we can't be non-preshaded.
if check_layer_shading_animation(base_layer):
return False
if material_idx is not None and mesh.materials[material_idx].emit:
return False
# Reject emissive and shadeless because the kLiteMaterial equation has lots of options
# that are taken away by VtxNonPreshaded that are useful here.
if material_idx is not None:
bm = mesh.materials[material_idx]
if bm.emit or bm.use_shadeless:
return False
mods = bo.plasma_modifiers
if mods.lighting.rt_lights:

Loading…
Cancel
Save