Fitting an AGI to a Gauge

From SIMboxWiki
Jump to navigation Jump to search

When you create an AGI display, you sometimes need to fit the AGI to a dimension of a specific physical gauge, not letting it run off or leak outside the area of the gauge.

There are generally 3 ways to do this:

  1. Create a model where the physical gauge is submerged. This can be a good solution, however it has one disadvantage: if the AGI is big enough and there are other submerged gauges close to it, the AGI will "leak" on to the other gauges and hence be visible where it should not be.
  2. Use a bitmap mask. The graphic engine allows you to assign 3 separate images to an AGI: regular, mask and dimmer. The mask image provides a way to mask areas of the regular image. This is similar to having a separate image just for the alpha (transparency) channel. Moreover, this mask image can be placed independently of the regular image. This is a very performance friendly option. However, it can only work on a single AGI at a time. See Understanding Bitmaps and Images.
  3. Use a clip region.  With a clip region, you define an area using some sort of geometric AGI (rectangle, polygon, etc…), and then define that AGI as a clip region (see CreateMaskRegion). Any AGI that will be attached as a descendant of that clip region will be rendered only in the area of that clip region. This option is best at handling complicated cases (cases not covered by options 1 and 2). However, it is the least performance friendly choice (though not by much), and it comes with some restrictions. There is a limit on the number of clip regions that can be viewed in a single camera (32). Also, clip regions cannot be combined together: if you define a clip region within a clip region, AGIs of the child clip region will not take into account the parent clip region area. Note: this is true with the exception of clip regions using the "project to infinity" feature, which can work in conjunction with a normal clip region.