我在 as3 中玩 Papervision3D。我目前被 BitmapEffectLayer 困住了。当我想为对象添加效果时,具有效果的对象将始终呈现在所有内容的前面。这意味着,即使它在 cordinat 系统中的另一个对象后面,它也会被拉到它前面。这是一些源代码,不知道它是否有帮助。
spherer = new Sphere(shadedMaterial, 120, 20, 14);
//spherer.x = 0;
//spherer.y = 0;
//spherer.z = 0;
displayEarth = new DisplayObject3D();
displayEarth.x =0;
displayEarth.y = 0;
displayEarth.z = 0;
displayEarth.addChild(spherer);
smallSphere = new Sphere(flatMaterial, 10, 10, 10);
smallSphere.x = 0;
smallSphere.z = 130;
smallSphere.y = 00;
displayEarth.addChild(smallSphere);
//scene.addChild(smallSphere);
scene.addChild(light);
var partMaterial:ParticleMaterial = new ParticleMaterial(0x000000, 1.0, ParticleMaterial.SHAPE_CIRCLE);
var part:Particle = new Particle(partMaterial, 3, 0, -150, 30);
var part2:Particle = new Particle(partMaterial, 3, 0,0,135);
var partsHolder:Particles = new Particles();
partsHolder.addParticle(part);
parrr.push(part);
partsHolder.addParticle(part2);
parrr.push(part2);
var effectLayer:BitmapEffectLayer = new BitmapEffectLayer(viewport, stage.stageWidth, stage.stageHeight, true, 0x000000, BitmapClearMode.CLEAR_PRE);
effectLayer.drawLayer.blendMode = BlendMode.OVERLAY;
effectLayer.addDisplayObject3D(smallSphere);
viewport.containerSprite.addLayer(effectLayer);
displayEarth.addChild(partsHolder);
scene.addChild(displayEarth);
effectLayer.addEffect(new BitmapLayerEffect(new BlurFilter(2,2,2)));
现在,附加到 effectLayer 的“smallSphere”将始终呈现在“sphere”的前面。任何帮助表示赞赏!- 大卫