def debugGui(): if _debug() == None: db = Debug() db.renderTarget = BigWorld.RenderTarget('debug post-processing', 1024, 1024) _debug(db) print 'created debug rT' import GUI w = GUI.Window('') GUI.addRoot(w) w.script = ChainView.ChainView(w) w.script.createChildren() w.size = (0.75, 3.0) return w
def debug(): """ This method hides the debug method in C++, and extends it by automatically creating a render target for the debug object , and showing a GUI component representing this texture """ import GUI s = GUI.Simple('') GUI.addRoot(s) db = Debug() db.renderTarget = BigWorld.RenderTarget('debug post-processing', 1024, 1024) _debug(db) s.texture = db.renderTarget.texture s.materialFX = 'SOLID' return s
def createChildren(self): d = _debug() if d is None or d.renderTarget is None: return else: effects = chain() if len(effects) == 0: return width = 2.0 / len(effects) maxPhases = 0 for e in effects: maxPhases = max(maxPhases, len(e.phases)) height = 2.0 / maxPhases x = -1.0 eIdx = 0 for e in effects: effectScript = EffectView(e, eIdx, maxPhases) s = effectScript.window s.height = 2.0 s.width = width s.horizontalAnchor = 'LEFT' s.verticalAnchor = 'CENTER' s.position = (x, 0.0, 1.0) self.component.addChild(s) x += width eIdx += 1 return
def createPhase(self, eIdx, pIdx, e, p, maxPhases): d = _debug() effects = chain() s = GUI.Window('') s.texture = d.renderTarget.texture uvs = d.phaseUV(eIdx, pIdx, len(effects), len(e.phases)) bl = (uvs[0], 1.0 - uvs[1]) tl = (uvs[0], 1.0 - uvs[3]) tr = (uvs[2], 1.0 - uvs[3]) br = (uvs[2], 1.0 - uvs[1]) s.mapping = (tl, bl, br, tr) s.horizontalAnchor = 'CENTER' s.verticalAnchor = 'TOP' s.materialFX = 'SOLID' self.setToClipMode(s) s.filterType = 'LINEAR' try: label = '%s (%d x %d)' % (p.name, p.renderTarget.width, p.renderTarget.height) except: label = '%s' % (p.name,) l = self.addLabel(s, label) return s
def createPhase(self, eIdx, pIdx, e, p, maxPhases): d = _debug() effects = chain() s = GUI.Window('') s.texture = d.renderTarget.texture uvs = d.phaseUV(eIdx, pIdx, len(effects), len(e.phases)) bl = (uvs[0], 1.0 - uvs[1]) tl = (uvs[0], 1.0 - uvs[3]) tr = (uvs[2], 1.0 - uvs[3]) br = (uvs[2], 1.0 - uvs[1]) s.mapping = (tl, bl, br, tr) s.horizontalAnchor = 'CENTER' s.verticalAnchor = 'TOP' s.materialFX = 'SOLID' self.setToClipMode(s) s.filterType = 'LINEAR' try: label = '%s (%d x %d)' % (p.name, p.renderTarget.width, p.renderTarget.height) except: label = '%s' % (p.name, ) l = self.addLabel(s, label) return s