papervision3D basic
♥0 |
Line 32 |
Modified 2009-12-09 05:05:37 |
MIT License
archived:2017-03-20 12:42:57
ActionScript3 source code
/**
* Copyright agenda23 ( http://wonderfl.net/user/agenda23 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8p7l
*/
package {
import flash.events.*;
import flash.display.Sprite;
import org.papervision3d.core.proto.LightObject3D;
import org.papervision3d.materials.*;
import org.papervision3d.materials.shadematerials.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.view.BasicView;
import net.hires.debug.Stats;
[SWF(frameRate = 60,backgroundColor = 0x000000) ]
public class Main extends BasicView {
private var sphere_obj:Sphere;
public function Main():void
{
var light:LightObject3D = new PointLight3D;
startRendering();
var mat:FlatShadeMaterial = new FlatShadeMaterial(light);
sphere_obj = new Sphere(mat,300,12,12);
scene.addChild(sphere_obj);
addChild(new Stats( { bg: 0x1A1A1A } ));
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
sphere_obj.rotationY = stage.mouseX;
sphere_obj.rotationX = stage.mouseY;
sphere_obj.rotationZ += 1;
renderer.renderScene(scene, camera, viewport);
}
}
}