forked from: flash on 2013-2-4
♥0 |
Line 31 |
Modified 2013-02-05 09:27:57 |
MIT License
archived:2017-03-30 07:11:32
ActionScript3 source code
/**
* Copyright s8t1h12akj ( http://wonderfl.net/user/s8t1h12akj )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7EFF
*/
// forked from beergeekryo's flash on 2013-2-4
package {
import alternativa.engine3d.core.Object3D;
import alternativa.engine3d.lights.AmbientLight;
import alternativa.engine3d.lights.OmniLight;
import alternativa.engine3d.materials.VertexLightTextureMaterial;
import alternativa.engine3d.primitives.Box;
import alternativa.engine3d.resources.BitmapTextureResource;
// テクスチャ作成
var bmd:BitmapData = new BitmapData(32, 32, true, 0xFFFFFFFF);
var texture:BitmapTextureResource = new BitmapTextureResource(bmd);
var material:VertexLightTextureMaterial = new VertexLightTextureMaterial(texture);
// Boxをランダムに配置
for (var i:int = 0; i < 200; i++) {
var box:Box = new Box(300, 200, 200, 3, 3, 3);
box.setMaterialToAllSurfaces(material);
box.x = 3000 * (Math.random() - 0.5);
box.y = 3000 * (Math.random() - 0.5);
box.z = 3000 * (Math.random() - 0.5);
box.scaleX = box.scaleY = box.scaleZ = .8 * Math.random() + .2;
box.rotationX = 360 * Math.random();
box.rotationY = 360 * Math.random();
box.rotationZ = 360 * Math.random();
wrap.addChild(box);
}
}
override protected function atPreRender():void {
// なんとくなく回転させる
wrap.rotationZ -= .005;
// スポットカメラはカメラに追随させる
omniLight.x = camera.x;
omniLight.y = camera.y;
omniLight.z = camera.z;
}
}
}