チェンジセット 734
- コミット日時:
- 2008/06/30 20:29:38 (2 ヶ月前)
- ファイル:
-
- as3/Frocessing/trunk/src/frocessing/bmp/FBitmapGraphics.as (追加)
- as3/Frocessing/trunk/src/frocessing/core/F5BitmapData.as (更新) (1 diff)
- as3/Frocessing/trunk/src/frocessing/core/F5BitmapData3D.as (更新) (1 diff)
- as3/Frocessing/trunk/src/frocessing/core/F5Graphics.as (更新) (20 diffs)
- as3/Frocessing/trunk/src/frocessing/core/F5Graphics2D.as (更新) (4 diffs)
- as3/Frocessing/trunk/src/frocessing/core/F5Graphics3D.as (更新) (49 diffs)
- as3/Frocessing/trunk/src/frocessing/core/GraphicsBase.as (更新) (1 diff)
- as3/Frocessing/trunk/src/frocessing/core/GraphicsEx.as (更新) (4 diffs)
- as3/Frocessing/trunk/src/frocessing/display/F5MovieClip.as (更新) (3 diffs)
- as3/Frocessing/trunk/src/frocessing/display/F5MovieClip3D.as (更新) (5 diffs)
- as3/Frocessing/trunk/src/frocessing/f3d/F3DCamera.as (追加)
- as3/Frocessing/trunk/src/frocessing/f3d/F3DRender.as (更新) (19 diffs)
- as3/Frocessing/trunk/src/frocessing/f3d/ShapeData.as (更新) (3 diffs)
- as3/Frocessing/trunk/src/frocessing/f3d/model (追加)
- as3/Frocessing/trunk/src/frocessing/f3d/model/F3DModel.as (追加)
- as3/Frocessing/trunk/src/frocessing/f3d/model/F3DSphere.as (追加)
- as3/Frocessing/trunk/src/frocessing/geom/FMatrix2D.as (更新) (12 diffs)
- as3/Frocessing/trunk/src/frocessing/geom/FMatrix3D.as (更新) (13 diffs)
- as3/Frocessing/trunk/src/frocessing/geom/FVec3D.as (追加)
- as3/Frocessing/trunk/src/frocessing/geom/Vector3D.as (削除)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/Frocessing/trunk/src/frocessing/core/F5BitmapData.as
r714 r734 74 74 public override function endDraw():void 75 75 { 76 _bitmapData.draw( _shape, null, null, null, screenRect, _ imageSmoothing);76 _bitmapData.draw( _shape, null, null, null, screenRect, _bmpGc.smooth ); 77 77 } 78 78 as3/Frocessing/trunk/src/frocessing/core/F5BitmapData3D.as
r714 r734 73 73 { 74 74 super.endDraw(); 75 _bitmapData.draw( _shape, null, null, null, screenRect, _ imageSmoothing);75 _bitmapData.draw( _shape, null, null, null, screenRect, _bmpGc.smooth ); 76 76 } 77 77 as3/Frocessing/trunk/src/frocessing/core/F5Graphics.as
r714 r734 34 34 import flash.display.BitmapData; 35 35 import flash.display.Graphics; 36 import flash.geom.Matrix;37 36 import frocessing.color.ColorMode; 38 37 import frocessing.color.FColorMode; … … 42 41 import frocessing.color.FColorUtil; 43 42 import frocessing.math.FMath; 43 import frocessing.geom.FMatrix2D; 44 44 45 45 /** … … 47 47 * 48 48 * @author nutsu 49 * @version 0.1. 249 * @version 0.1.3 50 50 */ 51 51 public class F5Graphics extends GraphicsEx{ … … 96 96 //Image 97 97 protected var image_mode:int; //@default CORNER 98 protected var image_matrix:Matrix;99 protected var _imageSmoothing:Boolean;100 98 101 99 //Vertex … … 107 105 protected var splineVertexCount:uint; 108 106 107 //Texture 108 protected var texture_mode:Boolean; 109 protected var vertexsU:Array; 110 protected var vertexsV:Array; 111 109 112 /** 110 113 * 新しい F5Graphics クラスのインスタンスを生成します. … … 137 140 138 141 image_mode = CORNER; 139 image_matrix = new Matrix();140 _imageSmoothing = true;142 143 texture_mode = false; 141 144 } 142 145 … … 164 167 * 描画を開始するときに実行します.このメソッドは、F5Graphics2D,F5Graphics3D など F5Graphicsの拡張クラスで意味を持ちます. 165 168 */ 166 public function beginDraw():void { ; } 169 public function beginDraw():void { 170 clear(); 171 } 167 172 168 173 /** … … 428 433 { 429 434 image_mode = mode; 430 }431 432 /**433 * 画像を描画する場合の Smoothing を設定します.434 */435 public function imageSmoothing( smooth:Boolean ):void436 {437 _imageSmoothing = smooth;438 435 } 439 436 … … 457 454 public function image( img:BitmapData, x:Number, y:Number, w:Number = NaN, h:Number = NaN ):void 458 455 { 459 image_matrix.identity();460 456 if ( isNaN(w) || isNaN(h) ) 461 457 { … … 467 463 y -= h * 0.5; 468 464 } 469 image_matrix.scale( 1, 1 );470 465 } 471 466 else … … 488 483 break; 489 484 } 490 image_matrix.scale( w/img.width, h/img.height ); 491 } 492 image_matrix.translate( x, y ); 493 494 _gc.lineStyle(); 495 beginBitmapFill( img, image_matrix, false, _imageSmoothing ); 496 drawQuad( x, y, x + w, y, x + w, y + h, x, y + h ); 497 endFill(); 498 applyLineStyle(); 485 } 486 //_gc.lineStyle(); 487 drawBitmap( img, x, y, w, h ); 488 //applyLineStyle(); 499 489 } 500 490 … … 734 724 splineVertexX = []; 735 725 splineVertexY = []; 726 vertexsU = []; 727 vertexsV = []; 736 728 737 729 vertexCount = 0; … … 740 732 if ( shape_mode_polygon = (mode == POLYGON) ) 741 733 applyFill(); 734 } 735 736 /** 737 * vertex() で 描画する テクスチャ(画像) を設定します. 738 * <p> 739 * texture が適用されるのは、 beginShape() メソッドで以下のモードを指定した場合になります.<br/> 740 * 「 TRIANGLES TRIANGLE_FAN TRIANGLE_STRIP QUADS QUAD_STRIP 」 741 * </p> 742 * 743 * <p> 744 * また、vertex() メソッドで、 u, v 値を指定する必要があります. 745 * </p> 746 */ 747 public function texture( textureData:BitmapData ):void 748 { 749 _bmpGc.beginBitmap( textureData ); 750 texture_mode = true; 742 751 } 743 752 … … 746 755 * @param x 747 756 * @param y 748 */ 749 public function vertex( x:Number, y:Number ):void 757 * @param u texture を指定している場合、u 値を画像の x 座標で指定できます 758 * @param v texture を指定している場合、v 値を画像の y 座標で指定できます 759 */ 760 public function vertex( x:Number, y:Number, u:Number=0, v:Number=0 ):void 750 761 { 751 762 vertexsX[vertexCount] = x; 752 763 vertexsY[vertexCount] = y; 764 vertexsU[vertexCount] = u; 765 vertexsV[vertexCount] = v; 753 766 vertexCount++; 754 767 … … 776 789 t1 = vertexCount - 2; 777 790 t2 = vertexCount - 3; 778 applyFill(); 779 super.moveTo( vertexsX[t2], vertexsY[t2] ); 780 super.lineTo( vertexsX[t1], vertexsY[t1] ); 781 super.lineTo( x, y ); 782 closePath(); 783 applyFillEnd(); 791 if ( texture_mode ) 792 { 793 super.moveTo( vertexsX[t2], vertexsY[t2] ); 794 _bmpGc.drawTriangle( _startX, _startY, vertexsX[t1], vertexsY[t1], x, y, 795 vertexsU[t2], vertexsV[t2], vertexsU[t1], vertexsV[t1], u, v ); 796 } 797 else 798 { 799 applyFill(); 800 super.moveTo( vertexsX[t2], vertexsY[t2] ); 801 $lineTo( vertexsX[t1], vertexsY[t1] ); 802 $lineTo( x, y ); 803 $closePath( _startX, _startY ); 804 applyFillEnd(); 805 } 784 806 } 785 807 break; … … 788 810 { 789 811 t1 = vertexCount - 2; 790 applyFill(); 791 super.moveTo( vertexsX[0], vertexsY[0] ); 792 super.lineTo( vertexsX[t1], vertexsY[t1] ); 793 super.lineTo( x, y ); 794 closePath(); 795 applyFillEnd(); 812 if ( texture_mode ) 813 { 814 super.moveTo( vertexsX[0], vertexsY[0] ); 815 _bmpGc.drawTriangle( _startX, _startY, vertexsX[t1], vertexsY[t1], x, y, 816 vertexsU[0], vertexsV[0], vertexsU[t1], vertexsV[t1], u, v ); 817 } 818 else 819 { 820 applyFill(); 821 super.moveTo( vertexsX[0], vertexsY[0] ); 822 $lineTo( vertexsX[t1], vertexsY[t1] ); 823 $lineTo( x, y ); 824 $closePath( _startX, _startY ); 825 applyFillEnd(); 826 } 796 827 } 797 828 break; … … 801 832 t1 = vertexCount - 2; 802 833 t2 = vertexCount - 3; 803 applyFill(); 804 super.moveTo( vertexsX[t2], vertexsY[t2] ); 805 super.lineTo( vertexsX[t1], vertexsY[t1] ); 806 super.lineTo( x, y ); 807 closePath(); 808 applyFillEnd(); 834 if ( texture_mode ) 835 { 836 super.moveTo( vertexsX[t2], vertexsY[t2] ); 837 _bmpGc.drawTriangle( _startX, _startY, x, y, vertexsX[t1], vertexsY[t1], 838 vertexsU[t2], vertexsV[t2], u, v, vertexsU[t1], vertexsV[t1] ); 839 } 840 else 841 { 842 applyFill(); 843 super.moveTo( vertexsX[t2], vertexsY[t2] ); 844 $lineTo( x, y ); 845 $lineTo( vertexsX[t1], vertexsY[t1] ); 846 $closePath( _startX, _startY ); 847 applyFillEnd(); 848 } 809 849 } 810 850 break; … … 815 855 t2 = vertexCount - 3; 816 856 t3 = vertexCount - 4; 817 applyFill(); 818 super.moveTo( vertexsX[t3], vertexsY[t3] ); 819 super.lineTo( vertexsX[t2], vertexsY[t2] ); 820 super.lineTo( vertexsX[t1], vertexsY[t1] ); 821 super.lineTo( x, y ); 822 closePath(); 823 applyFillEnd(); 857 if ( texture_mode ) 858 { 859 _gc.lineStyle(); 860 super.moveTo( vertexsX[t3], vertexsY[t3] ); 861 _bmpGc.drawQuad( _startX, _startY, vertexsX[t2], vertexsY[t2], vertexsX[t1], vertexsY[t1], x, y, 862 vertexsU[t3], vertexsV[t3], vertexsU[t2], vertexsV[t2], vertexsU[t1], vertexsV[t1], u, v ); 863 if ( _stroke_do ) 864 { 865 applyLineStyle(); 866 super.moveTo( vertexsX[t3], vertexsY[t3] ); 867 $lineTo( vertexsX[t2], vertexsY[t2] ); 868 $lineTo( vertexsX[t1], vertexsY[t1] ); 869 $lineTo( x, y ); 870 $closePath( _startX, _startY ); 871 } 872 } 873 else 874 { 875 applyFill(); 876 super.moveTo( vertexsX[t3], vertexsY[t3] ); 877 $lineTo( vertexsX[t2], vertexsY[t2] ); 878 $lineTo( vertexsX[t1], vertexsY[t1] ); 879 $lineTo( x, y ); 880 $closePath( _startX, _startY ); 881 applyFillEnd(); 882 } 824 883 } 825 884 break; … … 830 889 t2 = vertexCount - 3; 831 890 t3 = vertexCount - 4; 832 applyFill(); 833 super.moveTo( vertexsX[t3], vertexsY[t3] ); 834 super.lineTo( vertexsX[t2], vertexsY[t2] ); 835 super.lineTo( x, y ); 836 super.lineTo( vertexsX[t1], vertexsY[t1] ); 837 closePath(); 838 applyFillEnd(); 891 if ( texture_mode ) 892 { 893 _gc.lineStyle(); 894 super.moveTo( vertexsX[t3], vertexsY[t3] ); 895 _bmpGc.drawQuad( _startX, _startY, vertexsX[t2], vertexsY[t2], x, y, vertexsX[t1], vertexsY[t1], 896 vertexsU[t3], vertexsV[t3], vertexsU[t2], vertexsV[t2], u, v, vertexsU[t1], vertexsV[t1] ); 897 if ( _stroke_do ) 898 { 899 super.moveTo( vertexsX[t3], vertexsY[t3] ); 900 $lineTo( vertexsX[t2], vertexsY[t2] ); 901 $lineTo( x, y ); 902 $lineTo( vertexsX[t1], vertexsY[t1] ); 903 $closePath( _startX, _startY ); 904 } 905 } 906 else 907 { 908 applyFill(); 909 super.moveTo( vertexsX[t3], vertexsY[t3] ); 910 $lineTo( vertexsX[t2], vertexsY[t2] ); 911 $lineTo( x, y ); 912 $lineTo( vertexsX[t1], vertexsY[t1] ); 913 $closePath( _startX, _startY ); 914 applyFillEnd(); 915 } 839 916 } 840 917 break; … … 923 1000 shape_mode = NONE_SHAPE; 924 1001 shape_mode_polygon = false; 1002 1003 if ( texture_mode ) 1004 { 1005 texture_mode = false; 1006 _bmpGc.endBitmap(); 1007 } 925 1008 } 926 1009 as3/Frocessing/trunk/src/frocessing/core/F5Graphics2D.as
r714 r734 42 42 * 43 43 * @author nutsu 44 * @version 0.1. 244 * @version 0.1.3 45 45 */ 46 46 public class F5Graphics2D extends F5Graphics { … … 254 254 } 255 255 256 //--------------------------------------------------------------------------------------------------- IMAGE257 258 /**259 * @inheritDoc260 */261 public override function beginBitmapFill(bitmap:BitmapData,matrix_:Matrix=null,repeat:Boolean=true,smooth:Boolean=false):void262 {263 matrix_.concat( _matrix );264 _gc.beginBitmapFill( bitmap, matrix_, repeat, smooth );265 }266 267 256 //--------------------------------------------------------------------------------------------------- VERTEX 268 257 … … 270 259 * @inheritDoc 271 260 */ 272 public override function vertex( x:Number, y:Number ):void261 public override function vertex( x:Number, y:Number, u:Number=0, v:Number=0 ):void 273 262 { 274 263 super.vertex( x * a + y * c + tx, 275 x * b + y * d + ty ); 264 x * b + y * d + ty, 265 u, v ); 276 266 } 277 267 … … 391 381 x * a + y * c + tx, 392 382 x * b + y * d + ty ); 383 } 384 385 //--------------------------------------------------------------------------------------------------- BITMAP 386 387 /** 388 * @inheritDoc 389 */ 390 public override function drawBitmap( bitmapdata:BitmapData, x:Number, y:Number, w:Number, h:Number ):void 391 { 392 moveTo( x, y ); 393 _bmpGc.beginBitmap( bitmapdata ); 394 _bmpGc.drawBitmap( x, y, w, h, _matrix ); 395 _bmpGc.endBitmap(); 396 } 397 398 /** 399 * @inheritDoc 400 */ 401 public override function drawBitmapTriangle( bitmapdata:BitmapData, 402 x0:Number, y0:Number, x1:Number, y1:Number, x2:Number, y2:Number, 403 u0:Number, v0:Number, u1:Number, v1:Number, u2:Number, v2:Number ):void 404 { 405 super.drawBitmapTriangle( bitmapdata, 406 screenX( x0, y0 ), screenY( x0, y0 ), 407 screenX( x1, y1 ), screenY( x1, y1 ), 408 screenX( x2, y2 ), screenY( x2, y2 ), 409 u0, v0, u1, v1, u2, v2 ); 410 } 411 412 /** 413 * @@inheritDoc 414 */ 415 public override function drawBitmapQuad( bitmapdata:BitmapData, 416 x0:Number, y0:Number, x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, 417 u0:Number=0, v0:Number=0, u1:Number=1, v1:Number=0, u2:Number=1, v2:Number=1, u3:Number=0, v3:Number=1 ):void 418 { 419 super.drawBitmapQuad( bitmapdata, 420 screenX( x0, y0 ), screenY( x0, y0 ), 421 screenX( x1, y1 ), screenY( x1, y1 ), 422 screenX( x2, y2 ), screenY( x2, y2 ), 423 screenX( x3, y3 ), screenY( x3, y3 ), 424 u0, v0, u1, v1, u2, v2, u3, v3 ); 425 } 426 427 //--------------------------------------------------------------------------------------------------- FILL STYLE 428 429 /** 430 * @inheritDoc 431 */ 432 public override function beginBitmapFill(bitmap:BitmapData,matrix_:Matrix=null,repeat:Boolean=true,smooth:Boolean=false):void 433 { 434 // apply transfrom 435 if ( matrix_ ) 436 { 437 matrix_.concat( _matrix ); 438 _gc.beginBitmapFill( bitmap, matrix_, repeat, smooth ); 439 } 440 else 441 { 442 _gc.beginBitmapFill( bitmap, _matrix, repeat, smooth ); 443 } 444 } 445 446 /** 447 * @inheritDoc 448 */ 449 public override function beginGradientFill(type:String, color:Array, alphas:Array, ratios:Array, matrix_:Matrix=null, spreadMethod:String="pad", interpolationMethod:String="rgb",focalPointRation:Number=0.0):void 450 { 451 // apply transfrom 452 if ( matrix_ ) 453 { 454 matrix_.concat( _matrix ); 455 _gc.beginGradientFill( type, color, alphas, ratios, matrix_, spreadMethod, interpolationMethod, focalPointRation ); 456 } 457 else 458 { 459 _gc.beginGradientFill( type, color, alphas, ratios, _matrix, spreadMethod, interpolationMethod, focalPointRation ); 460 } 393 461 } 394 462 } as3/Frocessing/trunk/src/frocessing/core/F5Graphics3D.as
r714 r734 34 34 import flash.display.BitmapData; 35 35 import flash.display.Graphics; 36 import frocessing.f3d.F3DCamera; 36 37 import frocessing.f3d.F3DRender; 37 38 import frocessing.geom.FMatrix3D; 38 import frocessing.geom.Vector3D;39 39 import frocessing.math.FMath; 40 import frocessing.f3d.model.F3DModel; 41 import frocessing.f3d.model.F3DSphere; 40 42 41 43 /** … … 43 45 * 44 46 * @author nutsu 45 * @version 0.1. 247 * @version 0.1.3 46 48 */ 47 49 public class F5Graphics3D extends F5Graphics { … … 68 70 69 71 //Camera , Projection 70 private var _cameraX:Number; 71 private var _cameraY:Number; 72 private var _cameraZ:Number; 73 private var field_of_view:Number; 74 private var camera_aspect:Number; 75 private var p_left:Number; 76 private var p_right:Number; 77 private var p_bottom:Number; 78 private var p_top:Number; 79 private var z_near:Number; 80 private var z_far:Number; 72 private var f_camera:F3DCamera; 73 private var camera_setting:Boolean; 81 74 private var ortho_projection:Boolean; 82 83 private var camera_setting:Boolean;84 private var _cameraMatrix:FMatrix3D;85 private var _camera_tmp_matrix:FMatrix3D;86 private var _projMatrix:FMatrix3D;87 75 88 76 //Z Coordinates … … 109 97 private var sprite2d_pers_height:Number; 110 98 111 112 /**113 * 114 * @param gc 115 * @param width_ 116 * @param height_ 99 /** 100 * 新しく F5Graphics3D のインスタンスを生成します. 101 * 102 * @param gc 描画対象の Graphics 103 * @param width_ スクリーンの幅 104 * @param height_ スクリーンの高さ 117 105 */ 118 106 public function F5Graphics3D( gc:Graphics, width_:Number, height_:Number ) … … 122 110 _background_do = false; 123 111 112 // size 113 _width = width_; 114 _height = height_; 115 half_width = _width*0.5; 116 half_height = _height * 0.5; 117 124 118 // camrea and projection 125 camera_setting = false; 126 _cameraMatrix = new FMatrix3D(); 127 _projMatrix = new FMatrix3D(); 119 camera_setting = false; 120 f_camera = new F3DCamera( _width, _height ); 121 122 // 3d rendrer 123 render = new F3DRender( gc, half_width, half_height ); 124 render.init(); 128 125 129 126 // transfrom init … … 131 128 _matrix_tmp = []; 132 129 133 //134 size( width_, height_ );135 136 // 3d rendrer137 render = new F3DRender( gc, width_*0.5, height_*0.5 );138 render.init();139 140 130 // init sphere 141 131 sphereDetail(12); 142 132 } 143 133 144 //--------------------------------------------------------------------------------------------------- OUT 145 146 /** 147 * 134 /** 135 * @inheritDoc 136 */ 137 public override function size(width_:uint, height_:uint):void 138 { 139 // init canvas size 140 _width = width_; 141 _height = height_; 142 half_width = _width*0.5; 143 half_height = _height * 0.5; 144 145 // init camera and projection 146 f_camera.setScreenSize( width_, height_ ); 147 148 // set render center coordinate 149 render.setCenter( half_width, half_height ); 150 151 // reset transform 152 resetMatrix(); 153 } 154 155 //--------------------------------------------------------------------------------------------------- OUT TO RENDER 156 157 /** 158 * render clear and init 148 159 */ 149 160 protected override function $clear():void … … 153 164 154 165 /** 155 * 166 * render moveTo. start shape. 156 167 */ 157 168 protected function $moveTo3d( x:Number, y:Number, z:Number ):void … … 162 173 163 174 /** 164 * 175 * render lineTo 165 176 */ 166 177 protected function $lineTo3d( x:Number, y:Number, z:Number ):void … … 170 181 171 182 /** 172 * 183 * render curveTo 173 184 */ 174 185 protected function $curveTo3d( cx:Number, cy:Number, cz:Number, x:Number, y:Number, z:Number ):void … … 178 189 179 190 /**