Code: Select all
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
Declare DrawText3D(x.f, y.f, z.f, Texte$, FrontColor, BackColor)
OpenWindow(0,0,0,800,600,"3D",#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget)
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)
LoadFont(0, "Arial", 12, #PB_Font_Bold)
CreateTexture(0, 64, 64)
CreateMaterial(0, TextureID(0))
MaterialBlendingMode(0, #PB_Material_Add)
MaterialSelfIlluminationColor(0, $FFFFFF)
; Then create the billboard group and use the previous material
;
CreateBillboardGroup(0, MaterialID(0), 64, 64)
AddBillboard(0, 0, 32, -32, 0)
CreateCube(0, 100)
CreateEntity(0, MeshID(0), #PB_Material_None)
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0, 0, 100, 600)
CameraLookAt(0, EntityX(0), EntityY(0) + 10, EntityZ(0))
CreateSprite(0, 64, 64)
Repeat
If ExamineMouse()
EndIf
If ExamineKeyboard()
EndIf
Texte$ = StrF(Engine3DFrameRate(#PB_Engine3D_Current),2)
DrawText3D(EntityX(0) -32, EntityY(0)+ 80, EntityZ(0), Texte$, RGB(255,255,0), 0)
RenderWorld()
StartDrawing(SpriteOutput(0))
DrawingFont(FontID(0))
DrawText(0, 0, Texte$, RGB(255,255,0))
StopDrawing()
x = CameraProjectionX(0,EntityX(0) + 60, EntityY(0)+ 80, EntityZ(0))
y = CameraProjectionY(0,EntityX(0) + 60, EntityY(0)+ 80, EntityZ(0))
DisplayTransparentSprite(0, x, y)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
Procedure DrawText3D(x.f, y.f, z.f, Texte$, FrontColor, BackColor)
StartDrawing(TextureOutput(0))
Box(0, 0, OutputWidth(), OutputHeight(), BackColor)
DrawingFont(FontID(0))
DrawText(0, 0, Texte$, FrontColor)
StopDrawing()
BillboardGroupLocate(0, x, y, z)
EndProcedure