チェンジセット 233

差分発生行の前後
無視リスト:
コミット日時:
2008/02/07 01:28:50 (4 年前)
コミッタ:
rch850
ログメッセージ:

Supported parent-children relationship of .mqo file.
Rewrote license notices (MIT).
Interactivity (in progress).

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Metasequoia/src/org/libspark/pv3d/Metasequoia.as

    r218 r233  
    1 /* 
    2  * Copyright 2007-2008 (c) rch850 
    3  * 
    4  * Permission is hereby granted, free of charge, to any person 
    5  * obtaining a copy of this software and associated documentation 
    6  * files (the "Software"), to deal in the Software without 
    7  * restriction, including without limitation the rights to use, 
    8  * copy, modify, merge, publish, distribute, sublicense, and/or sell 
    9  * copies of the Software, and to permit persons to whom the 
    10  * Software is furnished to do so, subject to the following 
    11  * conditions: 
    12  * 
    13  * The above copyright notice and this permission notice shall be 
    14  * included in all copies or substantial portions of the Software. 
    15  * 
    16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
    18  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
    19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
    20  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
    21  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
    22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
    23  * OTHER DEALINGS IN THE SOFTWARE. 
     1/** 
     2 * Metasequoia.as 
     3 *  
     4 * @see http://snippets.libspark.org/ 
     5 * @see http://snippets.libspark.org/trac/wiki/rch850/Metasequoia 
     6 *  
     7 * Copyright (c) 2007-2008 rch850 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
    2426 */ 
    2527 
     
    3840        import org.papervision3d.core.math.Matrix3D; 
    3941        import org.papervision3d.core.math.NumberUV; 
     42        import org.papervision3d.core.proto.DisplayObjectContainer3D; 
    4043        import org.papervision3d.core.proto.GeometryObject3D; 
    4144        import org.papervision3d.core.proto.MaterialObject3D; 
    4245        import org.papervision3d.events.FileLoadEvent; 
     46        import org.papervision3d.events.InteractiveScene3DEvent; 
    4347        import org.papervision3d.materials.BitmapFileMaterial; 
    4448        import org.papervision3d.materials.BitmapMaterial; 
     
    8387                public var doubleSided:Boolean = false; 
    8488                 
     89                /** 
     90                 * インタラクティビティを設定します。 
     91                 */ 
     92                public var interactive:Boolean = false; 
     93                 
    8594                private var _loader:URLLoader; 
    8695                private var _filename:String; 
     
    8897                private var _materialNames:Array; 
    8998                private var _scale:Number = 1; 
     99                private var _prevMesh:DisplayObject3D; 
     100                private var _prevDepth:int; 
    90101                 
    91102                private function loadMetasequoia():void { 
     
    116127                        // Material チャンクを読み込む 
    117128                        l = parseMaterialChunk(lines, 0); 
     129                         
     130                        _prevDepth = 0; 
     131                        _prevMesh = this; 
    118132                         
    119133                        // Object チャンクを読み込めなくなるまで読み込む 
     
    209223                                 
    210224                                material.doubleSided = this.doubleSided; 
     225                                material.interactive = this.interactive; 
    211226                                material.name = name; 
    212227                                 
     
    268283                */ 
    269284                private function parseObjectChunk(lines:Array, startLine:int):int { 
    270                         var vertices:Array = geometry.vertices; 
    271                         var faces:Array = geometry.faces; 
    272                          
    273285                        var l:int = getObjectChunkLine(lines, startLine); 
    274286                        if (l == -1) { 
     
    282294                        var objectName:String = line.substring(8, line.indexOf("\"", 8)); 
    283295                        ++l; 
     296                         
     297                        var mesh:TriangleMesh3D = new TriangleMesh3D(null, new Array(), new Array(), objectName); 
     298                        var vertices:Array = mesh.geometry.vertices; 
     299                        var faces:Array = mesh.geometry.faces; 
    284300                         
    285301                        // vertex チャンクを検索 
     
    332348                                } 
    333349                        } 
     350                         
     351                        // Resolve parent-child relationship. 
     352                        var depth:int; 
     353                        try { 
     354                                depth = parseInt(properties["depth"]); 
     355                        } catch (e:Error) { 
     356                                depth = 0; 
     357                        } 
     358                        var parentMesh:DisplayObjectContainer3D = _prevMesh; 
     359                        if (depth <= 0) { 
     360                                parentMesh = this; 
     361                                depth = 0; 
     362                        } else { 
     363                                while (depth <= _prevDepth) { 
     364                                        parentMesh = DisplayObject3D(parentMesh).parent; 
     365                                        --_prevDepth; 
     366                                } 
     367                        } 
     368                        parentMesh.addChild(mesh); 
     369                        _prevMesh = mesh; 
     370                        _prevDepth = depth; 
    334371                         
    335372                        return l; 
  • as3/Metasequoia/src/org/libspark/pv3d/decoders/TGADecoder.as

    r218 r233  
    11/** 
    2  * ### WARNING ### 
    3  * This file may be relocated to another package without any notice. 
    4  * このファイルは予告無しに他のパッケージに移動する可能性があります。 
     2 * TGADecoder.as 
     3 *  
     4 * @see http://snippets.libspark.org/ 
     5 * @see http://snippets.libspark.org/trac/wiki/rch850/Metasequoia 
    56 * 
    6  * @link         http://snippets.libspark.org/ 
    7  *  
    8  * The MIT License 
    97 * Copyright (c) 2008 rch850 
    108 *