Like this?
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
HidePointer
Global Camera = CreateCamera()
Global Light = CreateLight()
Global Plane = CreatePlane()
Global PlaneTex = CreateTexture (64,64)
Color 0,0,100
Rect 0,0,64,64
Color 0,0,150
Rect 0,0,32,32
Rect 32,32,32,32
CopyRect 0,0,64,64,0,0,BackBuffer(),TextureBuffer(PlaneTex)
EntityTexture Plane,PlaneTex
Type Cube
Field X,Y,Z,Mesh,Mark,Picked,Num
Field Active
End Type
Local CE.Cube,A
For A = 1 To 10
CE.Cube = New Cube
CE\Mesh = CreateCube()
CE\Mark = CreateCone()
CE\X = -10+A*2
CE\Y = 0
CE\Z = 15
CE\Num = A
CE\Active = True
PositionEntity CE\Mesh,CE\X,CE\Y,CE\Z
ScaleEntity CE\Mesh,0.9,0.9,0.9
EntityColor CE\Mesh,Rnd(100,200),Rnd(100,200),Rnd(100,200)
EntityPickMode CE\Mesh,2
PositionEntity CE\Mark,CE\X,CE\Y+2,CE\Z
RotateEntity CE\Mark,180,0,0
ScaleEntity CE\Mark,0.2,0.5,0.2
EntityColor CE\Mark,0,255,0
Next
While Not KeyDown (1)
If MouseHit (1)
CameraPick (Camera,MouseX(),MouseY())
If PickedEntity() <> 0
For CE.Cube = Each Cube
If PickedEntity() = CE\Mesh
CE\Picked = True
CE\Active = False
EndIf
Next
EndIf
EndIf
For CE.Cube = Each Cube
If CE\Picked = True
EntityAlpha CE\Mesh,0.1
EntityAlpha CE\Mark,0.1
Else
EntityAlpha CE\Mesh,1
EntityAlpha CE\Mesh,1
EndIf
Next
UpdateWorld
RenderWorld
For CE.Cube = Each Cube
Color 0,0,255
CameraProject Camera,CE\X,CE\Y,CE\Z
Tx = ProjectedX()
Ty = ProjectedY()
Text Tx, Ty,CE\Num,True,True
Color 0,128,0
;link active
If CE\Active
;last
l.cube = Before CE
If l <> Null
If l\Active
CameraProject Camera, l\X, l\Y, l\Z
Line Tx, Ty, ProjectedX(), ProjectedY()
EndIf
EndIf
;next
n.cube = After CE
If n <> Null
If n\Active
CameraProject Camera, n\X, n\Y, n\Z
Line Tx, Ty, ProjectedX(), ProjectedY()
EndIf
EndIf
EndIf
Next
Color 255,0,0
Line MouseX()-10,MouseY(),MouseX()+10,MouseY()
Line MouseX(),MouseY()-10,MouseX(),MouseY()+10
Flip
Wend
End
|