Ejemplo n.º 1
0
import sys, pygame
from numpy import array, identity, cos , sin, dot, invert, pi
from avispy.engine import Camera, Scene, Light, Display, Primitive, Object_model, rotx, roty, rotz
import avispy.objects_lib as objects_lib
from numpy.random import rand

xyz_inc=0.1
rot_inc=1*pi/180.0

import time
camera=Camera()
size= 640,480
scene=Scene()
display=Display(camera,scene,res=size)

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

light1=Light(Light.LIGHTS[1])
light1.position=array([-10.,10.,10.,1.0])
scene.add_light(light1)

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)
Ejemplo n.º 2
0
import OpenGL.GL as gl

import sys, pygame
from numpy import array, identity, cos , sin, dot, invert, pi
from avispy.engine import Camera, Scene, Light, Display, Primitive, Object_model

xyz_inc=0.1
rot_inc=1*pi/180.0

import time
camera=Camera()
size= 640,480
scene=Scene()
display=Display(camera,scene,res=size)

light0=Light(gl.GL_LIGHT0)
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.])