Include alpha component in opaque shaders

This commit is contained in:
Jack Andersen 2017-01-29 18:15:35 -10:00
parent f1c4b733bd
commit 4a7b47200a
5 changed files with 8 additions and 14 deletions

View File

@ -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)

View File

@ -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

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit ed8cc3a57ba455bf345c260fed3cfa530d4afc97
Subproject commit 4fb95046a8add3a7c1c45f842880cc2ee429201d

View File

@ -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));

View File

@ -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));