Exemple #1
0
light2=Light(Light.LIGHTS[2])
light2.position=array([0.,-10.,10.,1.0])
scene.add_light(light2)

light3=Light(Light.LIGHTS[3])
light3.position=array([0.,0.,-10.,1.0])
scene.add_light(light3)


camera_center=objects_lib.Disk()
camera_center.set_color(array([0.5,0.5,0.5]))
camera_center.set_color_reflex(array([1.,1.,1.]),50.0)
camera_center.visibility=False

scene.add_object(camera_center)

#Adding objects
world_frame=objects_lib.Frame()
#scene.add_object(world_frame)
test_frame=identity(4)

#Add convex hull

points=rand(50, 3)
convex_hull=objects_lib.Convex_hull(points)
scene.add_object(convex_hull)


counter=0.0
counter2=-1.0
Exemple #2
0
triangle_prim.type=gl.GL_TRIANGLES
triangle_prim.vertices=array([[0.,0.,0.],
                        [1.,0.,0.],
                        [1.,1.,0.]])
triangle_prim.normals=array([[0.,0.,1.],
                       [0.,0.,1.],
                       [0.,0.,1.]])
triangle_obj=Object_model()
triangle_obj.add_primitive(triangle_prim)
triangle_obj.material_diffuse_color=array([0.,1.0,0.,1.])
triangle_obj.material_ambient_color=array([0.,0.2,0.,1.])
triangle_obj.material_shininess=50.
triangle_obj.material_specular_color=array([1.,1.,1.,1.])
triangle_obj.trans_rot_matrix[:,3][:3]=array([4.,4.,0.])
triangle_obj.visibility=True
scene.add_object(triangle_obj)

while True:
#for i in xrange(10):
    time.sleep(0.01)
    for event in pygame.event.get():
        print event
        if event.type == pygame.QUIT or (event.type ==pygame.KEYDOWN and event.key == pygame.K_q):
            sys.exit()
        #camera events:
        if event.type == pygame.MOUSEMOTION or event.type ==pygame.MOUSEBUTTONDOWN or event.type == pygame.MOUSEBUTTONUP:
            camera.update(event)
    display.update()

    
Exemple #3
0
light2=Light(Light.LIGHTS[2])
light2.position=array([0.,-10.,10.,1.0])
scene.add_light(light2)

light3=Light(Light.LIGHTS[3])
light3.position=array([0.,0.,-10.,1.0])
scene.add_light(light3)


camera_center=objects_lib.Disk()
camera_center.set_color(array([0.5,0.5,0.5]))
camera_center.set_color_reflex(array([1.,1.,1.]),50.0)
camera_center.visibility=False

scene.add_object(camera_center)

#Adding objects
world_frame=objects_lib.Frame()
scene.add_object(world_frame)
test_frame=identity(4)


counter=0.0
counter2=-1.0

from math import sin

from numpy.linalg import inv

while True:
Exemple #4
0
light0.position = array([10., 10., 10., 1.0])
scene.add_light(light0)

triangle_prim = Primitive()
triangle_prim.type = gl.GL_TRIANGLES
triangle_prim.vertices = array([[0., 0., 0.], [1., 0., 0.], [1., 1., 0.]])
triangle_prim.normals = array([[0., 0., 1.], [0., 0., 1.], [0., 0., 1.]])
triangle_obj = Object_model()
triangle_obj.add_primitive(triangle_prim)
triangle_obj.material_diffuse_color = array([0., 1.0, 0., 1.])
triangle_obj.material_ambient_color = array([0., 0.2, 0., 1.])
triangle_obj.material_shininess = 50.
triangle_obj.material_specular_color = array([1., 1., 1., 1.])
triangle_obj.trans_rot_matrix[:, 3][:3] = array([4., 4., 0.])
triangle_obj.visibility = True
scene.add_object(triangle_obj)

cylinder_obj = objects_lib.Cylinder()
cone_obj = objects_lib.Cone()

arrow = objects_lib.Arrow()
arrow.set_length(1.0)
arrow.set_color(array([1.0, 0., 0.]))
arrow.set_axis(array([0.0, 1., 2.]))

scene.add_object(arrow)

sphere_origin = objects_lib.Sphere()
sphere_origin.set_radius(0.1)
sphere_origin.set_pos(array([0., 0., 0.]))
sphere_origin.set_color(array([1.0, 1., 1.]))