| 13 |
public class CTexture : IDisposable |
public class CTexture : IDisposable |
| 14 |
{ |
{ |
| 15 |
// プロパティ |
// プロパティ |
|
|
|
| 16 |
public bool b加算合成 |
public bool b加算合成 |
| 17 |
{ |
{ |
| 18 |
get; |
get; |
| 67 |
} |
} |
| 68 |
public Vector3 vc拡大縮小倍率; |
public Vector3 vc拡大縮小倍率; |
| 69 |
|
|
| 70 |
// 画面が変わるたび以下のプロパティを設定し治すこと。 |
// 画面が変わるたび以下のプロパティを設定し治すこと。 |
| 71 |
|
|
| 72 |
public static Size sz論理画面 = Size.Empty; |
public static Size sz論理画面 = Size.Empty; |
| 73 |
public static Size sz物理画面 = Size.Empty; |
public static Size sz物理画面 = Size.Empty; |
| 74 |
public static Rectangle rc物理画面描画領域 = Rectangle.Empty; |
public static Rectangle rc物理画面描画領域 = Rectangle.Empty; |
| 75 |
/// <summary> |
/// <summary> |
| 76 |
/// <para>論理画面を1とする場合の物理画面の倍率。</para> |
/// <para>論理画面を1とする場合の物理画面の倍率。</para> |
| 77 |
/// <para>論理値×画面比率=物理値。</para> |
/// <para>論理値×画面比率=物理値。</para> |
| 78 |
/// </summary> |
/// </summary> |
| 79 |
public static float f画面比率 = 1.0f; |
public static float f画面比率 = 1.0f; |
| 80 |
|
|
| 81 |
// コンストラクタ |
// コンストラクタ |
| 82 |
|
|
| 621 |
float z = 0.0f; |
float z = 0.0f; |
| 622 |
float f左U値 = ( (float) rc画像内の描画領域.Left ) / ( (float) this.szテクスチャサイズ.Width ); |
float f左U値 = ( (float) rc画像内の描画領域.Left ) / ( (float) this.szテクスチャサイズ.Width ); |
| 623 |
float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width ); |
float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width ); |
| 624 |
|
float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height ); |
| 625 |
|
float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height ); |
| 626 |
|
this.color4.Alpha = ( (float) this._透明度 ) / 255f; |
| 627 |
|
int color = this.color4.ToArgb(); |
| 628 |
|
|
| 629 |
|
if( this.cvPositionColoredVertexies == null ) |
| 630 |
|
this.cvPositionColoredVertexies = new PositionColoredTexturedVertex[ 4 ]; |
| 631 |
|
|
| 632 |
|
// #27122 2012.1.13 from: 以下、マネージドオブジェクト(=ガベージ)の量産を抑えるため、new は使わず、メンバに値を1つずつ直接上書きする。 |
| 633 |
|
|
| 634 |
|
this.cvPositionColoredVertexies[ 0 ].Position.X = -x; |
| 635 |
|
this.cvPositionColoredVertexies[ 0 ].Position.Y = y; |
| 636 |
|
this.cvPositionColoredVertexies[ 0 ].Position.Z = z; |
| 637 |
|
this.cvPositionColoredVertexies[ 0 ].Color = color; |
| 638 |
|
this.cvPositionColoredVertexies[ 0 ].TextureCoordinates.X = f左U値; |
| 639 |
|
this.cvPositionColoredVertexies[ 0 ].TextureCoordinates.Y = f上V値; |
| 640 |
|
|
| 641 |
|
this.cvPositionColoredVertexies[ 1 ].Position.X = x; |
| 642 |
|
this.cvPositionColoredVertexies[ 1 ].Position.Y = y; |
| 643 |
|
this.cvPositionColoredVertexies[ 1 ].Position.Z = z; |
| 644 |
|
this.cvPositionColoredVertexies[ 1 ].Color = color; |
| 645 |
|
this.cvPositionColoredVertexies[ 1 ].TextureCoordinates.X = f右U値; |
| 646 |
|
this.cvPositionColoredVertexies[ 1 ].TextureCoordinates.Y = f上V値; |
| 647 |
|
|
| 648 |
|
this.cvPositionColoredVertexies[ 2 ].Position.X = -x; |
| 649 |
|
this.cvPositionColoredVertexies[ 2 ].Position.Y = -y; |
| 650 |
|
this.cvPositionColoredVertexies[ 2 ].Position.Z = z; |
| 651 |
|
this.cvPositionColoredVertexies[ 2 ].Color = color; |
| 652 |
|
this.cvPositionColoredVertexies[ 2 ].TextureCoordinates.X = f左U値; |
| 653 |
|
this.cvPositionColoredVertexies[ 2 ].TextureCoordinates.Y = f下V値; |
| 654 |
|
|
| 655 |
|
this.cvPositionColoredVertexies[ 3 ].Position.X = x; |
| 656 |
|
this.cvPositionColoredVertexies[ 3 ].Position.Y = -y; |
| 657 |
|
this.cvPositionColoredVertexies[ 3 ].Position.Z = z; |
| 658 |
|
this.cvPositionColoredVertexies[ 3 ].Color = color; |
| 659 |
|
this.cvPositionColoredVertexies[ 3 ].TextureCoordinates.X = f右U値; |
| 660 |
|
this.cvPositionColoredVertexies[ 3 ].TextureCoordinates.Y = f下V値; |
| 661 |
|
|
| 662 |
|
this.tレンダリングステートの設定( device ); |
| 663 |
|
|
| 664 |
|
device.SetTransform( TransformState.World, mat ); |
| 665 |
|
device.SetTexture( 0, this.texture ); |
| 666 |
|
device.VertexFormat = PositionColoredTexturedVertex.Format; |
| 667 |
|
device.DrawUserPrimitives( PrimitiveType.TriangleStrip, 2, this.cvPositionColoredVertexies ); |
| 668 |
|
} |
| 669 |
|
|
| 670 |
|
public void t3D左上基準描画( Device device, Matrix mat ) |
| 671 |
|
{ |
| 672 |
|
this.t3D左上基準描画( device, mat, this.rc全画像 ); |
| 673 |
|
} |
| 674 |
|
/// <summary> |
| 675 |
|
/// ○覚書 |
| 676 |
|
/// SlimDX.Matrix mat = SlimDX.Matrix.Identity; |
| 677 |
|
/// mat *= SlimDX.Matrix.Translation( x, y, z ); |
| 678 |
|
/// 「mat =」ではなく「mat *=」であることを忘れないこと。 |
| 679 |
|
/// </summary> |
| 680 |
|
public void t3D左上基準描画( Device device, Matrix mat, Rectangle rc画像内の描画領域 ) |
| 681 |
|
{ |
| 682 |
|
//とりあえず補正値などは無し。にしても使う機会少なさそうだなー・・・・ |
| 683 |
|
if( this.texture == null ) |
| 684 |
|
return; |
| 685 |
|
|
| 686 |
|
float x = 0.0f; |
| 687 |
|
float y = 0.0f; |
| 688 |
|
float z = 0.0f; |
| 689 |
|
float f左U値 = ( (float) rc画像内の描画領域.Left ) / ( (float) this.szテクスチャサイズ.Width ); |
| 690 |
|
float f右U値 = ( (float) rc画像内の描画領域.Right ) / ( (float) this.szテクスチャサイズ.Width ); |
| 691 |
float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height ); |
float f上V値 = ( (float) rc画像内の描画領域.Top ) / ( (float) this.szテクスチャサイズ.Height ); |
| 692 |
float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height ); |
float f下V値 = ( (float) rc画像内の描画領域.Bottom ) / ( (float) this.szテクスチャサイズ.Height ); |
| 693 |
this.color4.Alpha = ( (float) this._透明度 ) / 255f; |
this.color4.Alpha = ( (float) this._透明度 ) / 255f; |