Показать сообщение отдельно
Старый 07.12.2006, 02:48   #12
HolyDel
 
Регистрация: 26.09.2006
Сообщений: 6,035
Написано 1,474 полезных сообщений
(для 2,707 пользователей)
Re: Вывод названий элементов загруженной модели

вот, с альфой разобрался, с камерой лажа какая-то, может позже разберусь (если разьерусь вообще)
[blitz]
Graphics3D 800,600,16,1
SetBuffer=BackBuffer()

;-globals-
Global fntArial, fntA
Global camera=CreateCamera() ; create camera (!!!)

cam2=CreateCamera()
PositionEntity cam2,-100000,0,0
CameraViewport cam2,0,500,100,100

AmbientLight 226,225,226 ;общий свет


;создаем эээ... машинку
Global player=CreateCube() ; create simple player
MoveEntity player,0,0,0
EntityType player,type_camera
EntityAlpha player,0
EntityRadius player,10,2

; грузим шрифты
fntArial=LoadFont("Arial cyr",20)



;главная модель
sp =LoadAnimMesh("21.3ds")
PositionEntity sp,0,-5,-5
ScaleEntity sp,0.0001,0.0001,0.0001
EntityColor sp,255,255,255
MoveEntity sp,-260,-20,150

PickModeMesh(sp,2) ;юзаем пикентити

HidePointer ;прячем мышку
SetBuffer BackBuffer()
oent=0

While Not KeyHit(1)

; If MouseHit(1) ; Отрубить если отрубить клик мыши
ent=CameraPick(camera,MouseX(),MouseY())

If oent<>ent And oent<>0 Then EntityAnimAlpha(oent,1)

If ent
If showmodel=0 Then showmodel=CopyEntity(ent)
name$=EntityName(ent)
;EntityAnimAlpha(ent,Abs(Sin(MilliSecs()*2))/2+0.6)
EntityAlpha ent,Abs(Sin(MilliSecs()*2))/2+0.6
Else
If showmodel<>0 Then FreeEntity showmodel:showmodel=0
EndIf
oent=ent

If KeyDown(200) Then
MoveEntity player,0,0,.2
End If

If KeyDown(20 Then
MoveEntity player,0,0,-.2
End If

If KeyDown(203) TurnEntity player,0,1,0
If KeyDown(205) TurnEntity player,0,-1,0

SuperCam(camera,player,.02,18,4,40,2)
SetCameraFOV(Camera, 100)

;SuperCam(camera,player,.02,18,4,40,2)
SetCameraFOV(Cam2, 100)

UpdateWorld

If showmodel=0
CameraProjMode cam2,0
CameraProjMode camera,1
RenderWorld
Else

CameraClsColor cam2,Rnd(40),0,0

CameraProjMode cam2,1
CameraProjMode camera,1
PositionEntity showmodel,-100000,0,-150
TurnEntity showmodel,1,0,0.1
EntityAlpha showmodel,1
PointEntity cam2,showmodel
RenderWorld



EndIf


SetFont fntArial
If Not name$=""
Color 32,32,32
OutlineText mx+20,my,"объект: "+name$
Color 255,255,255
Text mx+20,my,"объект: "+name$
EndIf

;; курсор мыши
mx=MouseX()
my=MouseY()
Color 32,32,32
For tx=-1 To 1
For ty=-1 To 1
Line mx+tx,my+ty,mx+6+tx,my+6+ty
Line mx+tx,my+ty,mx+tx,my+8+ty
Next
Next
Color 255,255,255
Line mx,my,mx+6,my+6
Line mx,my,mx,my+8

; скриншоты
If KeyDown (59)
SaveBuffer FrontBuffer (), "grab" + grab + ".bmp"
grab = grab + 1
EndIf

Flip

Wend
End


FreeFont fntArial
FreeFont fntA



Function SetCameraFOV(Camera, FOV#)
CameraZoom Camera, 1.0 / Tan(FOV#/2.0)
End Function

Function SuperCam(cam,ent,cspeed#,dist#,hite#,xrot#,tilt#)

TFormPoint 0,hite#,-dist#,ent,0

cx#=(TFormedX()-EntityX(cam))*cspeed#
cy#=(TFormedY()-EntityY(cam))*cspeed#
cz#=(TFormedZ()-EntityZ(cam))*cspeed#

TranslateEntity cam,cx,cy,cz
PointEntity cam,ent
RotateEntity cam,xrot#,EntityYaw(cam),tilt#

End Function

Function PickModeMesh(entity,t_ype)
For i=1 To CountChildren(entity)
child=GetChild(entity,i)
EntityPickMode child,t_ype

If CountChildren(child)>0
PickModeMesh(child,t_ype)

EndIf
Next
End Function

Function EntityAnimColor(m,r,g,b)
If EntityClass$(m)="Mesh"
EntityColor m,r,200,b
EndIf
For i=1 To CountChildren(m)
ww=GetChild(m,i)
EntityAnimColor(ww,r,200,b)
Next
End Function

Function EntityAnimAlpha(m,a#)
If EntityClass$(m)="Mesh"
EntityAlpha m,a#
EndIf
For i=1 To CountChildren(m)
ww=GetChild(m,i)
EntityAnimAlpha(ww,a#)
Next
End Function

Function OutlineText(TextX,TextY,TextTxt$,TextCenter=False, TextVertical=False)
For tx=-1 To 1
For ty=-1 To 1
Text TextX+tx,TextY+ty,TextTxt$,TextCenter,TextVertical
Next
Next
End Function
[/blitz]
(Offline)
 
Ответить с цитированием