forked from: [PV3D] Simple Sphere
必要なライブラリをインポートします
/**
* Copyright oreore ( http://wonderfl.net/user/oreore )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pZjs
*/
// forked from clockmaker's [PV3D] Simple Sphere
package
{
import flash.events.Event;
// 必要なライブラリをインポートします
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.special.CompositeMaterial;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
import org.papervision3d.materials.WireframeMaterial;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.view.BasicView;
import org.papervision3d.core.effects.view.ReflectionView;
public class Main extends ReflectionView
{
private var ball:Sphere;
public function Main()
{
init();
}
private function init():void
{
//カメラ位置////////////////////////////////////////////////
camera.y = 200;
//床の作成//////////////////////////////////////////////////
var wm:WireframeMaterial = new WireframeMaterial();
var col:ColorMaterial = new ColorMaterial(0xffffff, 0.5);
var co:CompositeMaterial = new CompositeMaterial();
co.addMaterial(wm);
co.addMaterial(col);
var floor:Plane = new Plane(co, 1000, 1000, 6, 6);
floor.pitch( -90);
//床を3Dシーンに表示/////////////////////////////////////////
scene.addChild(floor);
// 球面を作成///////////////////////////////////////////////
var material: CompositeMaterial = new CompositeMaterial();
material.addMaterial(new WireframeMaterial(0xff6633));
material.addMaterial(new ColorMaterial(0xdcdcdc));
ball = new Sphere(material, 100, 8, 8);
ball.y = 100;
// 球面を3Dシーンに表示//////////////////////////////////////
scene.addChild(ball);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void
{
ball.rotationY += 1;
singleRender();
}
}
}