void ResizeWindowDX9(int width, int height) { // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // Reset Device GutResetGraphicsDeviceDX9(); // 設定視角轉換矩陣 int w, h; GutGetWindowSize(w, h); float aspect = (float) h / (float) w; Matrix4x4 projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &projection_matrix); // 關閉打光 device->SetRenderState(D3DRS_LIGHTING, FALSE); // 畫出正向跟反向的三角形 device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // trilinear device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); // trilinear device->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); }
void ResizeWindowDX9(int width, int height) { // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 ReInitResourceDX9(); }
void ResizeWindowDX9(int width, int height) { // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // 投影矩陣, 重設水平跟垂直方向的視角. float aspect = (float) height / (float) width; g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); // 關閉打光 device->SetRenderState(D3DRS_LIGHTING, FALSE); // 改變三角形正面的面向 //device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // 使用自動normalize功能 device->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); device->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_NONE); }
void ResizeWindowDX9(int width, int height) { GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // 投影矩陣, 重設水平跟垂直方向的視角. float aspect = (float) height / (float) width; g_fOrthoWidth = g_fOrthoSize; g_fOrthoHeight = g_fOrthoSize; if ( aspect > 1.0f ) g_fOrthoHeight *= aspect; else g_fOrthoWidth /= aspect; g_projection_matrix = GutMatrixOrthoRH_DirectX(g_fOrthoWidth, g_fOrthoHeight, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); // 計算出一個可以轉換到鏡頭座標系的矩陣 //device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &view_matrix); // 關閉打光 device->SetRenderState(D3DRS_LIGHTING, FALSE); // 畫出正向跟反向的三角形 device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // trilinear device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); // trilinear device->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); device->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); }
void ResizeWindowDX9(int width, int height) { GutResetGraphicsDeviceDX9(); // `投影矩陣, 重設水平跟垂直方向的視角.` float aspect = (float) height / (float) width; g_proj_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, 0.1f, 100.0f); g_view_proj_matrix = g_view_matrix * g_proj_matrix; // `取得Direct3D9裝置` LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // `畫出正向跟反向的三角形` device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); }
void ResizeWindowDX9(int width, int height) { // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // Reset Device GutResetGraphicsDeviceDX9(); // 設定視角轉換矩陣 int w, h; GutGetWindowSize(w, h); float aspect = (float) h / (float) w; g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); }
void ResizeWindowDX9(int width, int height) { for ( int i=0; i<NUM_FRAMEBUFFERS; i++ ) { SAFE_RELEASE(g_pFrameSurface[i]); SAFE_RELEASE(g_pFrameBuffer[i]); } // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D9裝置 ReInitResourceDX9(); }
void ResizeWindowDX9(int width, int height) { // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // 投影矩陣, 重設水平跟垂直方向的視角. float aspect = (float) height / (float) width; g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); InitStateDX9(); }
void ResizeWindowDX9(int width, int height) { // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // `投影矩陣, 重設水平跟垂直方向的視角.` float aspect = (float) height / (float) width; g_projection_matrix = GutMatrixPerspectiveRH_DirectX(90.0f, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); // `關閉打光` device->SetRenderState(D3DRS_LIGHTING, FALSE); // `改變三角形正面的面向` device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); }
void ResizeWindowDX9(int width, int height) { GutResetGraphicsDeviceDX9(); // 投影矩陣, 重設水平跟垂直方向的視角. float aspect = (float) height / (float) width; Matrix4x4 projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, 0.1f, 100.0f); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &projection_matrix); // 計算出一個可以轉換到鏡頭座標系的矩陣 Matrix4x4 view_matrix = GutMatrixLookAtRH(g_eye, g_lookat, g_up); device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &view_matrix); // 畫出正向跟反向的三角形 device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); }
void ResizeWindowDX9(int width, int height) { for ( int i=0; i<TEX_TEXTURES; i++ ) { SAFE_RELEASE(g_pSurfaces[i]); SAFE_RELEASE(g_pTextures[i]); } SAFE_RELEASE(g_pMainFramebuffer); SAFE_RELEASE(g_pMainDepthbuffer); GutResetGraphicsDeviceDX9(); ReInitResourceDX9(); }
void ResizeWindowDX9(int width, int height) { SAFE_RELEASE(g_pFrameBuffer); SAFE_RELEASE(g_pMainFrameBuffer); SAFE_RELEASE(g_pMainDepthBuffer); SAFE_RELEASE(g_pDepthStencil); SAFE_RELEASE(g_pTexture); // Reset Device GutResetGraphicsDeviceDX9(); // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); InitStateDX9(); }
void ResizeWindowDX9(int width, int height) { // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // Reset Device GutResetGraphicsDeviceDX9(); // 設定視角轉換矩陣 int w, h; GutGetWindowSize(w, h); float aspect = (float) h / (float) w; Matrix4x4 projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, 0.1f, 100.0f); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &projection_matrix); // 鏡頭座標系的轉換矩陣 Matrix4x4 view_matrix = GutMatrixLookAtRH(g_eye, g_lookat, g_up); device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &view_matrix); // 關閉打光 device->SetRenderState(D3DRS_LIGHTING, FALSE); // 畫出正向跟反向的三角形 device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); }
void ResizeWindowDX9(int width, int height) { // 取得Direct3D 9裝置 LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9(); // Reset Device GutResetGraphicsDeviceDX9(); // 設定視角轉換矩陣 int w, h; GutGetWindowSize(w, h); float aspect = (float) h / (float) w; g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFovW, aspect, g_fNear, g_fFar); device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix); device->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); device->SetRenderState(D3DRS_SPECULARENABLE, TRUE); device->SetRenderState(D3DRS_COLORVERTEX, FALSE); device->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL); device->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL); device->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL); device->SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL); }