In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

sandy environment mapping test

sandy env mapping test
this is worst case - transparent bitmap fill over another bitmap fill
Get Adobe Flash player
by makc3d 13 Apr 2009
    Embed
// sandy env mapping test
// this is worst case - transparent bitmap fill over another bitmap fill
package {
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import sandy.core.Scene3D;
    import sandy.core.scenegraph.*;
    import sandy.primitive.*;
    import sandy.materials.*;
    import sandy.materials.attributes.*;

    public class EnvMapTest extends Sprite {
        private var u:Number = 0, v:Number = 0;
        private var scene:Scene3D, sphere:Sphere;

        public function EnvMapTest() {
            scene = new Scene3D ("test", this,
                new Camera3D (465, 465), new Group);

            var bmpA:BitmapData = new BitmapData (100, 100);
            bmpA.perlinNoise (10, 10, 3, 1, false, true, 3, false);
            bmpA.copyChannel (bmpA, bmpA.rect, bmpA.rect.topLeft, 1, 8);
            var matA:BitmapMaterial = new BitmapMaterial (bmpA);
            matA.smooth = true;
            var attr:CylinderEnvMap = new CylinderEnvMap (matA);

            var bmpB:BitmapData = new BitmapData (100, 100);
            bmpB.perlinNoise (10, 10, 3, 1, false, true, 6, false);
            var matB:BitmapMaterial = new BitmapMaterial (bmpB, new MaterialAttributes (attr));

            sphere = new Sphere;
            sphere.appearance = new Appearance (matB);
            scene.root.addChild (sphere);

            addEventListener ("enterFrame", function ():void {
                u += 1e-3 * (465 / 2 - mouseX); u *= 0.9;
                v += 1e-3 * (465 / 2 - mouseY); v *= 0.9;
                sphere.pan += u; sphere.rotateX += v;
                scene.render ();
            });
        }
    }
}