Do post affine transforms. How did I miss this?

This commit is contained in:
Steven Robertson 2011-10-16 13:43:46 -04:00
parent 5111a0f05c
commit 0cc904c4f1
2 changed files with 11 additions and 1 deletions

View File

@ -118,6 +118,10 @@ void apply_xf{{xfid}}(float &ox, float &oy, float &color, mwc_st &rctx) {
} }
{{endfor}} {{endfor}}
{{if xform.has_post}}
tx = ox;
ty = oy;
{{apply_affine_flam3('tx', 'ty', 'ox', 'oy', px, 'xf.post', 'post')}}
{{endif}} {{endif}}
float csp = {{px.get('xf.color_speed')}}; float csp = {{px.get('xf.color_speed')}};

View File

@ -458,9 +458,15 @@ class XFormFeatures(object):
def __init__(self, xforms, xform_id): def __init__(self, xforms, xform_id):
self.id = xform_id self.id = xform_id
any = lambda l: bool(filter(None, map(l, xforms))) any = lambda l: bool(filter(None, map(l, xforms)))
self.has_post = any(lambda xf: getattr(xf, 'post', None))
self.has_post = any(lambda xf: not self.id_matrix(xf.post))
self.vars = set() self.vars = set()
for x in xforms: for x in xforms:
self.vars = ( self.vars = (
self.vars.union(set([i for i, v in enumerate(x.var) if v]))) self.vars.union(set([i for i, v in enumerate(x.var) if v])))
@staticmethod
def id_matrix(m):
return (m[0][0] == 1 and m[1][0] == 0 and m[2][0] == 0 and
m[0][1] == 0 and m[1][1] == 1 and m[2][1] == 0)