示例#1
0
    def create_parts(self):
        gpu_base = es.toGPUShape(bs.createColorNormalsCube(1, 0, 0))
        gpu_arm0 = es.toGPUShape(bs.createColorNormalsCube(0, 1, 0))
        gpu_arm1 = es.toGPUShape(bs.createColorNormalsCube(0, 0, 1))

        node_arm1 = sg.SceneGraphNode("arm1")
        node_arm1.transform = tr.scale(
            0.5, 0.5, 5)  #tr.matmul([tr.scale(1,1,3),tr.translate(0,0,0)])
        node_arm1.childs += [gpu_arm1]

        node_arm0 = sg.SceneGraphNode("arm0")
        node_arm0.transform = tr.matmul(
            [tr.scale(0.5, 0.5, 6),
             tr.translate(0, 0, 0)])
        node_arm0.childs += [gpu_arm0]

        node_arms1 = sg.SceneGraphNode("arms1")
        #node_arms1.transform = tr.translate(0,0,4)
        node_arms1.childs += [node_arm1]

        node_arms0 = sg.SceneGraphNode("arms0")
        node_arms0.transform = tr.matmul(
            [tr.rotationX(0), tr.translate(0, 0, 2)])
        node_arms0.childs += [node_arm0, node_arms1]

        node_base = sg.SceneGraphNode("base")
        node_base.transform = tr.scale(3, 3, 1)
        node_base.childs += [gpu_base]

        node_all = sg.SceneGraphNode("all")
        node_all.childs += [node_arms0, node_base]

        self.big_node = node_all
示例#2
0
文件: ball.py 项目: TinSlim/ML-Arm
 def move(self, x, y, z):
     self.x = self.x + x
     self.y = self.y + y
     self.z = self.z + z
     cube = sg.findNode(self.big_node, "cube")
     cube.transform = ([
         tr.translate(self.x, self.y, self.z),
         tr.scale(0.5, 0.5, 0.5)
     ])
示例#3
0
文件: ball.py 项目: TinSlim/ML-Arm
 def translate(self, x, y, z):
     self.x = x
     self.y = y
     self.z = z
     cube = sg.findNode(self.big_node, "cube")
     cube.transform = ([
         tr.translate(self.x, self.y, self.z),
         tr.scale(0.5, 0.5, 0.5)
     ])
示例#4
0
文件: ball.py 项目: TinSlim/ML-Arm
    def create_parts(self):
        gpu_cube = es.toGPUShape(bs.createColorNormalsCube(1, 1, 0))

        node_cube = sg.SceneGraphNode("cube")
        node_cube.transform = ([
            tr.translate(1, 1, 0),
            tr.scale(0.5, 0.5, 0.5)
        ])
        node_cube.childs += [gpu_cube]

        node_all = sg.SceneGraphNode("all")
        node_all.childs += [node_cube]

        self.big_node = node_all
示例#5
0
文件: ball.py 项目: TinSlim/ML-Arm
 def actualize_img(self):
     cube = sg.findNode(self.big_node, "cube")
     cube.transform = ([
         tr.translate(self.x, self.y, self.z),
         tr.scale(0.5, 0.5, 0.5)
     ])