当前位置: 首页>>代码示例>>Python>>正文


Python opengl.GLMeshItem方法代码示例

本文整理汇总了Python中pyqtgraph.opengl.GLMeshItem方法的典型用法代码示例。如果您正苦于以下问题:Python opengl.GLMeshItem方法的具体用法?Python opengl.GLMeshItem怎么用?Python opengl.GLMeshItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph.opengl的用法示例。


在下文中一共展示了opengl.GLMeshItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clearControls

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLMeshItem [as 别名]
def clearControls(self):
    """
    Reset all controls.
    """

    # Remove all items
    while len(self.simulationViewer.items) > 0:
      self.simulationViewer.removeItem(self.simulationViewer.items[0])

    # Draw a sphere only to initialize simulation.
    # If we don't do this, viewer crashes. Probably a PYQtGraph bug
    fooMd = gl.MeshData.sphere(rows=10, cols=10)
    self.fooItem = gl.GLMeshItem(meshdata=fooMd, smooth=False, shader='shaded', glOptions='opaque')
    self.fooItem.translate(0, 0, 0)
    self.simulationViewer.addItem(self.fooItem)
    self.simulationViewer.setCameraPosition(distance = 10000) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:18,代码来源:simulation_form.py

示例2: __drawBit

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLMeshItem [as 别名]
def __drawBit(self, bit):

    # Update properties according to state
    isVisible = True
    if self.menuShowBitsNone.isChecked():
      isVisible = False
    elif bit.isFalselyPredicted.atGivenStepAgo(Global.selStep) and self.menuShowBitsFalselyPredicted.isChecked():
      color = self.colorBitFalselyPredicted
    elif bit.isPredicted.atGivenStepAgo(Global.selStep) and self.menuShowBitsPredicted.isChecked():
      color = self.colorBitPredicted
    elif bit.isActive.atGivenStepAgo(Global.selStep) and self.menuShowBitsActive.isChecked():
      color = self.colorBitActive
    else:
      color = self.colorInactive

    if isVisible:
      # Draw the input bit
      if not bit.tree3d_initialized:
        # TODO: Use cube instead of sphere
        bitMd = gl.MeshData.sphere(rows=2, cols=4)
        bit.tree3d_item = gl.GLMeshItem(meshdata=bitMd, shader='shaded', smooth=False, glOptions='opaque')
        bit.tree3d_item.translate(bit.tree3d_x, bit.tree3d_y, bit.tree3d_z)
        bit.tree3d_initialized = True
        self.simulationViewer.addItem(bit.tree3d_item)

      # Update the color
      if bit.tree3d_selected:
        color = self.colorSelected
      bit.tree3d_item.setColor(color)

    if bit.tree3d_item != None:
      bit.tree3d_item.setVisible(isVisible) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:34,代码来源:simulation_form.py

示例3: draw_3d_bbox_meshes_in_pyqt

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLMeshItem [as 别名]
def draw_3d_bbox_meshes_in_pyqt(widget,
                                bboxes,
                                colors=GLColor.Gray,
                                alpha=1.0,
                                edgecolors=None):
    verts, faces = _3d_bbox_to_mesh(bboxes)
    if not isinstance(colors, list):
        if isinstance(colors, GLColor):
            colors = gl_color(colors, alpha)
        colors = np.array([colors for i in range(len(verts))])
    m1 = gl.GLMeshItem(
        vertexes=verts, faces=faces, faceColors=colors, smooth=False)
    m1.setGLOptions('additive')
    widget.addItem(m1)
    return widget 
开发者ID:traveller59,项目名称:second.pytorch,代码行数:17,代码来源:bbox_plot.py

示例4: __drawCell

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLMeshItem [as 别名]
def __drawCell(self, cell):

    # Update properties according to state
    isVisible = True
    if self.menuShowCellsNone.isChecked():
      isVisible = False
    elif cell.isFalselyPredicted.atGivenStepAgo(Global.selStep) and self.menuShowCellsFalselyPredicted.isChecked():
      color = self.colorCellFalselyPredicted
    elif cell.isPredicted.atGivenStepAgo(Global.selStep) and self.menuShowCellsPredicted.isChecked():
      color = self.colorCellPredicted
    elif cell.isLearning.atGivenStepAgo(Global.selStep) and self.menuShowCellsLearning.isChecked():
      color = self.colorCellLearning
    elif cell.isActive.atGivenStepAgo(Global.selStep) and self.menuShowCellsActive.isChecked():
      color = self.colorCellActive
    elif self.menuShowCellsInactive.isChecked():
      color = self.colorInactive
    else:
      isVisible = False

    if isVisible:
      # Draw the cell
      if not cell.tree3d_initialized:
        cellMd = gl.MeshData.sphere(rows=10, cols=10)
        cell.tree3d_item = gl.GLMeshItem(meshdata=cellMd, shader='shaded', smooth=False, glOptions='opaque')
        cell.tree3d_item.translate(cell.tree3d_x, cell.tree3d_y, cell.tree3d_z)
        cell.tree3d_initialized = True
        self.simulationViewer.addItem(cell.tree3d_item)

      # Update the color
      if cell.tree3d_selected:
        color = self.colorSelected
      cell.tree3d_item.setColor(color)

    if cell.tree3d_item != None:
      cell.tree3d_item.setVisible(isVisible)

    # Draw/update all distal segments
    for segment in cell.segments:
      segment.tree3d_x1 = cell.tree3d_x
      segment.tree3d_y1 = cell.tree3d_y
      segment.tree3d_z1 = cell.tree3d_z
      segment.tree3d_x2, segment.tree3d_y2, segment.tree3d_z2 = self.__calculateSegmentEndPos(segment, segment.tree3d_x1, segment.tree3d_y1, segment.tree3d_z1)
      self.__drawSegment(segment) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:45,代码来源:simulation_form.py


注:本文中的pyqtgraph.opengl.GLMeshItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。