TUTORIAL 17:   This tutorial explains how Generate BillBoard Trees. Thanks to Nemo_Billboard Class 3D billboard sprite can be added. 3 Alignement are available for making different style of Billboard effects.
             
 

 

----TUTORIAL 17---

Using NemoX Billboard System

 

You will Need The NemoX engine Get it Here

download the Visual Basic Source code here

 

Summary

 

1. Declare and Initialize Billboard Class

2. Render Billboard Sprites

 

 

1. Declare and Initialize Billboard Class

Before using NemoX camera class, an object must be declared and allocated for it.
 

 

'Declare our billboard tree class

Dim TREES As cNemo_Billboards

     
      'allocate memory here
     
      Set TREES = New cNemo_Billboards
     
      'first we add some textures
      TREES.Add_Texture App.Path + "\Trees\tree1.bmp" 'we let Nemo calculate the colorKey and optimal texture size
      TREES.Add_Texture App.Path + "\Trees\tree2.bmp"   'index 1
      TREES.Add_Texture App.Path + "\Trees\tree3.bmp"   'index 2
      TREES.Add_Texture App.Path + "\Trees\Tree4.JPG"  'index 3

 

'for Adding billboards we use function : TREES.Add_BillBoard

Sub Add_BillBoard(vPos As D3DVECTOR, width As Single, height As Single, TextureID_InClass As Long, [Orientation As NEMO_BILBOARD_ORIENTATION], [Color As Long = -1])

Vpos= Position for our Billboard center
Width= the width of the billboard
Height= the height of the billboard
TextureID_InClass=Texture Index for billboard

Orientation =the alignement of billboard

 '0 for NEMO_BUILBOARD_SPHERICAL
 '1 for NEMO_BUILBOARD_CILYNDRICAL
 '2 for NEMO_BUILBOARD_4D
 

Dim Rand As Single 'for random number
     
      'we add 200 trees
      For I = 1 To 200
       
        Rand = Rnd
       
        'we let 20% chance to have a spherical buillboard Trees
        If Rand >= 0.8 Then _
        TREES.Add_BillBoard Vector((Rnd - Rnd) * 1500 + 800, 40, (Rnd - Rnd) * 1500 + 800), 120 + 15 * Rnd, 200 + 20 * Rnd, Int(Rnd * 2) + 1, NEMO_BUILBOARD_SPHERICAL
     
       'we let 30% chance to have a Cylindrical buillboard Trees
        If Rand < 0.8 And Rand > 0.5 Then _
        TREES.Add_BillBoard Vector((Rnd - Rnd) * 1500 + 800, 10, (Rnd - Rnd) * 1500 + 800), 120 + 15 * Rnd, 200 + 20 * Rnd, Int(Rnd * 2) + 1, NEMO_BUILBOARD_CILYNDRICAL
       
       
         'we let 50% chance to have a 4D buillboard Trees
        If Rnd <= 0.5 Then _
        TREES.Add_BillBoard Vector((Rnd - Rnd) * 1500 + 800, 40, (Rnd - Rnd) * 1500 + 800), 120 + 15 * Rnd + 15, 200 + 20 * Rnd, Int(Rnd * 2) + 1, NEMO_BUILBOARD_4D
     
     
      Next I
     
     
 

 

2. Render Billboard Sprites

 

'render trees
        TREES.RenderEX
        

 

Here is a screenshot for our tutorial project

download the Visual Basic Source code here

See you in the next Tutorial.....sincerly Polaris..Don't forget Any Bugs detect

    The Next: Tutorial 18 :Loading Quake 3 Bsp level

 The Previous: Tutorial 16 :Camera Bspline Path Following

 

Tutorial Written on April, 28 th 2003 by Polaris: johna_pop@yahoo.fr