From c34a0d4b9fa9574e9e25821973e537f8fa236085 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Wed, 27 Dec 2017 21:35:46 -0800 Subject: [PATCH] Add support for specular materials --- korman/exporter/material.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 6c269fc..b3757b9 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -304,6 +304,18 @@ class MaterialConverter: elif slot.blend_type == "MULTIPLY": state.blendFlags |= hsGMatState.kBlendMult + # Check if this layer uses diffuse/runtime lighting + if not slot.use_map_color_diffuse: + layer.preshade = hsColorRGBA(0.0, 0.0, 0.0, 1.0) + layer.runtime = hsColorRGBA(0.0, 0.0, 0.0, 1.0) + + # Check if this layer uses specular lighting + if slot.use_map_color_spec: + state.shadeFlags |= hsGMatState.kShadeSpecular + else: + layer.specular = hsColorRGBA(0.0, 0.0, 0.0, 1.0) + layer.specularPower = 1.0 + texture = slot.texture # Apply custom layer properties @@ -727,6 +739,9 @@ class MaterialConverter: layer.runtime = utils.color(bm.diffuse_color) layer.specular = utils.color(bm.specular_color) + layer.specularPower = min(100.0, float(bm.specular_hardness)) + layer.LODBias = -1.0 # Seems to be the Plasma default + @property def _report(self): return self._exporter().report