Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
0.8.3:models [2022/04/25 11:14] – [Supported file formats] admin0.8.3:models [2022/04/25 11:25] – [Instanced Rendering] admin
Line 316: Line 316:
  
 ===== Instancing / Model duplication ===== ===== Instancing / Model duplication =====
 +
 +==== Instanced Rendering ====
 +
 +Since 0.8.3.2265 instanced rendering of the same mesh for x-times was implemented.
 +
 +Use this method to render for example grass or trees. It is not recommended to use it for animated charaters,
 +because they would be rendered the same (with the same animation frame).
 +
 +You can simply setup instanced rendering in your TGorillaModel or TGorillaMesh object.
 +
 +<file pascal>
 +/// we create 4 instances in a row
 +GorillaModel1.AddInstance(TMatrix3D.CreateTranslation(Point3D(-10, 0, 0)));
 +GorillaModel1.AddInstance(TMatrix3D.CreateTranslation(Point3D(-5, 0, 0)));
 +GorillaModel1.AddInstance(TMatrix3D.CreateTranslation(Point3D(5, 0, 0)));
 +GorillaModel1.AddInstance(TMatrix3D.CreateTranslation(Point3D(10, 0, 0)));
 +
 +/// afterwards we can modify a specific instance
 +var LTransf : TMatrix3D;
 +LTransf := TMatrix3D.CreateScaling(Point3D(2, 2, 2));
 +LTransf := LTransf * TMatrix3D.CreateRotationY(DegToRad(90));
 +LTransf := LTransf * TMatrix3D.CreateScaling(Point3D(2, 2, 2));
 +
 +GorillaModel1.Instances[2] := LTransf;
 +</file>
 +
 +
 +==== Instancing by TModelDef ====
  
 Since 0.8.3.1966+ we've refactored the way to instanciate models. The previous method was incomplete in handling animated models. Since 0.8.3.1966+ we've refactored the way to instanciate models. The previous method was incomplete in handling animated models.