Graphics3D 640,480,16,2
SetBuffer BackBuffer()
cam = CreateCamera()
MoveEntity cam, 0,0,-12
light=CreateLight()
mesh = CreateMesh()
surface=CreateSurface(mesh)
; this is the front face of the cube - the one initially facing you
v1=AddVertex(surface,-2,-2,-2); bottom left corner
v2=AddVertex(surface,-2, 2,-2); top left corner
v3=AddVertex(surface, 2, 2,-2); top right corner
v4=AddVertex(surface, 2,-2,-2); bottom right corner
VertexColor surface,v1,255,0,0
VertexColor surface,v2,255,0,0
VertexColor surface,v3,255,0,0
VertexColor surface,v4,255,0,0
EntityFX mesh,2
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
; this is the left face of the cube - the one initially facing left
v1=AddVertex(surface,-2,-2, 2); bottom left corner
v2=AddVertex(surface,-2, 2, 2); top left corner
v3=AddVertex(surface,-2, 2,-2); top right corner
v4=AddVertex(surface,-2,-2,-2); bottom right corner
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
; this is the right face of the cube - the one initially facing right
v1=AddVertex(surface, 2,-2,-2); bottom left corner
v2=AddVertex(surface, 2, 2,-2); top left corner
v3=AddVertex(surface, 2, 2, 2); top right corner
v4=AddVertex(surface, 2,-2, 2); bottom right corner
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
; this is the rear face of the cube - the one initially facing the rear
v1=AddVertex(surface, 2,-2, 2); bottom left corner
v2=AddVertex(surface, 2, 2, 2); top left corner
v3=AddVertex(surface,-2, 2, 2); top right corner
v4=AddVertex(surface,-2,-2, 2); bottom right corner
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
; this is the top face of the cube - the one initially facing the up
v1=AddVertex(surface,-2, 2,-2); bottom left corner
v2=AddVertex(surface,-2, 2, 2); top left corner
v3=AddVertex(surface, 2, 2, 2); top right corner
v4=AddVertex(surface, 2, 2,-2); bottom right corner
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
; this is the bottom face of the cube - the one initially facing the down
v1=AddVertex(surface,-2,-2, 2); bottom left corner
v2=AddVertex(surface,-2,-2,-2); top left corner
v3=AddVertex(surface, 2,-2,-2); top right corner
v4=AddVertex(surface, 2,-2, 2); bottom right corner
tri1=AddTriangle(surface,v1,v2,v3); the left triangle
tri2=AddTriangle(surface,v1,v3,v4); the right triangle
UpdateNormals mesh
x#=.5
y#=.5
z#=.5
While Not KeyHit(1)
c=c+1
If c=200
x=Rnd(5)/10
y=Rnd(5)/10
z=Rnd(5)/10
c=0
EndIf
TurnEntity mesh,x,y,z
RenderWorld
Flip
Wend
End
I knocked that up kind of quick - but you see the point behind it.
|