Ejemplo n.º 1
0
    def __init__(self, node, radius=constants.DEFAULT_OPENGL_NODE_RADIUS):
        self.position = Vector3()
        self.radius = radius
        self.child_distance = 0

        self.acceleration = Vector3()
        self.velocity = Vector3()

        self.material = constants.OPENGL_NODE_MATERIAL

        self.collapsed = False
        self.node = node
        self.label = Label(self.node, Vector3(self.x, self.y, self.z))
Ejemplo n.º 2
0
    def layoutChildren(self, node):
        if node.hasChildren():
            self.pushAwayChildren(node)
            node_geom = node.geom
            radius = node_geom.radius + node_geom.child_distance

            opposite_vector = node_geom.position.__copy__()
            opposite_vector.y = 0
            opposite_vector = -opposite_vector.unit()

            if opposite_vector.rounded(threshold=1e-6) == Vector3.zero():
                drot = 2 * pi / node.size()
                rot = pi / 2

            else:
                rot = opposite_vector.angle()
                if node_geom.position.z > 0:
                    rot = 2 * pi - rot

                drot = 2 * pi / (node.size() + 1)
                rot += drot

            half_sqrt2 = sqrt(2) / 2

            for i in range(node.size()):
                child = node[i]
                child_geom = child.geom
                child_geom.position.x = cos(rot)
                child_geom.position.z = sin(rot)
                child_geom.position.y = -1
                child_geom.position.scale(half_sqrt2 * radius)
                rot += drot
                self.pushAwayFromParent(child)
                self.layoutChildren(child)
Ejemplo n.º 3
0
    def _drawCylinder(self, pos, radius, subdivisions, quadric):
        v1 = pos.__copy__()

        n1 = v1.unit()
        n2 = Vector3.unitZ()

        angle = n1.angle(n2)

        if abs(angle) < 0.001:
            angle = 0

        axis = -n1.cross(n2).unit()

        angle = angle * 180 / pi

        glRotatef(angle, axis.x, axis.y, axis.z)

        gluQuadricOrientation(quadric, GLU_OUTSIDE)
        gluCylinder(quadric, radius, radius, v1.length(), subdivisions, 1)
Ejemplo n.º 4
0
 def key_press(self, event):
     if event.key() == Qt.Key_Escape:
         sys.exit(1)
     else:
         key = event.key()
         movement = Vector3()
         if key == Qt.Key_W:
             movement -= Vector3.unitZ()
         elif key == Qt.Key_S:
             movement += Vector3.unitZ()
         elif key == Qt.Key_A:
             movement -= Vector3.unitX()
         elif key == Qt.Key_D:
             movement += Vector3.unitX()
         elif key == Qt.Key_E:
             movement += Vector3.unitY()
         elif key == Qt.Key_Q:
             movement -= Vector3.unitY()
         movement *= self.camera.movementSpeed
         self.camera.position += movement
Ejemplo n.º 5
0
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QColor, QFont

from lldbvis.util import Light, Material
from lldbvis.util.vectors import Vector4, Vector3

DEFAULT_MOUSE_SENSITIVITY = 0.005
DEFAULT_ZOOM_SPEED = 0.004
DEFAULT_MINIMAL_ZOOM = 30
DEFAULT_MAXIMAL_ZOOM = 0
MINIMAL_MOUSE_DRAG_INTENSITY = 0.01

DEFAULT_CAMERA_MOVEMENT_SPEED = 0.15
DEFAULT_CAMERA_POSITION = Vector3(0, 0, 10)
DEFAULT_CAMERA_EULER_ANGLES = Vector3()

DEFAULT_TEXT_COLOR = QColor(255, 255, 255)
ERROR_TEXT_COLOR = QColor(255, 0, 0)

COMMANDS_CATEGORY_H_SPACE = 25

LINE_NUMBER_AREA_PADDING_LEFT = 20
LINE_NUMBER_AREA_BACKGROUND_COLOR = QColor(200, 200, 200, 70)
LINE_NUMBER_AREA_FONT_COLOR = QColor(255, 255, 255, 120)

EDITOR_LINE_HIGHLIGHT_COLOR = QColor(255, 255, 255, 120).dark(255)

DEFAULT_WINDOW_SIZE = QSize(800, 600)

DEFAULT_OPENGL_TIMED_UPDATE_INTERVAL_MS = 30
OPENGL_BACKGROUND_COLOR = QColor(0.118 * 255.0, 0.133 * 255.0, 0.142 * 255.0,
Ejemplo n.º 6
0
 def __init__(self, anchor=Vector3()):
     self.anchor = anchor
Ejemplo n.º 7
0
 def __init__(self, node, position=Vector3()):
     self.node = node
     self.font = constants.OPENGL_LABEL_FONT
     self.fontMetrics = QFontMetrics(self.font)
     self.position = self.centerText(position)