From 4a7b47200aa12cbf70f52d617badb59e86f52df8 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 29 Jan 2017 18:15:35 -1000 Subject: [PATCH] Include alpha component in opaque shaders --- hecl/blender/hecl/frme.py | 8 ++++---- hecl/blender/hecl/hmdl/HMDLShader.py | 2 +- hecl/extern/boo | 2 +- hecl/lib/Backend/GX.cpp | 5 +---- hecl/lib/Backend/ProgrammableCommon.cpp | 5 +---- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/hecl/blender/hecl/frme.py b/hecl/blender/hecl/frme.py index 2ccdeca7d..ef3b39264 100644 --- a/hecl/blender/hecl/frme.py +++ b/hecl/blender/hecl/frme.py @@ -29,7 +29,7 @@ def draw(layout, context): layout.prop(obj, 'retro_textpane_font_path', text='Font Path') row = layout.row(align=True) row.prop(obj, 'retro_textpane_word_wrap', text='Word Wrap') - row.prop(obj, 'retro_textpane_vertical', text='Vertical') + row.prop(obj, 'retro_textpane_horizontal', text='Horizontal') layout.prop(obj, 'retro_textpane_fill_color', text='Fill Color') layout.prop(obj, 'retro_textpane_outline_color', text='Outline Color') layout.prop(obj, 'retro_textpane_block_extent', text='Point Dimensions') @@ -131,7 +131,7 @@ def recursive_cook(buffer, obj, version, path_hasher, parent_name): obj.retro_pane_scale_center[2], path_hash, obj.retro_textpane_word_wrap, - obj.retro_textpane_vertical, + obj.retro_textpane_horizontal, hjustifications[obj.retro_textpane_hjustification], vjustifications[obj.retro_textpane_vjustification], obj.retro_textpane_fill_color[0], @@ -333,11 +333,11 @@ def register(): bpy.types.Object.retro_model_light_mask = bpy.props.IntProperty(name='Retro: Model Light Mask', min=0, default=0) bpy.types.Object.retro_pane_dimensions = bpy.props.FloatVectorProperty(name='Retro: Pane Dimensions', min=0.0, size=2) - bpy.types.Object.retro_pane_scale_center = bpy.props.FloatVectorProperty(name='Retro: Scale Center', min=0.0, size=3) + bpy.types.Object.retro_pane_scale_center = bpy.props.FloatVectorProperty(name='Retro: Scale Center', size=3) bpy.types.Object.retro_textpane_font_path = bpy.props.StringProperty(name='Retro: Font Path') bpy.types.Object.retro_textpane_word_wrap = bpy.props.BoolProperty(name='Retro: Word Wrap') - bpy.types.Object.retro_textpane_vertical = bpy.props.BoolProperty(name='Retro: Vertical') + bpy.types.Object.retro_textpane_horizontal = bpy.props.BoolProperty(name='Retro: Horizontal') bpy.types.Object.retro_textpane_fill_color = bpy.props.FloatVectorProperty(name='Retro: Fill Color', min=0.0, max=1.0, size=4, subtype='COLOR') bpy.types.Object.retro_textpane_outline_color = bpy.props.FloatVectorProperty(name='Retro: Outline Color', min=0.0, max=1.0, size=4, subtype='COLOR') bpy.types.Object.retro_textpane_block_extent = bpy.props.FloatVectorProperty(name='Retro: Block Extent', min=0.0, size=2) diff --git a/hecl/blender/hecl/hmdl/HMDLShader.py b/hecl/blender/hecl/hmdl/HMDLShader.py index 929b28adc..5c53a3764 100644 --- a/hecl/blender/hecl/hmdl/HMDLShader.py +++ b/hecl/blender/hecl/hmdl/HMDLShader.py @@ -350,7 +350,7 @@ def shader(mat_obj, mesh_obj): elif mat_obj.game_settings.alpha_blend == 'ADD': return "HECLAdditive(%s, %s)" % (color_trace_result, alpha_trace_result), tex_paths else: - return "HECLOpaque(%s)" % color_trace_result, tex_paths + return "HECLOpaque(%s, %s)" % (color_trace_result, alpha_trace_result), tex_paths # DEBUG operator import bpy diff --git a/hecl/extern/boo b/hecl/extern/boo index ed8cc3a57..4fb95046a 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit ed8cc3a57ba455bf345c260fed3cfa530d4afc97 +Subproject commit 4fb95046a8add3a7c1c45f842880cc2ee429201d diff --git a/hecl/lib/Backend/GX.cpp b/hecl/lib/Backend/GX.cpp index d40218357..d2d6713b5 100644 --- a/hecl/lib/Backend/GX.cpp +++ b/hecl/lib/Backend/GX.cpp @@ -695,7 +695,6 @@ void GX::reset(const IR& ir, Diagnostics& diag) /* Final instruction is the root call by hecl convention */ const IR::Instruction& rootCall = ir.m_instructions.back(); - bool doAlpha = false; if (!rootCall.m_call.m_name.compare("HECLOpaque")) { m_blendSrc = BL_ONE; @@ -705,13 +704,11 @@ void GX::reset(const IR& ir, Diagnostics& diag) { m_blendSrc = BL_SRCALPHA; m_blendDst = BL_INVSRCALPHA; - doAlpha = true; } else if (!rootCall.m_call.m_name.compare("HECLAdditive")) { m_blendSrc = BL_SRCALPHA; m_blendDst = BL_ONE; - doAlpha = true; } else { @@ -726,7 +723,7 @@ void GX::reset(const IR& ir, Diagnostics& diag) RecursiveTraceColor(ir, diag, colorRoot); /* Follow Alpha Chain */ - if (doAlpha) + if (rootCall.m_call.m_argInstIdxs.size() > 1) { const IR::Instruction& alphaRoot = ir.m_instructions.at(rootCall.m_call.m_argInstIdxs.at(1)); diff --git a/hecl/lib/Backend/ProgrammableCommon.cpp b/hecl/lib/Backend/ProgrammableCommon.cpp index 2ef7a356d..63a67444c 100644 --- a/hecl/lib/Backend/ProgrammableCommon.cpp +++ b/hecl/lib/Backend/ProgrammableCommon.cpp @@ -264,7 +264,6 @@ void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* back /* Final instruction is the root call by hecl convention */ const IR::Instruction& rootCall = ir.m_instructions.back(); - bool doAlpha = false; if (!rootCall.m_call.m_name.compare("HECLOpaque")) { m_blendSrc = BlendFactor::One; @@ -274,13 +273,11 @@ void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* back { m_blendSrc = BlendFactor::SrcAlpha; m_blendDst = BlendFactor::InvSrcAlpha; - doAlpha = true; } else if (!rootCall.m_call.m_name.compare("HECLAdditive")) { m_blendSrc = BlendFactor::SrcAlpha; m_blendDst = BlendFactor::One; - doAlpha = true; } else { @@ -295,7 +292,7 @@ void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* back m_colorExpr = RecursiveTraceColor(ir, diag, colorRoot, false); /* Follow Alpha Chain */ - if (doAlpha) + if (rootCall.m_call.m_argInstIdxs.size() > 1) { const IR::Instruction& alphaRoot = ir.m_instructions.at(rootCall.m_call.m_argInstIdxs.at(1));