PB 4.30 : 3D - How to add a sight in a game -using Billboard

Share your advanced PureBasic knowledge/code with the community.
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

PB 4.30 : 3D - How to add a sight in a game -using Billboard

Post by Comtois »

as it is no longer possible to use the sprites or command ScreenOoutput () with the latest version of OGRE, here's a workaround.

i use this image
Image

et here how to use it

Code: Select all

;... Init code here

#Sight=0

;---------------------------------
;-Load texture and create material for the BillBoard
;---------------------------------

;-Texture
LoadTexture(#Sight,"viseur-jeux.png")

;-Material
CreateMaterial(#Sight,TextureID(#Sight))
MaterialBlendingMode(#Sight, #PB_Material_AlphaBlend)
DisableMaterialLighting(#Sight, 1)

;-Billboard
CreateBillboardGroup(#Sight, MaterialID(#Sight), 1, 1)
AddBillboard(0, #Sight, 0, 0, 0)

;Add camera etc 

Repeat

  ;-Some code here 

  ;-How to use    
  PointPick(0, Screen\Width/2, Screen\Height/2)
  BillboardGroupLocate(#Sight, CameraX(0)+ PickX()*15,CameraY(0)+ PickY()*15,CameraZ(0)+ PickZ()*15)	
  RenderWorld()
Until Condition	
Please correct my english
http://purebasic.developpez.com/