Flash中的交互式3D模型将数据导出到php

时间:2012-02-27 01:52:22

标签: php flash 3d unity3d

像Papervision这样的flash 3D显示引擎是否允许将数据从swf导出到php后端,反之亦然(PHP进入模型)? Unity是否允许这样做?

如果我要在像Papervision这样的3D软件包中使用UI构建一个简单的“更改模型颜色”应用程序,那么我可以将用户选择导出到php或者是javascript中介吗?

感谢您的帮助 MitchK

2 个答案:

答案 0 :(得分:2)

由您来定义用户可以导出的信息,就像在html中编写公式,Flash可以向服务器发送GET / POST请求一样,您可以将您想要的任何数据发送回服务器。

答案 1 :(得分:0)

你应该能够。以下是关于如何将网格从Papervision导出为Collada格式的一个简单的旧示例:

package {
    import flash.net.FileReference;
    import flash.display.*;
    import flash.events.MouseEvent;
    import flash.utils.ByteArray;
    import org.papervision3d.core.io.exporters.ExportCollada;
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.view.BasicView;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.primitives.PaperPlane;
    import org.papervision3d.objects.special.UCS;

    public class PV3DExportTest extends BasicView {
        private var mesh:DisplayObject3D;
        public function PV3DExportTest()  {
            super(640,480,false,false,"Debug");
            scene.addChild(new UCS(1000));
            var light:PointLight3D = scene.addChild(new PointLight3D()) as PointLight3D; light.x = light.y = light.z = 100;
            mesh = scene.addChild(new PaperPlane(new FlatShadeMaterial(light,0xFFFF00,0xFF6600),3));mesh.rotationY = 160;mesh.rotationX = 30;
            startRendering();
            stage.doubleClickEnabled = true;
            stage.addEventListener(MouseEvent.DOUBLE_CLICK,save);
        }
        private function save(event:MouseEvent):void{
            var data:ByteArray = new ByteArray();
            data.writeUTFBytes(ExportCollada.export(mesh));
            new FileReference().save(data,'mesh.dae');
        }
    }
}

你可以看到它正在运行here

您需要检查您要使用的库是否已经导出为可以保留所需数据的3D文件格式(颜色/材料/等),如果没有实现自己的数据。一旦完成,数据传输应该是微不足道的。有几个选项,所以由您的设置决定哪种方法最适合您。

相关问题