• away3d 4.1 加载总结


    这里就总结一下away3d中加载模型及获取模型信息。

    AssetLoader
    基础加载类,和flash中的URLLoader类似

    Loader3D
    可用于直接显示的模型加载类,和Flash中的Loader类似

    AssetLibrary
    单态模式加载类

    AssetLibraryBundle
    多态模式加载类(由AssetLibrary调用,不推荐直接使用)

      loader3D

    var garageLoader:Loader3D = new Loader3D();
    garageLoader.addEventListener(AssetEvent.ASSET_COMPLETE, this.complete);
    garageLoader.loadData(new this.GarageAsset(), null, null);
    private function complete(event:AssetEvent):void
    
    {
    if (event.asset.assetType == AssetType.MESH)
    {
    garageMesh = event.asset as Mesh;
    var mt:TextureMaterial=new TextureMaterial(new BitmapTexture(new this.GarageMapAsset().bitmapData), true)
    mt.addMethod(this.bodyReflection)
    garageMesh.material=mt
    garageMesh.material.lightPicker=this.lightPicker
    viewport.scene.addChild(this.garageMesh);
    }
    
    }

    AssetLoader

    AssetLibrary

     AssetLibrary.enableParser(AWDParser);  
     AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);  
     AssetLibrary.load(new URLRequest("assets/PolarBear.awd"));  
     private function onAssetComplete(event:AssetEvent):void  
    
    {  
    
                if (event.asset.assetType == AssetType.SKELETON) {  
    
                    //create an animation object  
    
            animation = new SkeletonAnimation(event.asset as Skeleton, 3, true);  
    
                } 
    
    }

    在这几个加载中,涉及到的不仅仅是三种加载的写法和用法。更多的是max和away3d的工作流中对贴图的加载,我举个例子。

    下图是wow中的模型。我提取出模型和贴图加载进来的过程中,遇到过各种流错误(贴图错误)。我觉得解决这方面的总结才更加有意思。

    在我制作过程中,遇到了很多和贴图相关的错误这里一并做整理并把各种格式总结一次。

    更加清楚每个格式对贴图的支持。我会结合max中导出选项中  是否勾选保存贴图到格式里面来说明

    3DS格式:

    OBJ格式:

    awd格式:

    MD2格式:

    MD5格式:

     整理中

  • 相关阅读:
    最长双回文串
    BUUOJ misc 二维码
    HDU 1284 钱币兑换问题 (动态规划 背包方案数)
    HDU 1260 Tickets (动态规划)
    HDU 1231 最大连续子序列 (动态规划)
    HDU 1203 I NEED A OFFER! (动态规划、01背包、概率)
    BUUOJ reverse SimpleRev (爆破)
    BUUOJ reverse 不一样的flag
    HDU 1176 免费馅饼 (动态规划、另类数塔)
    HDU 1171 Big Event in HDU (动态规划、01背包)
  • 原文地址:https://www.cnblogs.com/bulolo/p/2821817.html
Copyright © 2020-2023  润新知