internal void InjectBillboard( Billboard bb )
{
// Skip if not visible (NB always true if not bounds checking individual billboards)
if ( !this.IsBillboardVisible( this.currentCamera, bb ) )
{
return;
}
if ( !this.pointRendering &&
( this.billboardType == BillboardType.OrientedSelf ||
this.billboardType == BillboardType.PerpendicularSelf ||
( this.accurateFacing && this.billboardType != BillboardType.PerpendicularCommon ) ) )
{
// Have to generate axes & offsets per billboard
this.GenerateBillboardAxes( ref this.camX, ref this.camY, bb );
}
// If they're all the same size or we're point rendering
if ( this.allDefaultSize || this.pointRendering )
{
/* No per-billboard checking, just blast through.
Saves us an if clause every billboard which may
make a difference.
*/
if ( !this.pointRendering &&
( this.billboardType == BillboardType.OrientedSelf ||
this.billboardType == BillboardType.PerpendicularSelf ||
( this.accurateFacing && this.billboardType != BillboardType.PerpendicularCommon ) ) )
{
this.GenerateVertexOffsets( this.leftOff,
this.rightOff,
this.topOff,
this.bottomOff,
this.defaultParticleWidth,
this.defaultParticleHeight,
ref this.camX,
ref this.camY,
this.vOffset );
}
this.GenerateVertices( this.vOffset, bb );
}
else // not all default size and not point rendering
{
Vector3[] vOwnOffset = new Vector3[ 4 ];
// If it has own dimensions, or self-oriented, gen offsets
if ( this.billboardType == BillboardType.OrientedSelf ||
this.billboardType == BillboardType.PerpendicularSelf ||
bb.HasOwnDimensions ||
( this.accurateFacing && this.billboardType != BillboardType.PerpendicularCommon ) )
{
// Generate using own dimensions
this.GenerateVertexOffsets( this.leftOff,
this.rightOff,
this.topOff,
this.bottomOff,
bb.Width,
bb.Height,
ref this.camX,
ref this.camY,
vOwnOffset );
// Create vertex data
this.GenerateVertices( vOwnOffset, bb );
}
else // Use default dimension, already computed before the loop, for faster creation
{
this.GenerateVertices( this.vOffset, bb );
}
}
// Increment visibles
this.numVisibleBillboards++;
}