※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


FAVORITE BY
:
PV3D?
:
おぉ、PV3D使えるようになったんだ。
FORKED
  1. // forked from yd_niku's Papervision3D TEST
  2. // Papervision3D Test
  3. // code from http://papervision3d.googlecode.com/svn/trunk/as3/trunk/examples/FlexSDK/MeshCutting/src/com/unitzeroone/pv3d/examples/MeshCuttingExample.as
  4. package
  5. {
  6.     import flash.display.BitmapData;
  7.     import flash.events.Event;
  8.     
  9.     import org.papervision3d.core.geom.TriangleMesh3D;
  10.     import org.papervision3d.core.math.Number3D;
  11.     import org.papervision3d.core.math.Plane3D;
  12.     import org.papervision3d.core.utils.MeshUtil;
  13.     import org.papervision3d.materials.BitmapColorMaterial;
  14.     import org.papervision3d.materials.BitmapMaterial;
  15.     import org.papervision3d.objects.primitives.Plane;
  16.     import org.papervision3d.objects.primitives.Sphere;
  17.     import org.papervision3d.view.BasicView;
  18.     public class MeshCuttingExample extends BasicView
  19.     {
  20.         protected var planeMaterial:BitmapColorMaterial;
  21.         protected var sphereMaterial:BitmapMaterial;
  22.         
  23.         protected var sourceSphere:Sphere;
  24.         protected var hemiSphereA:TriangleMesh3D;
  25.         protected var hemiSphereB:TriangleMesh3D;
  26.     
  27.         
  28.         public function MeshCuttingExample()
  29.         {
  30.             super(00truefalse);
  31.             opaqueBackground = 0;
  32.             setupScene();
  33.         }
  34.         
  35.         protected function setupScene():void
  36.         {
  37.             //Setup a bitmapdata material for the spheres to use.
  38.             var bmp:BitmapData = new BitmapData(512,255,false,0);
  39.             bmp.perlinNoise(64,64,4,123456,true,false);
  40.             
  41.             //Create a new sphere, which we will use as a source geometry, cutting it.
  42.             sphereMaterial = new BitmapMaterial(bmp);
  43.             sphereMaterial.doubleSided = true;
  44.             sourceSphere = new Sphere(sphereMaterial, 40015,15);
  45.             
  46.             //Setup a plane3d along which we will cut the sphere.
  47.             var normal:Number3D = new Number3D(.5,.5,0); //Some angle
  48.             var point:Number3D = new Number3D(0,80,0); //at position...
  49.             var cutPlane:Plane3D = Plane3D.fromNormalAndPoint(normal, point);
  50.             
  51.             //Cut the sphere along the plane3D, returns an array of maximum 2 meshes.
  52.             var meshes:Array = MeshUtil.cutTriangleMesh(sourceSphere, cutPlane);
  53.             
  54.             //Add result meshA
  55.             hemiSphereA = meshes[0];
  56.             hemiSphereA.x = 400;
  57.             scene.addChild(hemiSphereA);
  58.             
  59.             //Add result meshB
  60.             hemiSphereB = meshes[1];
  61.             hemiSphereB.x = -400;
  62.             scene.addChild(hemiSphereB);
  63.             
  64.             //Start rendering
  65.             startRendering();
  66.         }
  67.         
  68.         override protected function onRenderTick(event:Event=null):void
  69.         {
  70.             //Rotate the spheres.
  71.             hemiSphereA.yaw(1);
  72.             hemiSphereB.yaw(-1);
  73.             super.onRenderTick(event);
  74.         }
  75.         
  76.     }
  77. }
noswf
  1. // forked from yd_niku's Papervision3D TEST
  2. // Papervision3D Test
  3. // code from http://papervision3d.googlecode.com/svn/trunk/as3/trunk/examples/FlexSDK/MeshCutting/src/com/unitzeroone/pv3d/examples/MeshCuttingExample.as
  4. package
  5. {
  6.     import flash.display.BitmapData;
  7.     import flash.events.Event;
  8.     
  9.     import org.papervision3d.core.geom.TriangleMesh3D;
  10.     import org.papervision3d.core.math.Number3D;
  11.     import org.papervision3d.core.math.Plane3D;
  12.     import org.papervision3d.core.utils.MeshUtil;
  13.     import org.papervision3d.materials.BitmapColorMaterial;
  14.     import org.papervision3d.materials.BitmapMaterial;
  15.     import org.papervision3d.objects.primitives.Plane;
  16.     import org.papervision3d.objects.primitives.Sphere;
  17.     import org.papervision3d.view.BasicView;
  18.     public class MeshCuttingExample extends BasicView
  19.     {
  20.         protected var planeMaterial:BitmapColorMaterial;
  21.         protected var sphereMaterial:BitmapMaterial;
  22.         
  23.         protected var sourceSphere:Sphere;
  24.         protected var hemiSphereA:TriangleMesh3D;
  25.         protected var hemiSphereB:TriangleMesh3D;
  26.     
  27.         
  28.         public function MeshCuttingExample()
  29.         {
  30.             super(01truefalse);
  31.             opaqueBackground = 0;
  32.             setupScene();
  33.         }
  34.         
  35.         protected function setupScene():void
  36.         {
  37.             //Setup a bitmapdata material for the spheres to use.
  38.             var bmp:BitmapData = new BitmapData(512,255,false,0);
  39.             bmp.perlinNoise(64,64,4,123456,true,false);
  40.             
  41.             //Create a new sphere, which we will use as a source geometry, cutting it.
  42.             sphereMaterial = new BitmapMaterial(bmp);
  43.             sphereMaterial.doubleSided = true;
  44.             sourceSphere = new Sphere(sphereMaterial, 40015,15);
  45.             
  46.             //Setup a plane3d along which we will cut the sphere.
  47.             var normal:Number3D = new Number3D(.5,.5,0); //Some angle
  48.             var point:Number3D = new Number3D(0,80,0); //at position...
  49.             var cutPlane:Plane3D = Plane3D.fromNormalAndPoint(normal, point);
  50.             
  51.             //Cut the sphere along the plane3D, returns an array of maximum 2 meshes.
  52.             var meshes:Array = MeshUtil.cutTriangleMesh(sourceSphere, cutPlane);
  53.             
  54.             //Add result meshA
  55.             hemiSphereA = meshes[0];
  56.             hemiSphereA.x = 1000;
  57.             scene.addChild(hemiSphereA);
  58.             
  59.             //Add result meshB
  60.             hemiSphereB = meshes[1];
  61.             hemiSphereB.x = -400;
  62.             scene.addChild(hemiSphereB);
  63.             
  64.             //Start rendering
  65.             startRendering();
  66.         }
  67.         
  68.         override protected function onRenderTick(event:Event=null):void
  69.         {
  70.             //Rotate the spheres.
  71.             hemiSphereA.yaw(1);
  72.             hemiSphereB.yaw(-1);
  73.             super.onRenderTick(event);
  74.         }
  75.         
  76.     }
  77. }
noswf
Get Adobe Flash Player