| 367 |
public void t2D描画( Device device, int x, int y, float depth, Rectangle rc画像内の描画領域 ) |
public void t2D描画( Device device, int x, int y, float depth, Rectangle rc画像内の描画領域 ) |
| 368 |
{ |
{ |
| 369 |
if( this.texture == null ) |
if( this.texture == null ) |
| 370 |
return; |
throw new InvalidOperationException("テクスチャは生成されていません。"); |
| 371 |
|
|
| 372 |
this.tレンダリングステートの設定( device ); |
this.tレンダリングステートの設定( device ); |
| 373 |
|
|
| 493 |
#endregion |
#endregion |
| 494 |
} |
} |
| 495 |
} |
} |
| 496 |
|
public void t2D上下反転描画( Device device, int x, int y ) |
| 497 |
|
{ |
| 498 |
|
this.t2D上下反転描画( device, x, y, 1f, this.rc全画像 ); |
| 499 |
|
} |
| 500 |
|
public void t2D上下反転描画( Device device, int x, int y, Rectangle rc画像内の描画領域 ) |
| 501 |
|
{ |
| 502 |
|
this.t2D上下反転描画( device, x, y, 1f, rc画像内の描画領域 ); |
| 503 |
|
} |
| 504 |
|
public void t2D上下反転描画( Device device, int x, int y, float depth, Rectangle rc画像内の描画領域 ) |
| 505 |
|
{ |
| 506 |
|
if( this.texture == null ) |
| 507 |
|
throw new InvalidOperationException( "テクスチャは生成されていません。" ); |
| 508 |
|
|
| 509 |
|
this.tレンダリングステートの設定( device ); |
| 510 |
|
|
| 511 |
|
float fx = -0.5f; // -0.5 は座標とピクセルの誤差を吸収するための座標補正値。(MSDN参照) |
| 512 |
|
float fy = -0.5f; // |
| 513 |
|
float w = rc画像内の描画領域.Width * this.vc拡大縮小倍率.X * CTexture.f画面比率; |
| 514 |
|
float h = rc画像内の描画領域.Height * this.vc拡大縮小倍率.Y * CTexture.f画面比率; |
| 515 |
|
float f左U値 = ( (float) rc画像内の描画領域.Left ) / ( (float) this.szテクスチャサイズ.Width ); |
| 516 |
|
float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width ); |
| 517 |
|
float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height ); |
| 518 |
|
float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height ); |
| 519 |
|
this.color4.Alpha = ( (float) this._透明度 ) / 255f; |
| 520 |
|
int color = this.color4.ToArgb(); |
| 521 |
|
|
| 522 |
|
// 以下、マネージドオブジェクトの量産を抑えるため new は使わない。 |
| 523 |
|
|
| 524 |
|
if (this.cvTransformedColoredVertexies == null) |
| 525 |
|
this.cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[4]; |
| 526 |
|
|
| 527 |
|
this.cvTransformedColoredVertexies[ 0 ].TextureCoordinates.X = f左U値; // 左上 → 左下 |
| 528 |
|
this.cvTransformedColoredVertexies[ 0 ].TextureCoordinates.Y = f下V値; |
| 529 |
|
this.cvTransformedColoredVertexies[ 0 ].Position.X = fx; |
| 530 |
|
this.cvTransformedColoredVertexies[ 0 ].Position.Y = fy; |
| 531 |
|
this.cvTransformedColoredVertexies[ 0 ].Position.Z = depth; |
| 532 |
|
this.cvTransformedColoredVertexies[ 0 ].Position.W = 1.0f; |
| 533 |
|
this.cvTransformedColoredVertexies[ 0 ].Color = color; |
| 534 |
|
|
| 535 |
|
this.cvTransformedColoredVertexies[ 1 ].TextureCoordinates.X = f右U値; // 右上 → 右下 |
| 536 |
|
this.cvTransformedColoredVertexies[ 1 ].TextureCoordinates.Y = f下V値; |
| 537 |
|
this.cvTransformedColoredVertexies[ 1 ].Position.X = fx + w; |
| 538 |
|
this.cvTransformedColoredVertexies[ 1 ].Position.Y = fy; |
| 539 |
|
this.cvTransformedColoredVertexies[ 1 ].Position.Z = depth; |
| 540 |
|
this.cvTransformedColoredVertexies[ 1 ].Position.W = 1.0f; |
| 541 |
|
this.cvTransformedColoredVertexies[ 1 ].Color = color; |
| 542 |
|
|
| 543 |
|
this.cvTransformedColoredVertexies[ 2 ].TextureCoordinates.X = f左U値; // 左下 → 左上 |
| 544 |
|
this.cvTransformedColoredVertexies[ 2 ].TextureCoordinates.Y = f上V値; |
| 545 |
|
this.cvTransformedColoredVertexies[ 2 ].Position.X = fx; |
| 546 |
|
this.cvTransformedColoredVertexies[ 2 ].Position.Y = fy + h; |
| 547 |
|
this.cvTransformedColoredVertexies[ 2 ].Position.Z = depth; |
| 548 |
|
this.cvTransformedColoredVertexies[ 2 ].Position.W = 1.0f; |
| 549 |
|
this.cvTransformedColoredVertexies[ 2 ].Color = color; |
| 550 |
|
|
| 551 |
|
this.cvTransformedColoredVertexies[ 3 ].TextureCoordinates.X = f右U値; // 右下 → 右上 |
| 552 |
|
this.cvTransformedColoredVertexies[ 3 ].TextureCoordinates.Y = f上V値; |
| 553 |
|
this.cvTransformedColoredVertexies[ 3 ].Position.X = fx + w; |
| 554 |
|
this.cvTransformedColoredVertexies[ 3 ].Position.Y = fy + h; |
| 555 |
|
this.cvTransformedColoredVertexies[ 3 ].Position.Z = depth; |
| 556 |
|
this.cvTransformedColoredVertexies[ 3 ].Position.W = 1.0f; |
| 557 |
|
this.cvTransformedColoredVertexies[ 3 ].Color = color; |
| 558 |
|
|
| 559 |
|
device.SetTexture( 0, this.texture ); |
| 560 |
|
device.VertexFormat = TransformedColoredTexturedVertex.Format; |
| 561 |
|
device.DrawUserPrimitives( PrimitiveType.TriangleStrip, 2, this.cvTransformedColoredVertexies ); |
| 562 |
|
} |
| 563 |
|
public void t2D上下反転描画( Device device, Point pt ) |
| 564 |
|
{ |
| 565 |
|
this.t2D上下反転描画( device, pt.X, pt.Y, 1f, this.rc全画像 ); |
| 566 |
|
} |
| 567 |
|
public void t2D上下反転描画( Device device, Point pt, Rectangle rc画像内の描画領域 ) |
| 568 |
|
{ |
| 569 |
|
this.t2D上下反転描画( device, pt.X, pt.Y, 1f, rc画像内の描画領域 ); |
| 570 |
|
} |
| 571 |
|
public void t2D上下反転描画( Device device, Point pt, float depth, Rectangle rc画像内の描画領域 ) |
| 572 |
|
{ |
| 573 |
|
this.t2D上下反転描画( device, pt.X, pt.Y, depth, rc画像内の描画領域 ); |
| 574 |
|
} |
| 575 |
|
|
| 576 |
public static Vector3 t論理画面座標をワールド座標へ変換する(int x, int y) |
public static Vector3 t論理画面座標をワールド座標へ変換する(int x, int y) |
| 577 |
{ |
{ |