def createWidget(self, parent): widget = quarter.QuarterWidget(parent, self._firstwidget) if not self._firstwidget: self._firstwidget = widget self.connect(widget, QtCore.SIGNAL("destroyed(QObject*)"), self, QtCore.SLOT("widgetDestroyed(QObject*)")) widget.setSceneGraph(coin.SoCube()) return widget
def main(): app = QApplication(sys.argv) utils.addMarkerFromSvg("test.svg", "CUSTOM_MARKER", 40) viewer = quarter.QuarterWidget() root = graphics.InteractionSeparator(viewer.sorendermanager) root.pick_radius = 40 m1 = ConnectionMarker([[-1, -1, -1]]) m2 = ConnectionMarker([[-1, 1, -1]]) m3 = ConnectionMarker([[1, 1, -1]]) m4 = ConnectionMarker([[1, -1, -1]]) m5 = ConnectionMarker([[-1, -1, 1]]) m6 = ConnectionMarker([[-1, 1, 1]]) m7 = ConnectionMarker([[1, 1, 1]]) m8 = ConnectionMarker([[1, -1, 1]]) points = [m1, m2, m3, m4, m5, m6, m7, m8] l01 = ConnectionLine([m1, m2]) l02 = ConnectionLine([m2, m3]) l03 = ConnectionLine([m3, m4]) l04 = ConnectionLine([m4, m1]) l05 = ConnectionLine([m5, m6]) l06 = ConnectionLine([m6, m7]) l07 = ConnectionLine([m7, m8]) l08 = ConnectionLine([m8, m5]) l09 = ConnectionLine([m1, m5]) l10 = ConnectionLine([m2, m6]) l11 = ConnectionLine([m3, m7]) l12 = ConnectionLine([m4, m8]) lines = [l01, l02, l03, l04, l05, l06, l07, l08, l09, l10, l11, l12] p1 = ConnectionPolygon([m1, m2, m3, m4]) p2 = ConnectionPolygon([m8, m7, m6, m5]) p3 = ConnectionPolygon([m5, m6, m2, m1]) p4 = ConnectionPolygon([m6, m7, m3, m2]) p5 = ConnectionPolygon([m7, m8, m4, m3]) p6 = ConnectionPolygon([m8, m5, m1, m4]) polygons = [p1, p2, p3, p4, p5, p6] root += points + lines + polygons root.register() viewer.setSceneGraph(root) viewer.setBackgroundColor(QColor(255, 255, 255)) viewer.setWindowTitle("minimal") viewer.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) viewer = quarter.QuarterWidget() root = coin.SoSeparator() root += coin.SoCone() root += test() viewer.setSceneGraph(root) viewer.setBackgroundColor(QColor(255, 255, 255)) viewer.setWindowTitle("minimal") viewer.show() sys.exit(app.exec_())
def main(): app = QtWidgets.QApplication(sys.argv) viewer = quarter.QuarterWidget() # build a scene (sphere, cube) plane = coin.SbPlane(coin.SbVec3f(0, 0, 1), coin.SbVec3f(0, 0, 0)) root = coin.SoSeparator() myCallback = coin.SoCallback() cap = CapPlane(plane, root) myCallback.setCallback(myCallbackRoutine, cap) root += myCallback, coin.SoSphere() viewer.setSceneGraph(root) viewer.setBackgroundColor(coin.SbColor(.5, .5, .5)) viewer.setWindowTitle("GL stencil buffer") viewer.show() sys.exit(app.exec_())
def main(): app = QtWidgets.QApplication(sys.argv) root = coin.SoSeparator() mat = coin.SoMaterial() mat.diffuseColor.setValue(coin.SbColor(0.8, 1, 0.8)) mat.specularColor.setValue(coin.SbColor(1, 1, 1)) mat.shininess.setValue(1.0) mat.transparency.setValue(0.9) root.addChild(mat) root.addChild(coin.SoSphere()) root.addChild(coin.SoCube()) viewer = quarter.QuarterWidget() viewer.setSceneGraph(root) viewer.setWindowTitle("minimal") viewer.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) root = coin.SoSeparator() vert = coin.SoVertexShader() vert.sourceProgram = "vertex.glsl" frag = coin.SoFragmentShader() frag.sourceProgram = "frag.glsl" shaders = [vert,frag] pro = coin.SoShaderProgram() pro.shaderObject.setValues(0,len(shaders),shaders) mat = coin.SoMaterial() mat.diffuseColor.setValue(coin.SbColor(0.8, 0.8, 0.8)) mat.specularColor.setValue(coin.SbColor(1, 1, 1)) mat.shininess.setValue(1.0) mat.transparency.setValue(0.5) sphere = coin.SoSphere() sphere.radius = 1.2 root.addChild(pro) root.addChild(sphere) root.addChild(mat) root.addChild(coin.SoCube()) viewer = quarter.QuarterWidget() viewer.setSceneGraph(root) viewer.setWindowTitle("minimal") viewer.show() sys.exit(app.exec_())
shape_hint.creaseAngle = coin.M_PI / 3 face_mat = coin.SoMaterial() face_mat.diffuseColor = color vertex_property.vertex.setValues(0, len(_vertices), _vertices) face_set.coordIndex.setValues(0, len(_polygons), list(_polygons)) vertex_property.materialBinding = coin.SoMaterialBinding.PER_VERTEX_INDEXED sep += shape_hint, vertex_property, face_mat, face_set if draw_lines: line_set = coin.SoIndexedLineSet() line_set.coordIndex.setValues(0, len(_lines), list(_lines)) line_mat = coin.SoMaterial() line_mat.diffuseColor = (.0, .0, .0) sep += line_mat, line_set return sep root = coin.SoSeparator() surface(root) # Initialize Inventor and Qt app = QtGui.QApplication([]) viewer = quarter.QuarterWidget() viewer.setSceneGraph(root) viewer.setWindowTitle("parametric layer") viewer.show() # viewer.viewAll() sys.exit(app.exec_())