チェンジセット 233
- コミット日時:
- 2008/02/07 01:28:50 (4 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
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. 24 26 */ 25 27 … … 38 40 import org.papervision3d.core.math.Matrix3D; 39 41 import org.papervision3d.core.math.NumberUV; 42 import org.papervision3d.core.proto.DisplayObjectContainer3D; 40 43 import org.papervision3d.core.proto.GeometryObject3D; 41 44 import org.papervision3d.core.proto.MaterialObject3D; 42 45 import org.papervision3d.events.FileLoadEvent; 46 import org.papervision3d.events.InteractiveScene3DEvent; 43 47 import org.papervision3d.materials.BitmapFileMaterial; 44 48 import org.papervision3d.materials.BitmapMaterial; … … 83 87 public var doubleSided:Boolean = false; 84 88 89 /** 90 * インタラクティビティを設定します。 91 */ 92 public var interactive:Boolean = false; 93 85 94 private var _loader:URLLoader; 86 95 private var _filename:String; … … 88 97 private var _materialNames:Array; 89 98 private var _scale:Number = 1; 99 private var _prevMesh:DisplayObject3D; 100 private var _prevDepth:int; 90 101 91 102 private function loadMetasequoia():void { … … 116 127 // Material チャンクを読み込む 117 128 l = parseMaterialChunk(lines, 0); 129 130 _prevDepth = 0; 131 _prevMesh = this; 118 132 119 133 // Object チャンクを読み込めなくなるまで読み込む … … 209 223 210 224 material.doubleSided = this.doubleSided; 225 material.interactive = this.interactive; 211 226 material.name = name; 212 227 … … 268 283 */ 269 284 private function parseObjectChunk(lines:Array, startLine:int):int { 270 var vertices:Array = geometry.vertices;271 var faces:Array = geometry.faces;272 273 285 var l:int = getObjectChunkLine(lines, startLine); 274 286 if (l == -1) { … … 282 294 var objectName:String = line.substring(8, line.indexOf("\"", 8)); 283 295 ++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; 284 300 285 301 // vertex チャンクを検索 … … 332 348 } 333 349 } 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; 334 371 335 372 return l; as3/Metasequoia/src/org/libspark/pv3d/decoders/TGADecoder.as
r218 r233 1 1 /** 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 5 6 * 6 * @link http://snippets.libspark.org/7 *8 * The MIT License9 7 * Copyright (c) 2008 rch850 10 8 *

