In some cases you might want to combine multiple materials and use them together as one single material. For example, during development it can be pretty useful to combine a wireframe material with another material type. This can be achieved with the CompositeMaterial
class.
Usage of this material type differs from what we've seen before with other material types, as it doesn't take any parameters on instantiation. Instead, you add materials to the CompositeMaterial
class, similar to adding materials to a materials list, which we did in the previous chapter. Having a look at how this works makes it clearer:
import flash.events.Event; import org.papervision3d.materials.BitmapFileMaterial; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.materials.special.CompositeMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView;
In the init()
method we create two materials, which will be combined by the...