diff --git a/src/athena/bildparser.py b/src/athena/bildparser.py index 3d96c76..d6a8868 100644 --- a/src/athena/bildparser.py +++ b/src/athena/bildparser.py @@ -40,7 +40,7 @@ def addCylinder( self, tokens ): self.cylinders.append( Cylinder( self.current_color, *(float(x)*(self.scale_factor) for x in tokens) ) ) def addArrow( self, tokens ): - self.arrows.append( Arrow( self.current_color, *(float(x) for x in tokens) ) ) + self.arrows.append( Arrow( self.current_color, *(float(x)*(self.scale_factor) for x in tokens) ) ) def debugSummary( self ): pattern = 'parsed BILD: {0} unique colors, {1} spheres, {2} cylinders, {3} arrows' +\ diff --git a/src/athena/decorations.py b/src/athena/decorations.py index c16736e..b066f2a 100644 --- a/src/athena/decorations.py +++ b/src/athena/decorations.py @@ -11,10 +11,13 @@ class SphereDecorations(Qt3DCore.QEntity): - def __init__(self, parent, spherelist): + def __init__(self, parent, bildfile): super().__init__(parent) + spherelist = bildfile.spheres num_spheres = len(spherelist) + if num_spheres == 0: return + total_vertices = num_spheres vertex_basetype = geom.basetypes.Float if( total_vertices < 30000 ): @@ -25,6 +28,7 @@ def __init__(self, parent, spherelist): vertex_nparr = np.zeros([total_vertices,7],dtype=geom.basetype_numpy_codes[vertex_basetype]) for idx, (color, x, y, z, r) in enumerate(spherelist): + if color is None: color = QColor('white') vertex_nparr[idx,:] = x, y, z, r, color.redF(), color.greenF(), color.blueF() self.geometry = Qt3DRender.QGeometry(self) @@ -54,10 +58,14 @@ def __init__(self, parent, spherelist): class CylinderDecorations(Qt3DCore.QEntity): - def __init__(self, parent, cylinderlist): + def __init__(self, parent, bildfile): super().__init__(parent) + # Draw the arrow bodies as cylinders too + cylinderlist = bildfile.cylinders + [ Cylinder(*x[:8]) for x in bildfile.arrows] num_cylinders = len(cylinderlist) + if num_cylinders == 0: return + total_vertices = 2 * num_cylinders vertex_basetype = geom.basetypes.Float if( total_vertices < 30000 ): @@ -67,6 +75,7 @@ def __init__(self, parent, cylinderlist): vertex_nparr = np.zeros([total_vertices,7],dtype=geom.basetype_numpy_codes[vertex_basetype]) for idx, (color, x1, y1, z1, x2, y2, z2, r) in enumerate(cylinderlist): + if color is None: color = QColor('white') vertex_nparr[2*idx,:] = x1, y1, z1, r, color.redF(), color.greenF(), color.blueF() vertex_nparr[2*idx+1,:] = x2, y2, z2, r, color.redF(), color.greenF(), color.blueF() diff --git a/src/athena/mainwindow.py b/src/athena/mainwindow.py index fbcc059..e9d2792 100644 --- a/src/athena/mainwindow.py +++ b/src/athena/mainwindow.py @@ -165,7 +165,6 @@ def parseLCBBToolOutput( output ): iter_out = iter(output.split('\n')) for line in iter_out: if line.strip().startswith('2.7.'): - print(line) line27a = next(iter_out) line27b = next(iter_out) result['edge_length'] = float( line27a.split(':')[1].strip() ) @@ -372,7 +371,7 @@ def selectOutput( self, selection_idx ): if selection_idx == -1: return (bildfile, scale_factor) = self.outputSelectBox.itemData(selection_idx) decorations = bildparser.parseBildFile( bildfile, scale_factor ) - print(decorations.debugSummary()) + #print(decorations.debugSummary()) self.geomView.newDecorations( decorations ) def updateStatus( self, msg ): diff --git a/src/athena/viewer.py b/src/athena/viewer.py index 5df6210..c5844c7 100644 --- a/src/athena/viewer.py +++ b/src/athena/viewer.py @@ -332,16 +332,17 @@ def __init__(self): self.transPassFilter.setValue('transp') self.qfilt2.addMatch(self.transPassFilter) - fg = self.activeFrameGraph() - def frameGraphLeaf(node, prefix=' '): - print(prefix, node, node.objectName()) - children = node.children() - for c in children: - frameGraphLeaf(c, prefix+'-') - - frameGraphLeaf(fg) + # Framegraph display and testing code + #fg = self.activeFrameGraph() + #def frameGraphLeaf(node, prefix=' '): + #print(prefix, node, node.objectName()) + #children = node.children() + #for c in children: + #frameGraphLeaf(c, prefix+'-') + + #frameGraphLeaf(fg) self.setActiveFrameGraph(self.surfaceSelector) - frameGraphLeaf(self.activeFrameGraph()) + #frameGraphLeaf(self.activeFrameGraph()) self.setBackgroundColor( QColor(63,63,63) ) self.lightOrientation = int(0) # Internal integer controlling light.position attribute @@ -400,10 +401,10 @@ def frameGraphLeaf(node, prefix=' '): backgroundColorChanged = Signal( QColor ) def backgroundColor( self ): - return self.defaultFrameGraph().clearColor() + return self.clearBuffers.clearColor() def setBackgroundColor( self, color ): - self.defaultFrameGraph().setClearColor( color ) + self.clearBuffers.setClearColor( color ) self.backgroundColorChanged.emit(color) faceRenderingEnabledChanged = Signal( bool ) @@ -481,9 +482,9 @@ def newDecorations(self, bild_results): self.clearDecorations() if( bild_results.spheres ): - self.spheres = decorations.SphereDecorations(self.decorationEntity, bild_results.spheres) + self.spheres = decorations.SphereDecorations(self.decorationEntity, bild_results) self.spheres.addComponent( self.sphere_material ) if( bild_results.cylinders ): - self.cylinders = decorations.CylinderDecorations(self.decorationEntity, bild_results.cylinders) + self.cylinders = decorations.CylinderDecorations(self.decorationEntity, bild_results) self.cylinders.addComponent( self.cylinder_material ) diff --git a/src/qml/imposter.qml b/src/qml/imposter.qml index b6f2719..2f6e180 100644 --- a/src/qml/imposter.qml +++ b/src/qml/imposter.qml @@ -29,7 +29,9 @@ Material { RenderPass { // populated with a shader within geomview.py, since qml cannot usefully work with // relative file paths for shader loading - renderStates: [ MultiSampleAntiAliasing{} ] + renderStates: [ CullFace{ mode: CullFace.NoCulling }, + DepthTest{ depthFunction: DepthTest.LessOrEqual }, + MultiSampleAntiAliasing{} ] } ] } ]