Questions about a Billboard source code
Posted: Sun Jun 15, 2003 8:19 pm
Hi!
I got two questions about this source code.
First:
If you start the source code and you press cursor down you will see 21 balls. 12 of these balls are flying away the 9 will stay. Why aren´t fly all away ?
Second:
If you un-remark the line with the RorateMaterial() function you will see the balls are no balls anymore. Why ?
Thank you & MFG
WolfgangS
I got two questions about this source code.
First:
If you start the source code and you press cursor down you will see 21 balls. 12 of these balls are flying away the 9 will stay. Why aren´t fly all away ?
Second:
If you un-remark the line with the RorateMaterial() function you will see the balls are no balls anymore. Why ?
Thank you & MFG
WolfgangS
Code: Select all
#CameraSpeed = 10
#AmountBB = 20 ; 0-20 = 21 BillBoards
IncludeFile "Screen3DRequester.pb"
DefType.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
; create a Texture
CreateTexture(10,64,64)
StartDrawing(TextureOutput(10))
Circle(32,32,16,$9abcde)
StopDrawing()
; create A Material + Rorate + BlendingMode
CreateMaterial(10, TextureID(10))
;RotateMaterial(10,0.1,#PB_Material_Animated)
MaterialBlendingMode(#10, #PB_Material_add)
; create Billboard
CreateBillboardGroup(0, MaterialID(10), 10, 10)
; Create the Billboards
For i=0 To #AmountBB
AddBillboard(i,0,Random(80),Random(80),Random(80))
Next
; Creat the Camera
CreateCamera(0, -200, -250, 100, 100)
CameraLookAt(0,152,72,0)
Repeat
Screen3DEvents()
ClearScreen(0, 0, 0)
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
; Move the Billboards
For i=0 To #AmountBB
MoveBillboard(i,0,0,1,0)
Next
If ExamineMouse()
MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
EndIf
RotateCamera(0, MouseX, MouseY, RollZ)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
;Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
; ExecutableFormat=Windows
; CursorPosition=12
; FirstLine=1
; EOF