空間配置step1
/**
* Copyright Nyarineko ( http://wonderfl.net/user/Nyarineko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/lm7E
*/
package
{
import flash.events.*;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.BasicView;
[SWF(width = "465", height = "465", backgroundColor = "0x121212")]
public class Main extends BasicView
{
static public const OBJ_MAX:int = 60;
static public const OBJ_CUT:int = 6;
public var list:Vector.<DisplayObject3D>;
public function Main():void
{
stage.frameRate = 60;
camera.z = -500;
var light:PointLight3D = new PointLight3D();
var material:FlatShadeMaterial = new FlatShadeMaterial(light, 0xFFFFFF, 0x000000);
material.doubleSided = true;
list = new Vector.<DisplayObject3D>(OBJ_MAX, true);
for (var i:int = 0; i < OBJ_MAX; i++)
{
var plane:Plane = new Plane(material, 50, 50, 1, 1);
for each(var obj:* in plane.geometry.vertices){
obj.z-=200;
}
plane.rotationX = 57 - i % OBJ_CUT * (140 / OBJ_CUT);
plane.rotationY = (360 / (OBJ_MAX / OBJ_CUT)) * Math.floor(i / OBJ_CUT);
list[i] = scene.addChild(plane);
}
startRendering();
}
override protected function onRenderTick(event:Event=null):void
{
for (var i:int = 0; i < OBJ_MAX; i++)
{
list[i].rotationY +=1;
}
renderer.renderScene(scene, camera, viewport);
}
}
}