def create_sample_scene(self): # to create a ball sphere_node = Sphere() # to set the ball's color sphere_node.color_index = 2 sphere_node.translate(2, 2, 0) sphere_node.scale(4) #to put the ball in the scene.Default middle of view self.scene.add_node(sphere_node) #to add a snowman hierarchical_node = SnowFigure() hierarchical_node.translate(-2, 0, 2) hierarchical_node.scale(2) self.scene.add_node(hierarchical_node)
def create_sample_scene(self): # 创建一个立方体 cube_node = Cube() cube_node.translate(2, 0, 2) cube_node.color_index = 1 self.scene.add_node(cube_node) # 创建一个球体 sphere_node = Sphere() # 设置球体颜色 sphere_node.color_index = 2 sphere_node.translate(2, 2, 0) sphere_node.scale(4) # 将球体放入场景 self.scene.add_node(sphere_node) # 添加雪人 hierarchical_node = SnowFigure() hierarchical_node.translate(-2, 0, -2) hierarchical_node.scale(2) self.scene.add_node(hierarchical_node)