Browse Source

Add "Cast RT Shadow" modifier

pull/43/head
Adam Johnson 8 years ago
parent
commit
a1577331fd
  1. 40
      korman/properties/modifiers/render.py
  2. 11
      korman/ui/modifiers/render.py

40
korman/properties/modifiers/render.py

@ -277,6 +277,46 @@ class PlasmaLightingMod(PlasmaModifierProperties):
return False return False
class PlasmaShadowCasterMod(PlasmaModifierProperties):
pl_id = "rtshadow"
bl_category = "Render"
bl_label = "Cast RT Shadow"
bl_description = "Cast runtime shadows"
blur = IntProperty(name="Blur",
description="Blur factor for the shadow map",
min=0, max=100, default=0,
subtype="PERCENTAGE", options=set())
boost = IntProperty(name="Boost",
description="Multiplies the shadow's power",
min=0, max=5000, default=100,
subtype="PERCENTAGE", options=set())
falloff = IntProperty(name="Falloff",
description="Multiplier for each lamp's falloff value",
min=10, max=1000, default=100,
subtype="PERCENTAGE", options=set())
limit_resolution = BoolProperty(name="Limit Resolution",
description="Increase performance by halving the resolution of the shadow map",
default=False,
options=set())
self_shadow = BoolProperty(name="Self Shadow",
description="Object can cast shadows on itself",
default=False,
options=set())
def export(self, exporter, bo, so):
caster = exporter.mgr.find_create_object(plShadowCaster, so=so, name=self.key_name)
caster.attenScale = self.falloff / 100.0
caster.blurScale = self.blur / 100.0
caster.boost = self.boost / 100.0
if self.limit_resolution:
caster.castFlags |= plShadowCaster.kLimitRes
if self.self_shadow:
caster.castFlags |= plShadowCaster.kSelfShadow
class PlasmaViewFaceMod(PlasmaModifierProperties): class PlasmaViewFaceMod(PlasmaModifierProperties):
pl_id = "viewfacemod" pl_id = "viewfacemod"

11
korman/ui/modifiers/render.py

@ -100,6 +100,17 @@ def lightmap(modifier, layout, context):
if tex.image.name == im_name: if tex.image.name == im_name:
layout.template_preview(tex, show_buttons=False) layout.template_preview(tex, show_buttons=False)
def rtshadow(modifier, layout, context):
split = layout.split()
col = split.column()
col.prop(modifier, "blur")
col.prop(modifier, "boost")
col.prop(modifier, "falloff")
col = split.column()
col.prop(modifier, "limit_resolution")
col.prop(modifier, "self_shadow")
def viewfacemod(modifier, layout, context): def viewfacemod(modifier, layout, context):
layout.prop(modifier, "preset_options") layout.prop(modifier, "preset_options")

Loading…
Cancel
Save