2 using System.Collections.Generic;
3 using System.Diagnostics;
5 using System.Windows.Forms;
9 class StrokeStyleT : FDK.ApplicationFormBase
11 public override void 初期化する()
13 Debug.Assert( null == this.デバイスリソース ); // 作成される前である。
15 this.Text = $"StrokeStyle<T> {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
16 this.ClientSize = new System.Drawing.Size( 640, 480 ); // 初期サイズ
18 this.KeyDown += ( target, arg ) => {
20 if( arg.KeyCode == System.Windows.Forms.Keys.Escape )
24 public override void 終了する()
26 Debug.Assert( null == this.デバイスリソース ); // 解放された後である。
29 if( null != this.testTexture )
31 this.testTexture.非活性化する( this.デバイスリソース );
32 this.testTexture = null;
35 public override void シーンを描画する()
42 if( null == this.testTexture )
44 this.testTexture = new FDK.メディア.テクスチャ( "テスト用テクスチャ画像.jpg" );
45 this.testTexture.活性化する( this.デバイスリソース );
46 this.testTexture.不透明度 = 1f;
47 this.testTexture.加算合成する = false;
50 var d3dDevice = (SharpDX.Direct3D11.Device) null;
51 using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( this.デバイスリソース.DXGIDeviceManager, out d3dDevice ) )
55 d3dDevice.ImmediateContext.ClearRenderTargetView(
56 this.デバイスリソース.D3DRenderTargetView, SharpDX.Color4.Black );
58 d3dDevice.ImmediateContext.ClearDepthStencilView(
59 this.デバイスリソース.D3DDepthStencilView,
60 SharpDX.Direct3D11.DepthStencilClearFlags.Depth, // ここでは深度バッファのみ。
68 var matScale = SharpDX.Matrix.Scaling( 320f, 240f, 1.0f );
69 var matY = SharpDX.Matrix.RotationY( (float) ( Math.PI * ( timeGetTime() % 3000 ) ) / 1500.0f );
70 var matX = SharpDX.Matrix.RotationX( (float) ( Math.PI * ( timeGetTime() % 1500 ) ) / 750.0f );
71 var mat = matScale * matY * matX;
72 this.testTexture?.進行描画する( this.デバイスリソース, mat, new SharpDX.RectangleF( 0f, 0f, 0.5f, 0.5f ) );
76 private FDK.メディア.テクスチャ testTexture = null;
77 [System.Runtime.InteropServices.DllImport( "winmm.dll" )]
78 private static extern uint timeGetTime();