Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi Richard,
- I'm a little bit lost with the pull request, as I don't have Away3D GIT repo cloned here. The occlusion part is rather simple.
- This is a ColorMaterial, der hides itself and all objects behind it by calling context.setColorMask(false, false, false, false);
- The only thing, that the DefaultRenderer is missing in drawRenderables is a
- _activeMaterial.cleanUp(_context); call (so the material itself could do the context.setColorMask(true, true, true, true);
- Or the DefaultMaterialBase.updateMaterial() itself includes context.setColorMask(true, true, true, true);
- I'm not sure, what fits your engine best as this is the first time I'm looking at its code today.
- Anyway. Hope to see it implemented somehow
- package away3d.materials {
- import away3d.arcane;
- import flash.display3D.Context3D;
- use namespace arcane;
- /**
- * OcclusionMaterial is a ColorMaterial for an object, that hides all other objects behind itself.
- */
- public class OcclusionMaterial extends ColorMaterial
- {
- private var _occlude : Boolean = true;
- /**
- * Creates a new OcclusionMaterial object.
- * @param occlude Whether or not to occlude other objects.
- * @param color The material's diffuse surface color.
- * @param alpha The material's surface alpha.
- */
- public function OcclusionMaterial(occlude : Boolean = true, color : uint = 0xcccccc, alpha : Number = 1)
- {
- super(color, alpha);
- this.occlude = occlude;
- }
- /**
- * Whether or not an object with this material applied hides other objects.
- */
- public function get occlude() : Boolean
- {
- return _occlude;
- }
- public function set occlude(value : Boolean) : void
- {
- _occlude = value;
- }
- /**
- * @inheritDoc
- */
- arcane override function updateMaterial(context : Context3D) : void
- {
- super.updateMaterial(context);
- if(occlude) {
- context.setColorMask(false, false, false, false);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment