1: //--------------------------------------------------------------------------------------
2: // File: main.cpp
3: //--------------------------------------------------------------------------------------
4: #include "dxstdafx.h"
5: #include "resource.h"
6: #include "rendertarget.h"
7:
8: #undef FAST_RENDERING
9: //#define FAST_RENDERING
10:
11: //#define DEBUG_VS // Uncomment this line to debug vertex shaders
12: //#define DEBUG_PS // Uncomment this line to debug pixel shaders
13:
14: #define ORIGINAL_WIDTH 512.0f
15: #define ORIGINAL_HEIGHT 512.0f
16:
17: #define SCREEN_WIDTH 512.0f
18: #define SCREEN_HEIGHT 512.0f
19: //#define SCREEN_WIDTH 1024.0f
20: //#define SCREEN_HEIGHT 1024.0f
21: //#define SCREEN_WIDTH 1280.0f
22: //#define SCREEN_HEIGHT 720.0f
23:
24: //#define SCREEN_FORMAT RTF_RGBA
25: #define SCREEN_FORMAT RTF_RGBA16F
26:
27: #define Z_NEAR 0.5f
28: #define Z_FAR 10.0f
29: //--------------------------------------------------------------------------------------
30: // Vertex format
31: //--------------------------------------------------------------------------------------
32: struct VERTEX
33: {
34: D3DXVECTOR4 pos;
35: D3DXVECTOR2 tex1;
36:
37: static const DWORD FVF;
38: };
39: const DWORD VERTEX::FVF = D3DFVF_XYZRHW | D3DFVF_TEX1;
40:
41:
42: typedef struct {
43: FLOAT p[4];
44: FLOAT tu, tv;
45: } TVERTEX;
46:
47:
48:
49: //--------------------------------------------------------------------------------------
50: // UI control IDs
51: //--------------------------------------------------------------------------------------
52: #define IDC_TOGGLEFULLSCREEN 1
53: #define IDC_TOGGLEREF 2
54: #define IDC_CHANGEDEVICE 3
55: #define IDC_CHANGE_SCENE 4
56: #define IDC_PAUSE 10
57: #define IDC_RADIUS_L_STATIC 11
58: #define IDC_RADIUS_L 12
59: #define IDC_RADIUS_X_STATIC 13
60: #define IDC_RADIUS_X 14
61:
62: //--------------------------------------------------------------------------------------
63: // Global variables
64: //--------------------------------------------------------------------------------------
65: HWND g_hWnd;
66: ID3DXFont* g_pFont = NULL; // Font for drawing text
67: ID3DXSprite* g_pTextSprite = NULL; // Sprite for batching draw text calls
68: CFirstPersonCamera g_Camera; // A model viewing camera
69: bool g_bShowHelp = true; // If true, it renders the UI control text
70: CDXUTDialogResourceManager g_DialogResourceManager; // manager for shared resources of dialogs
71: CD3DSettingsDlg g_SettingsDlg; // Device settings dialog
72: CDXUTDialog g_HUD; // dialog for standard controls
73: CDXUTDialog g_SampleUI; // dialog for sample specific controls
74: bool g_bPause = false;
75: //bool g_bPause = true;
76: float g_fPhase = D3DX_PI * 0.8f;
77:
78: VERTEX g_Vertex[4];
79:
80: // Render target
81: CRenderTarget *g_pRT_FullScreen=0;
82: D3DVIEWPORT9 g_ViewportFB;
83: CRenderTarget *g_pRT_GaussX=0;
84: CRenderTarget *g_pRT_Blur=0;
85:
86: // BG object
87: bool g_bObj = true;
88: LPD3DXMESH g_pObjMesh=0;
89: LPDIRECT3DTEXTURE9 g_pObjMeshTexture=0;
90: D3DXMATRIXA16 g_matObjWorld;
91:
92: // Map object
93: bool g_bMap = true;
94: LPD3DXMESH g_pMapMesh=0;
95: LPDIRECT3DTEXTURE9 g_pMapMeshTexture=0;
96: D3DXMATRIXA16 g_matMapWorld;
97:
98: // Scene management
99: DWORD g_dwBackgroundColor;
100:
101:
102: // Effect system
103: LPD3DXEFFECT g_pEffect;
104: D3DXHANDLE g_hWorld = NULL;
105: D3DXHANDLE g_hWorldViewProjection = NULL;
106:
107: D3DXHANDLE g_hMeshTexture = NULL;
108:
109: D3DXHANDLE g_hTechScene = NULL;
110: D3DXHANDLE g_hTechFinal = NULL;
111: float g_fRadiusX = 2.0f;
112: float g_fRadiusL = 0.2f;
113:
114: //--------------------------------------------------------------------------------------
115: // Forward declarations
116: //--------------------------------------------------------------------------------------
117: bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext );
118: bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, const D3DCAPS9* pCaps, void* pUserContext );
119: HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext );
120: HRESULT CALLBACK OnResetDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext );
121: void CALLBACK OnFrameMove( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext );
122: void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext );
123: LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext );
124: void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext );
125: void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext );
126: void CALLBACK OnLostDevice( void* pUserContext );
127: void CALLBACK OnDestroyDevice( void* pUserContext );
128:
129: void InitApp();
130: HRESULT LoadMesh( IDirect3DDevice9* pd3dDevice, WCHAR* strFileName, ID3DXMesh** ppMesh );
131: void RenderText(bool bFast);
132: void SetupQuad( const D3DSURFACE_DESC* pBackBufferSurfaceDesc );
133:
134:
135: static void SetGaussWeight(float radius=1.0)
136: {
137: // const float dispersion = 0.3f;
138: // const float dispersion = 1.f;
139: float dispersion = radius * radius;
140: const unsigned int WEIGHT_MUN = 4;
141: float tbl[WEIGHT_MUN];
142: DWORD i;
143:
144: for( i=0; i<WEIGHT_MUN; i++ ){
145: // 2テクセルまとめて処理するので2倍
146: tbl[i] = 2.0f * expf(-0.5f*((2.0f*(FLOAT)i+1.5f)*(2.0f*(FLOAT)i+1.5f))/dispersion);
147: }
148:
149: if(g_pEffect) g_pEffect->SetVector("weight", (const D3DXVECTOR4 *)tbl);
150:
151: }
152:
153: static void SetGaussRadius()
154: {
155: const float range = 1.0;
156: SetGaussWeight(g_fRadiusX);
157:
158: D3DXVECTOR4 width(1.5f*range/SCREEN_WIDTH, 3.5f*range/SCREEN_WIDTH, 5.5f*range/SCREEN_WIDTH, 7.5f*range/SCREEN_WIDTH);
159: D3DXVECTOR4 height(1.5f*range/SCREEN_HEIGHT, 3.5f*range/SCREEN_HEIGHT, 5.5f*range/SCREEN_HEIGHT, 7.5f*range/SCREEN_HEIGHT);
160:
161: if(g_pEffect)
162: {
163: g_pEffect->SetVector("vBias", &width);
164: g_pEffect->SetVector("hBias", &height);
165: g_pEffect->SetFloat("coeff_l", -0.5f/(g_fRadiusL*g_fRadiusL));
166: }
167: }
168:
169: //--------------------------------------------------------------------------------------
170: // Entry point to the program. Initializes everything and goes into a message processing
171: // loop. Idle time is used to render the scene.
172: //--------------------------------------------------------------------------------------
173: INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
174: {
175: // Enable run-time memory check for debug builds.
176: #if defined(DEBUG) | defined(_DEBUG)
177: _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
178: #endif
179:
180: // Set the callback functions. These functions allow DXUT to notify
181: // the application about device changes, user input, and windows messages. The
182: // callbacks are optional so you need only set callbacks for events you're interested
183: // in. However, if you don't handle the device reset/lost callbacks then the sample
184: // framework won't be able to reset your device since the application must first
185: // release all device resources before resetting. Likewise, if you don't handle the
186: // device created/destroyed callbacks then DXUT won't be able to
187: // recreate your device resources.
188: DXUTSetCallbackDeviceCreated( OnCreateDevice );
189: DXUTSetCallbackDeviceReset( OnResetDevice );
190: DXUTSetCallbackDeviceLost( OnLostDevice );
191: DXUTSetCallbackDeviceDestroyed( OnDestroyDevice );
192: DXUTSetCallbackMsgProc( MsgProc );
193: DXUTSetCallbackKeyboard( KeyboardProc );
194: DXUTSetCallbackFrameRender( OnFrameRender );
195: DXUTSetCallbackFrameMove( OnFrameMove );
196:
197: // Show the cursor and clip it when in full screen
198: DXUTSetCursorSettings( true, true );
199:
200: InitApp();
201:
202: // Initialize DXUT and create the desired Win32 window and Direct3D
203: // device for the application. Calling each of these functions is optional, but they
204: // allow you to set several options which control the behavior of the framework.
205: DXUTInit( true, true, true ); // Parse the command line, handle the default hotkeys, and show msgboxes
206: DXUTCreateWindow( L"Bilateral Filter" );
207: DXUTCreateDevice( D3DADAPTER_DEFAULT, true, (DWORD)SCREEN_WIDTH, (DWORD)SCREEN_HEIGHT, IsDeviceAcceptable, ModifyDeviceSettings );
208: // DXUTCreateDevice( D3DADAPTER_DEFAULT, true, 640, 480, IsDeviceAcceptable, ModifyDeviceSettings );
209:
210: // Pass control to DXUT for handling the message pump and
211: // dispatching render calls. DXUT will call your FrameMove
212: // and FrameRender callback when there is idle time between handling window messages.
213: DXUTMainLoop();
214:
215: // Perform any application-level cleanup here. Direct3D device resources are released within the
216: // appropriate callback functions and therefore don't require any cleanup code here.
217:
218: return DXUTGetExitCode();
219: }
220:
221:
222: //--------------------------------------------------------------------------------------
223: // Initialize the app
224: //--------------------------------------------------------------------------------------
225: void InitApp()
226: {
227: g_pFont = NULL;
228:
229: g_pEffect = NULL;
230:
231: g_bShowHelp = TRUE;
232: g_dwBackgroundColor = 0x00003F3F;
233:
234: // Initialize dialogs
235: g_SettingsDlg.Init( &g_DialogResourceManager );
236: g_HUD.Init( &g_DialogResourceManager );
237: g_SampleUI.Init( &g_DialogResourceManager );
238:
239: g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
240: g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
241: g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22 );
242: g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
243:
244: g_SampleUI.SetCallback( OnGUIEvent ); iY = 100;
245:
246: WCHAR sz[100];
247:
248: g_SampleUI.AddCheckBox( IDC_PAUSE, L"PAUSE", 50, iY += 24, 145, 22, g_bPause );
249: // iY += 24;
250: StringCchPrintf( sz, 100, L"Radius(Lum): %0.2f", g_fRadiusL );
251: g_SampleUI.AddStatic( IDC_RADIUS_L_STATIC, sz, 35, iY += 24, 125, 22 );
252: g_SampleUI.AddSlider( IDC_RADIUS_L, 50, iY += 24, 100, 22, 1, 100, (int) (100.0f*g_fRadiusL) );
253:
254: StringCchPrintf( sz, 100, L"Radius(x): %0.2f", g_fRadiusX );
255: g_SampleUI.AddStatic( IDC_RADIUS_X_STATIC, sz, 35, iY += 24, 125, 22 );
256: g_SampleUI.AddSlider( IDC_RADIUS_X, 50, iY += 24, 100, 22, 1, 500, (int) (100.0f*g_fRadiusX) );
257:
258: }
259:
260:
261: //--------------------------------------------------------------------------------------
262: // Called during device initialization, this code checks the device for some
263: // minimum set of capabilities, and rejects those that don't pass by returning false.
264: //--------------------------------------------------------------------------------------
265: bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat,
266: D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext )
267: {
268: // Skip backbuffer formats that don't support alpha blending
269: IDirect3D9* pD3D = DXUTGetD3DObject();
270: if( FAILED( pD3D->CheckDeviceFormat( pCaps->AdapterOrdinal, pCaps->DeviceType,
271: AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
272: D3DRTYPE_TEXTURE, BackBufferFormat ) ) )
273: return false;
274:
275: // Must support pixel shader 1.1
276: if( pCaps->PixelShaderVersion < D3DPS_VERSION( 2, 0 ) )
277: return false;
278:
279: return true;
280: }
281:
282:
283: //--------------------------------------------------------------------------------------
284: // This callback function is called immediately before a device is created to allow the
285: // application to modify the device settings. The supplied pDeviceSettings parameter
286: // contains the settings that the framework has selected for the new device, and the
287: // application can make any desired changes directly to this structure. Note however that
288: // DXUT will not correct invalid device settings so care must be taken
289: // to return valid device settings, otherwise IDirect3D9::CreateDevice() will fail.
290: //--------------------------------------------------------------------------------------
291: bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, const D3DCAPS9* pCaps, void* pUserContext )
292: {
293: // If device doesn't support HW T&L or doesn't support 1.1 vertex shaders in HW
294: // then switch to SWVP.
295: if( (pCaps->DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0 ||
296: pCaps->VertexShaderVersion < D3DVS_VERSION(2,0) )
297: {
298: pDeviceSettings->BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
299: }
300:
301: // Debugging vertex shaders requires either REF or software vertex processing
302: // and debugging pixel shaders requires REF.
303: #ifdef DEBUG_VS
304: if( pDeviceSettings->DeviceType != D3DDEVTYPE_REF )
305: {
306: pDeviceSettings->BehaviorFlags &= ~D3DCREATE_HARDWARE_VERTEXPROCESSING;
307: pDeviceSettings->BehaviorFlags &= ~D3DCREATE_PUREDEVICE;
308: pDeviceSettings->BehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
309: }
310: #endif
311: #ifdef DEBUG_PS
312: pDeviceSettings->DeviceType = D3DDEVTYPE_REF;
313: #endif
314:
315: // For the first device created if its a REF device, optionally display a warning dialog box
316: static bool s_bFirstTime = true;
317: if( s_bFirstTime )
318: {
319: s_bFirstTime = false;
320: if( pDeviceSettings->DeviceType == D3DDEVTYPE_REF )
321: DXUTDisplaySwitchingToREFWarning();
322: }
323:
324: return true;
325: }
326:
327:
328: //--------------------------------------------------------------------------------------
329: // This function loads the mesh and ensures the mesh has normals; it also optimizes the
330: // mesh for the graphics card's vertex cache, which improves performance by organizing
331: // the internal triangle list for less cache misses.
332: //--------------------------------------------------------------------------------------
333: HRESULT LoadMesh( IDirect3DDevice9* pd3dDevice, WCHAR* strFileName, ID3DXMesh** ppMesh )
334: {
335: ID3DXMesh* pMesh = NULL;
336: WCHAR str[MAX_PATH];
337: HRESULT hr;
338:
339: // Load the mesh with D3DX and get back a ID3DXMesh*. For this
340: // sample we'll ignore the X file's embedded materials since we know
341: // exactly the model we're loading. See the mesh samples such as
342: // "OptimizedMesh" for a more generic mesh loading example.
343: V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, strFileName ) );
344:
345: V_RETURN( D3DXLoadMeshFromX(str, D3DXMESH_MANAGED, pd3dDevice, NULL, NULL, NULL, NULL, &pMesh) );
346:
347: // Make sure there are normals which are required for lighting
348: if( !(pMesh->GetFVF() & D3DFVF_NORMAL) )
349: {
350: ID3DXMesh* pTempMesh;
351: V( pMesh->CloneMeshFVF( pMesh->GetOptions(),
352: pMesh->GetFVF() | D3DFVF_NORMAL,
353: pd3dDevice, &pTempMesh ) );
354: V( D3DXComputeNormals( pTempMesh, NULL ) );
355:
356: SAFE_RELEASE( pMesh );
357: pMesh = pTempMesh;
358: }
359:
360: *ppMesh = pMesh;
361:
362: return S_OK;
363: }
364:
365: HRESULT OptimizeMesh( IDirect3DDevice9* pd3dDevice, ID3DXMesh** ppMesh )
366: {
367: ID3DXMesh* pMesh = *ppMesh;
368: DWORD *rgdwAdjacency = NULL;
369: HRESULT hr;
370:
371: // Optimize the mesh for this graphics card's vertex cache
372: // so when rendering the mesh's triangle list the vertices will
373: // cache hit more often so it won't have to re-execute the vertex shader
374: // on those vertices so it will improve perf.
375: rgdwAdjacency = new DWORD[pMesh->GetNumFaces() * 3];
376: if( rgdwAdjacency == NULL )
377: return E_OUTOFMEMORY;
378: V( pMesh->GenerateAdjacency(1e-6f,rgdwAdjacency) );
379: V( pMesh->OptimizeInplace(D3DXMESHOPT_VERTEXCACHE, rgdwAdjacency, NULL, NULL, NULL) );
380: delete []rgdwAdjacency;
381:
382: *ppMesh = pMesh;
383:
384: return S_OK;
385: }
386:
387:
388: //--------------------------------------------------------------------------------------
389: // This callback function will be called immediately after the Direct3D device has been
390: // created, which will happen during application initialization and windowed/full screen
391: // toggles. This is the best location to create D3DPOOL_MANAGED resources since these
392: // resources need to be reloaded whenever the device is destroyed. Resources created
393: // here should be released in the OnDestroyDevice callback.
394: //--------------------------------------------------------------------------------------
395: HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
396: {
397: WCHAR str[MAX_PATH];
398: HRESULT hr;
399:
400: V_RETURN( g_DialogResourceManager.OnCreateDevice( pd3dDevice ) );
401: V_RETURN( g_SettingsDlg.OnCreateDevice( pd3dDevice ) );
402:
403: // Initialize the font
404: V_RETURN( D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
405: OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
406: L"Arial", &g_pFont ) );
407:
408: // Load meshs
409: V_RETURN( LoadMesh( pd3dDevice, TEXT("t-pot.x"), &g_pObjMesh ) );
410: V_RETURN( OptimizeMesh( pd3dDevice, &g_pObjMesh ) );
411: V_RETURN( LoadMesh( pd3dDevice, TEXT("room.x"), &g_pMapMesh ) );
412: V_RETURN( OptimizeMesh( pd3dDevice, &g_pMapMesh ) );
413:
414: // Load mesh textures
415: V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, TEXT("t-pot.bmp") ) );
416: V_RETURN( D3DXCreateTextureFromFile( pd3dDevice, str, &g_pObjMeshTexture) );
417: V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, TEXT("room.bmp") ) );
418: V_RETURN( D3DXCreateTextureFromFile( pd3dDevice, str, &g_pMapMeshTexture) );
419:
420:
421: // Define DEBUG_VS and/or DEBUG_PS to debug vertex and/or pixel shaders with the
422: // shader debugger. Debugging vertex shaders requires either REF or software vertex
423: // processing, and debugging pixel shaders requires REF. The
424: // D3DXSHADER_FORCE_*_SOFTWARE_NOOPT flag improves the debug experience in the
425: // shader debugger. It enables source level debugging, prevents instruction
426: // reordering, prevents dead code elimination, and forces the compiler to compile
427: // against the next higher available software target, which ensures that the
428: // unoptimized shaders do not exceed the shader model limitations. Setting these
429: // flags will cause slower rendering since the shaders will be unoptimized and
430: // forced into software. See the DirectX documentation for more information about
431: // using the shader debugger.
432: DWORD dwShaderFlags = D3DXFX_NOT_CLONEABLE;
433: #ifdef DEBUG_VS
434: dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
435: #endif
436: #ifdef DEBUG_PS
437: dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
438: #endif
439:
440: // Read the D3DX effect file
441: // If this fails, there should be debug output as to
442: // they the .fx file failed to compile
443: V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, TEXT("main.fx") ) );
444: V_RETURN( D3DXCreateEffectFromFile( pd3dDevice, str, NULL, NULL, dwShaderFlags,
445: NULL, &g_pEffect, NULL ) );
446:
447: return S_OK;
448: }
449:
450:
451:
452: //--------------------------------------------------------------------------------------
453: // This callback function will be called immediately after the Direct3D device has
454: // been destroyed, which generally happens as a result of application termination or
455: // windowed/full screen toggles. Resources created in the OnCreateDevice callback
456: // should be released here, which generally includes all D3DPOOL_MANAGED resources.
457: //--------------------------------------------------------------------------------------
458: void CALLBACK OnDestroyDevice( void* pUserContext )
459: {
460: g_DialogResourceManager.OnDestroyDevice();
461: g_SettingsDlg.OnDestroyDevice();
462: SAFE_RELEASE(g_pEffect);
463: SAFE_RELEASE(g_pFont);
464:
465: SAFE_RELEASE(g_pMapMeshTexture);
466: SAFE_RELEASE(g_pObjMeshTexture);
467: SAFE_RELEASE(g_pMapMesh);
468: SAFE_RELEASE(g_pObjMesh);
469: }
470:
471:
472:
473: //--------------------------------------------------------------------------------------
474: // This callback function will be called immediately after the Direct3D device has been
475: // reset, which will happen after a lost device scenario. This is the best location to
476: // create D3DPOOL_DEFAULT resources since these resources need to be reloaded whenever
477: // the device is lost. Resources created here should be released in the OnLostDevice
478: // callback.
479: //--------------------------------------------------------------------------------------
480: HRESULT CALLBACK OnResetDevice( IDirect3DDevice9* pd3dDevice,
481: const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
482: {
483: HRESULT hr;
484:
485: V_RETURN( g_DialogResourceManager.OnResetDevice() );
486: V_RETURN( g_SettingsDlg.OnResetDevice() );
487:
488: if( g_pFont )
489: V_RETURN( g_pFont->OnResetDevice() );
490: if( g_pEffect )
491: V_RETURN( g_pEffect->OnResetDevice() );
492:
493: // Setup the camera with view & projection matrix
494: D3DXVECTOR3 vecEye(0.0f, 0.0f, 4.0f);
495: D3DXVECTOR3 vecAt (0.0f, 0.0f, 0.0f);
496: g_Camera.SetViewParams( &vecEye, &vecAt );
497: g_Camera.SetProjParams( D3DXToRadian(50.0f), 1.0f, Z_NEAR, Z_FAR );
498: g_Camera.SetRotateButtons( TRUE, FALSE, FALSE, FALSE );// L M R 押しながら動かす
499:
500:
501: pd3dDevice->GetViewport(&g_ViewportFB);
502:
503: // Create fullscreen renders target texture
504: g_pRT_FullScreen = CRenderTarget::Create(pd3dDevice
505: , (DWORD)ORIGINAL_WIDTH, (DWORD)ORIGINAL_HEIGHT
506: , SCREEN_FORMAT);
507: g_pRT_GaussX = CRenderTarget::Create(pd3dDevice
508: , (DWORD)ORIGINAL_WIDTH, (DWORD)ORIGINAL_HEIGHT
509: , SCREEN_FORMAT, RTF_NONE);
510: g_pRT_Blur = CRenderTarget::Create(pd3dDevice
511: , (DWORD)ORIGINAL_WIDTH, (DWORD)ORIGINAL_HEIGHT
512: , SCREEN_FORMAT, RTF_NONE);
513:
514:
515: SetupQuad( pBackBufferSurfaceDesc );
516:
517:
518: // Get D3DXHANDLEs to the parameters/techniques that are set every frame so
519: // D3DX doesn't spend time doing string compares. Doing this likely won't affect
520: // the perf of this simple sample but it should be done in complex engine.
521: g_hWorld = g_pEffect->GetParameterByName( NULL, "mWorld" );
522: g_hWorldViewProjection = g_pEffect->GetParameterByName( NULL, "mWorldViewProjection" );
523: g_hMeshTexture = g_pEffect->GetParameterByName( NULL, "MeshTexture" );
524:
525: g_hTechScene = g_pEffect->GetTechniqueByName("TechScene");
526: g_hTechFinal = g_pEffect->GetTechniqueByName("TechFinal");
527:
528: // Set the vars in the effect that doesn't change each frame
529: V_RETURN( g_pEffect->SetTexture("RenderTargetTexture", g_pRT_FullScreen->GetTexture()) );
530:
531: SetGaussRadius();
532:
533:
534: pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
535: pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
536:
537: g_HUD.SetLocation( pBackBufferSurfaceDesc->Width-170, 0 );
538: g_HUD.SetSize( 170, 170 );
539: g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width-170, pBackBufferSurfaceDesc->Height-300 );
540: g_SampleUI.SetSize( 170, 250 );
541:
542: return S_OK;
543: }
544:
545:
546: //--------------------------------------------------------------------------------------
547: // This callback function will be called immediately after the Direct3D device has
548: // entered a lost state and before IDirect3DDevice9::Reset is called. Resources created
549: // in the OnResetDevice callback should be released here, which generally includes all
550: // D3DPOOL_DEFAULT resources. See the "Lost Devices" section of the documentation for
551: // information about lost devices.
552: //--------------------------------------------------------------------------------------
553: void CALLBACK OnLostDevice( void* pUserContext )
554: {
555: g_DialogResourceManager.OnLostDevice();
556: g_SettingsDlg.OnLostDevice();
557: if( g_pFont )
558: g_pFont->OnLostDevice();
559: if( g_pEffect )
560: g_pEffect->OnLostDevice();
561: SAFE_RELEASE(g_pTextSprite);
562:
563: SAFE_RELEASE(g_pRT_Blur);
564: SAFE_RELEASE(g_pRT_GaussX);
565: SAFE_RELEASE(g_pRT_FullScreen);
566: }
567:
568:
569: //--------------------------------------------------------------------------------------
570: // Sets up a quad to render the fullscreen render target to the backbuffer
571: // so it can run a fullscreen pixel shader pass that blurs based
572: // on the depth of the objects. It set the texcoords based on the blur factor
573: //--------------------------------------------------------------------------------------
574: void SetupQuad( const D3DSURFACE_DESC* pBackBufferSurfaceDesc )
575: {
576: FLOAT fWidth5 = pBackBufferSurfaceDesc->Width -0.5f;
577: FLOAT fHeight5 = pBackBufferSurfaceDesc->Height-0.5f;
578:
579: FLOAT fTexWidth1 = 1.0f;
580: FLOAT fTexHeight1 = 1.0f;
581:
582: g_Vertex[0].pos = D3DXVECTOR4(fWidth5, -0.5f, 0.0f, 1.0f);
583: g_Vertex[0].tex1 = D3DXVECTOR2(fTexWidth1, 0.0f);
584:
585: g_Vertex[1].pos = D3DXVECTOR4(fWidth5, fHeight5, 0.0f, 1.0f);
586: g_Vertex[1].tex1 = D3DXVECTOR2(fTexWidth1, fTexHeight1);
587:
588: g_Vertex[2].pos = D3DXVECTOR4(-0.5f, -0.5f, 0.0f, 1.0f);
589: g_Vertex[2].tex1 = D3DXVECTOR2(0.0f, 0.0f);
590:
591: g_Vertex[3].pos = D3DXVECTOR4(-0.5f, fHeight5, 0.0f, 1.0f);
592: g_Vertex[3].tex1 = D3DXVECTOR2(0.0f, fTexHeight1);
593: }
594:
595: void RenderQuad(IDirect3DDevice9* pd3dDevice, D3DXHANDLE hTech)
596: {
597: HRESULT hr;
598: UINT cPasses, iPass;
599:
600: V( g_pEffect->SetTechnique(hTech) );
601:
602: V( pd3dDevice->SetFVF(VERTEX::FVF) );
603:
604: // Render the fullscreen quad on to the backbuffer
605: V( g_pEffect->Begin(&cPasses, 0) );
606: for (iPass = 0; iPass < cPasses; iPass++)
607: {
608: V( g_pEffect->BeginPass(iPass) );
609: V( pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertex, sizeof(VERTEX)) );
610: V( g_pEffect->EndPass() );
611: }
612: V( g_pEffect->End() );
613: }
614:
615: //--------------------------------------------------------------------------------------
616: // This callback function will be called once at the beginning of every frame. This is the
617: // best location for your application to handle updates to the scene, but is not
618: // intended to contain actual rendering calls, which should instead be placed in the
619: // OnFrameRender callback.
620: //--------------------------------------------------------------------------------------
621: void CALLBACK OnFrameMove( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
622: {
623: // Update the camera's position based on user input
624: g_Camera.FrameMove( fElapsedTime );
625:
626: if(!DXUTIsTimePaused())
627: {
628: if(!g_bPause)
629: {
630: g_fPhase += 2.0f * fElapsedTime;
631: if(2.0f * D3DX_PI < g_fPhase) g_fPhase -= 2.0f * D3DX_PI;
632: }
633: }
634:
635:
636: D3DXMATRIXA16 matTrans, matRot, matScale;
637: D3DXMatrixScaling(&matScale, 1.0f, 1.0f, 1.0f);
638: D3DXMatrixTranslation( &matTrans, 0.0f,+0.0f, -0.5f );
639: D3DXMatrixRotationY(&matRot, g_fPhase);
640: g_matObjWorld = matScale * matRot * matTrans;
641:
642: D3DXMatrixRotationY(&matRot, -D3DX_PI * 0.5f);
643: D3DXMatrixScaling(&matScale, 3.5f, 3.5f, 3.5f);
644: g_matMapWorld = matScale * matRot;
645: }
646:
647: // render map
648: void RenderBG(IDirect3DDevice9* pd3dDevice)
649: {
650: HRESULT hr;
651: UINT iPass, cPasses;
652: D3DXMATRIXA16 matView = *g_Camera.GetViewMatrix();
653: D3DXMATRIXA16 matProj = *g_Camera.GetProjMatrix();
654: D3DXMATRIXA16 matViewProj = matView * matProj;
655:
656: // Set world render technique
657: V( g_pEffect->SetTechnique( g_hTechScene ) );
658:
659: // Update effect vars
660: D3DXMATRIXA16 matWorldView;
661: D3DXMATRIXA16 matWorldViewProj;
662:
663: if(g_bObj)
664: {
665: matWorldView = g_matObjWorld * matView;
666: matWorldViewProj = g_matObjWorld * matViewProj;
667:
668: V( g_pEffect->SetMatrix( g_hWorld, &g_matObjWorld) );
669: V( g_pEffect->SetMatrix( g_hWorldViewProjection, &matWorldViewProj) );
670:
671: // Set the mesh texture
672: V( g_pEffect->SetTexture( g_hMeshTexture, g_pObjMeshTexture) );
673:
674: // Draw the mesh on the rendertarget
675: V( g_pEffect->Begin(&cPasses, 0) );
676: for (iPass = 0; iPass < cPasses; iPass++)
677: {
678: V( g_pEffect->BeginPass(iPass) );
679: V( g_pObjMesh->DrawSubset(0) );
680: V( g_pEffect->EndPass() );
681: }
682: V( g_pEffect->End() );
683: }
684:
685:
686: if(g_bMap)
687: {
688: matWorldView = g_matMapWorld * matView;
689: matWorldViewProj = g_matMapWorld * matViewProj;
690: V( g_pEffect->SetMatrix( g_hWorld, &g_matMapWorld) );
691: V( g_pEffect->SetMatrix( g_hWorldViewProjection, &matWorldViewProj) );
692:
693: // Set the mesh texture
694: V( g_pEffect->SetTexture( g_hMeshTexture, g_pMapMeshTexture) );
695:
696: // Draw the mesh on the rendertarget
697: V( g_pEffect->Begin(&cPasses, 0) );
698: for (iPass = 0; iPass < cPasses; iPass++)
699: {
700: V( g_pEffect->BeginPass(iPass) );
701: V( g_pMapMesh->DrawSubset(0) );
702: V( g_pEffect->EndPass() );
703: }
704: V( g_pEffect->End() );
705: }
706: }
707:
708:
709:
710: void RenderScene(IDirect3DDevice9* pd3dDevice)
711: {
712: if( SUCCEEDED( g_pRT_FullScreen->Begin(0) ) )
713: {
714: HRESULT hr;
715:
716: V( pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, g_dwBackgroundColor, 1.0f, 0) );
717:
718: RenderBG(pd3dDevice);
719:
720: g_pRT_FullScreen->End();
721: }
722: }
723:
724: void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
725: {
726: UINT iPass, cPasses;
727: HRESULT hr;
728:
729: // If the settings dialog is being shown, then
730: // render it instead of rendering the app's scene
731: if( g_SettingsDlg.IsActive() )
732: {
733: g_SettingsDlg.OnRender( fElapsedTime );
734: return;
735: }
736:
737:
738: LPDIRECT3DSURFACE9 pOriginalZbuffer = 0;
739: V( pd3dDevice->GetDepthStencilSurface( &pOriginalZbuffer ) );
740:
741: // First render the world on the rendertarget
742: RenderScene(pd3dDevice);
743:
744: if( SUCCEEDED( g_pRT_GaussX->Begin() ) )
745: {
746: static TVERTEX Vertex[4] = {
747: // x y z rhw tu tv
748: {-0.5, -0.5, 0, 1, 0, 0,},
749: {ORIGINAL_WIDTH-0.5, -0.5, 0, 1, 1, 0,},
750: {ORIGINAL_WIDTH-0.5, ORIGINAL_HEIGHT-0.5, 0, 1, 1, 1,},
751: {-0.5, ORIGINAL_HEIGHT-0.5, 0, 1, 0, 1,},
752: };
753: pd3dDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_TEX1 );
754: V( g_pEffect->SetTexture(g_hMeshTexture, g_pRT_FullScreen->GetTexture()) );
755: V( g_pEffect->SetTechnique("TechGaussX") );
756:
757: V( g_pEffect->Begin(&cPasses, 0) );
758: for (iPass = 0; iPass < cPasses; iPass++)
759: {
760: V( g_pEffect->BeginPass(iPass) );
761: pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, 2, Vertex, sizeof( TVERTEX ) );
762: V( g_pEffect->EndPass() );
763: }
764: V( g_pEffect->End() );
765:
766: g_pRT_GaussX->End();
767: }
768:
769: if( SUCCEEDED( g_pRT_Blur->Begin() ) )
770: {
771: static TVERTEX Vertex[4] = {
772: // x y z rhw tu tv
773: {-0.5, -0.5, 0, 1, 0, 0,},
774: {ORIGINAL_WIDTH-0.5, -0.5, 0, 1, 1, 0,},
775: {ORIGINAL_WIDTH-0.5, ORIGINAL_HEIGHT-0.5, 0, 1, 1, 1,},
776: {-0.5, ORIGINAL_HEIGHT-0.5, 0, 1, 0, 1,},
777: };
778: pd3dDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_TEX1 );
779: V( g_pEffect->SetTexture(g_hMeshTexture, g_pRT_GaussX->GetTexture()) );
780: V( g_pEffect->SetTechnique("TechGaussY") );
781:
782: V( g_pEffect->Begin(&cPasses, 0) );
783: for (iPass = 0; iPass < cPasses; iPass++)
784: {
785: V( g_pEffect->BeginPass(iPass) );
786: pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, 2, Vertex, sizeof( TVERTEX ) );
787: V( g_pEffect->EndPass() );
788: }
789: V( g_pEffect->End() );
790:
791: g_pRT_Blur->End();
792: }
793:
794: V( pd3dDevice->SetDepthStencilSurface( pOriginalZbuffer ) );
795: SAFE_RELEASE( pOriginalZbuffer );
796:
797: // Clear the backbuffer
798: // V( pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0L ) );
799:
800: // Begin the scene, rendering to the backbuffer
801: if( SUCCEEDED( pd3dDevice->BeginScene() ) )
802: {
803: pd3dDevice->SetViewport(&g_ViewportFB);
804:
805: V( g_pEffect->SetTexture( g_hMeshTexture, g_pRT_Blur->GetTexture()) );
806: RenderQuad(pd3dDevice, g_hTechFinal);
807:
808: #ifdef FAST_RENDERING
809: BOOL bFastRendering = true;
810: #else // FAST_RENDERING
811: BOOL bFastRendering = false;
812: #endif // FAST_RENDERING
813:
814: if(bFastRendering)
815: {
816: RenderText(true);
817: }else{
818: #if 1
819: #ifdef _DEBUG // Display textures when debugging, (デバッグ用にテクスチャを表示する)
820: {
821: pd3dDevice->SetTextureStageState(0,D3DTSS_COLOROP, D3DTOP_SELECTARG1);
822: pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE);
823: pd3dDevice->SetTextureStageState(1,D3DTSS_COLOROP, D3DTOP_DISABLE);
824: pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
825: pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
826: pd3dDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_TEX1 );
827: float scale = 64.0f;
828: LPDIRECT3DTEXTURE9 texture_tbl[] =
829: {
830: g_pRT_FullScreen->GetTexture(),
831: g_pRT_GaussX->GetTexture(),
832: g_pRT_Blur->GetTexture(),
833: NULL,
834: };
835: for(DWORD i=0; texture_tbl[i]; i++){
836: TVERTEX Vertex[4] = {
837: // x y z rhw tu tv
838: {(i+0)*scale, (FLOAT)g_ViewportFB.Height-scale, 0, 1, 0, 0,},
839: {(i+1)*scale, (FLOAT)g_ViewportFB.Height-scale, 0, 1, 1, 0,},
840: {(i+1)*scale, (FLOAT)g_ViewportFB.Height- 0, 0, 1, 1, 1,},
841: {(i+0)*scale, (FLOAT)g_ViewportFB.Height- 0, 0, 1, 0, 1,},
842: };
843: pd3dDevice->SetTexture( 0, texture_tbl[i] );
844: pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, 2, Vertex, sizeof( TVERTEX ) );
845: }
846: }
847: #endif
848: #endif
849: V( g_HUD.OnRender( fElapsedTime ) );
850: V( g_SampleUI.OnRender( fElapsedTime ) );
851:
852: // Render the text
853: RenderText(false);
854:
855: }
856:
857: // End the scene.
858: pd3dDevice->EndScene();
859: }
860: }
861:
862: //--------------------------------------------------------------------------------------
863: // Render the help and statistics text. This function uses the ID3DXFont interface for
864: // efficient text rendering.
865: //--------------------------------------------------------------------------------------
866: void RenderText(bool bFast)
867: {
868: if(bFast)
869: {
870: // なるべく負荷をかけたくないときには、
871: // FPS が更新されたときだけウィンドウのタイトルを変更するシステムにする
872: wchar_t buf[256];
873: static float s_fFPS_Last = -1.0f;
874: float fFps = DXUTGetFPS();
875: if(fFps != s_fFPS_Last)
876: {
877: swprintf_s( buf, 256, TEXT("%0.4f"), fFps );
878: SetWindowText(g_hWnd, buf );
879: s_fFPS_Last = fFps;
880: }
881:
882: return;
883: }
884:
885: // The helper object simply helps keep track of text position, and color
886: // and then it calls pFont->DrawText( g_pSprite, strMsg, -1, &rc, DT_NOCLIP, g_clr );
887: // If NULL is passed in as the sprite object, then it will work however the
888: // pFont->DrawText() will not be batched together. Batching calls will improves performance.
889: CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );
890:
891: // Output statistics
892: txtHelper.Begin();
893: txtHelper.SetInsertionPos( 5, 5 );
894: txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
895: txtHelper.DrawTextLine( DXUTGetFrameStats() );
896: txtHelper.DrawTextLine( DXUTGetDeviceStats() );
897:
898: txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
899: txtHelper.DrawFormattedTextLine( L"FPS: %0.4f", DXUTGetFPS() );
900:
901: #if 0
902: // Draw help
903: if( g_bShowHelp )
904: {
905: const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetBackBufferSurfaceDesc();
906: txtHelper.SetInsertionPos( 2, pd3dsdBackBuffer->Height-15*6 );
907: txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.75f, 0.0f, 1.0f ) );
908: txtHelper.DrawTextLine( L"Controls (F1 to hide):" );
909:
910: txtHelper.SetInsertionPos( 20, pd3dsdBackBuffer->Height-15*5 );
911: txtHelper.DrawTextLine( L"Look: Left drag mouse\n"
912: L"Move: A,W,S,D or Arrow Keys\n"
913: L"Move up/down: Q,E or PgUp,PgDn\n"
914: L"Reset camera: Home\n" );
915: }
916: else
917: {
918: txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
919: txtHelper.DrawTextLine( L"Press F1 for help" );
920: }
921: #endif
922: txtHelper.End();
923: }
924:
925:
926: //--------------------------------------------------------------------------------------
927: // Before handling window messages, DXUT passes incoming windows
928: // messages to the application through this callback function. If the application sets
929: // *pbNoFurtherProcessing to TRUE, then DXUT will not process this message.
930: //--------------------------------------------------------------------------------------
931: LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext )
932: {
933: g_hWnd = hWnd;
934:
935: // Always allow dialog resource manager calls to handle global messages
936: // so GUI state is updated correctly
937: *pbNoFurtherProcessing = g_DialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam );
938: if( *pbNoFurtherProcessing )
939: return 0;
940:
941: if( g_SettingsDlg.IsActive() )
942: {
943: g_SettingsDlg.MsgProc( hWnd, uMsg, wParam, lParam );
944: return 0;
945: }
946:
947: // Give the dialogs a chance to handle the message first
948: *pbNoFurtherProcessing = g_HUD.MsgProc( hWnd, uMsg, wParam, lParam );
949: if( *pbNoFurtherProcessing )
950: return 0;
951: *pbNoFurtherProcessing = g_SampleUI.MsgProc( hWnd, uMsg, wParam, lParam );
952: if( *pbNoFurtherProcessing )
953: return 0;
954:
955: // Pass all remaining windows messages to camera so it can respond to user input
956: g_Camera.HandleMessages( hWnd, uMsg, wParam, lParam );
957:
958: return 0;
959: }
960:
961:
962: //--------------------------------------------------------------------------------------
963: // As a convenience, DXUT inspects the incoming windows messages for
964: // keystroke messages and decodes the message parameters to pass relevant keyboard
965: // messages to the application. The framework does not remove the underlying keystroke
966: // messages, which are still passed to the application's MsgProc callback.
967: //--------------------------------------------------------------------------------------
968: void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext )
969: {
970: if( bKeyDown )
971: {
972: switch( nChar )
973: {
974: case VK_F1: g_bShowHelp = !g_bShowHelp; break;
975: }
976: }
977: }
978:
979:
980: //--------------------------------------------------------------------------------------
981: // Handles the GUI events
982: //--------------------------------------------------------------------------------------
983: void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
984: {
985: switch( nControlID )
986: {
987: case IDC_TOGGLEFULLSCREEN: DXUTToggleFullScreen(); break;
988: case IDC_TOGGLEREF: DXUTToggleREF(); break;
989: case IDC_CHANGEDEVICE: g_SettingsDlg.SetActive( !g_SettingsDlg.IsActive() ); break;
990:
991: case IDC_PAUSE:
992: g_bPause = g_SampleUI.GetCheckBox( IDC_PAUSE )->GetChecked();
993: break;
994:
995: case IDC_RADIUS_L: {
996: g_fRadiusL = 0.01f*(float) (g_SampleUI.GetSlider( IDC_RADIUS_L )->GetValue());
997:
998: WCHAR sz[100];
999: StringCchPrintf( sz, 100, L"Radius(Lum): %0.2f", g_fRadiusL );
1000: g_SampleUI.GetStatic( IDC_RADIUS_L_STATIC )->SetText( sz );
1001: SetGaussRadius();
1002: }break;
1003:
1004: case IDC_RADIUS_X: {
1005: g_fRadiusX = 0.01f*(float) (g_SampleUI.GetSlider( IDC_RADIUS_X )->GetValue());
1006:
1007: WCHAR sz[100];
1008: StringCchPrintf( sz, 100, L"Radius(x): %0.2f", g_fRadiusX );
1009: g_SampleUI.GetStatic( IDC_RADIUS_X_STATIC )->SetText( sz );
1010: SetGaussRadius();
1011: }break;
1012:
1013: default:
1014: break;
1015: }
1016: }
1017:
1018: