Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
billboard [2019/03/12 13:26] – created admin | billboard [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Billboard ====== | ||
- | A billboard controls proxy objects of a basis mesh instance (source object). | ||
- | |||
- | The billboard component is a mesh itself, into which proxies are merged. Much faster rendering is possible if proxy meshes are merge into one mesh, instead of rendering each mesh. | ||
- | |||
- | We typically use this technique for grass or trees. | ||
- | It is not suitable for animated meshes. | ||
- | |||
- | ===== Using a grass billboard ===== | ||
- | |||
- | In this example we will display grass on multiplied planes inside of the billboard component. | ||
- | After applying the TGorillaGrassMaterial we are able to render different textures onto those planes and to manipulate vertices. | ||
- | |||
- | The result should be a varying grass landscape with waving grass. | ||
- | |||
- | <file pascal Form1.pas> | ||
- | procedure TForm1.FormCreate(Sender: | ||
- | var LBillboard : TPlane; | ||
- | | ||
- | | ||
- | LAlg : TGorillaBillboardRectFilling; | ||
- | begin | ||
- | // creating the source object - here a plane | ||
- | LBillboard := TPlane.Create(fGorilla); | ||
- | LBillboard.Scale.Point := Point3D(4, 4, 4); | ||
- | | ||
- | // creating the grass material source | ||
- | FGrassMat := TGorillaGrassMaterialSource.Create(FGorilla); | ||
- | FGrassMat.Parent := FGorilla; | ||
- | | ||
- | // now we load a pool of grass textures, the material shader | ||
- | // randomly chooses from | ||
- | with FGrassMat do | ||
- | begin | ||
- | LPoolE := Bitmaps.Add() as TGorillaBitmapPoolEntry; | ||
- | LPoolE.Bitmap.LoadFromFile(' | ||
- | |||
- | LPoolE := Bitmaps.Add() as TGorillaBitmapPoolEntry; | ||
- | LPoolE.Bitmap.LoadFromFile(' | ||
- | |||
- | LPoolE := Bitmaps.Add() as TGorillaBitmapPoolEntry; | ||
- | LPoolE.Bitmap.LoadFromFile(' | ||
- | |||
- | LPoolE := Bitmaps.Add() as TGorillaBitmapPoolEntry; | ||
- | LPoolE.Bitmap.LoadFromFile(' | ||
- | end; | ||
- | |||
- | // creating the billboard control | ||
- | FGrass := TGorillaBillboard.Create(FGorilla); | ||
- | FGrass .Parent := FGorilla; | ||
- | FGrass.SourceObject := LBillboard; | ||
- | FGrass.MaterialSource := LGrassMat; | ||
- | FGrass.SetSize(GORILLA_BILLBOARD_SIZE, | ||
- | |||
- | // create an individual filling algorithm to multiply the grass planes | ||
- | LAlg := TGorillaBillboardRectFilling.Create(fGrass); | ||
- | try | ||
- | FGrass.Fill(LAlg, | ||
- | finally | ||
- | FreeAndNil(LAlg); | ||
- | end; | ||
- | </ |