亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? multitexture.cpp

?? 3d 游戲編程入門教程之例子源碼--飛機(jī)繞茶壺
?? CPP
?? 第 1 頁 / 共 3 頁
字號(hào):
                                                  D3DPOOL_MANAGED, &m_pCubeVB, NULL ) ) )
        return E_FAIL;

    VOID* tmpVertices;
    if( FAILED( m_pCubeVB->Lock( 0, m_dwSizeofCubeVertices, (VOID**)&tmpVertices, 0 ) ) )
        return E_FAIL;
    memcpy( tmpVertices, m_pCubeVertices, m_dwSizeofCubeVertices);
    m_pCubeVB->Unlock();

	m_dwSizeofCubeIndices = sizeof(m_pCubeIndices);

	// Create the index buffer
	if( FAILED( m_pd3dDevice->CreateIndexBuffer( m_dwSizeofCubeIndices,
	                                             0, D3DFMT_INDEX16,
		                                         D3DPOOL_MANAGED, &m_pCubeIB, NULL ) ) )
		return E_FAIL;

	VOID* tmpIndices;
	if( FAILED( m_pCubeIB->Lock( 0, m_dwSizeofCubeIndices, (VOID**)&tmpIndices, 0 ) ) )
	   return E_FAIL;
	memcpy( tmpIndices, m_pCubeIndices, sizeof(m_pCubeIndices) );
	m_pCubeIB->Unlock();

  
    return S_OK;
}

//-----------------------------------------------------------------------------
// Name: InvalidateDeviceObjects()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CMyD3DApplication::InvalidateDeviceObjects()
{
    m_pFont->InvalidateDeviceObjects();
    m_pFontSmall->InvalidateDeviceObjects();

    SAFE_RELEASE( m_pCubeVB );
    SAFE_RELEASE( m_pCubeIB );
    SAFE_RELEASE( m_pVB );

	return S_OK;
}

//-----------------------------------------------------------------------------
// Name: DeleteDeviceObjects()
// Desc: Called when the app is exiting, or the device is being changed,
//       this function deletes any device dependent objects.
//-----------------------------------------------------------------------------
HRESULT CMyD3DApplication::DeleteDeviceObjects()
{
    m_pFont->DeleteDeviceObjects();
    m_pFontSmall->DeleteDeviceObjects();

    SAFE_RELEASE( m_pBackgroundTexture );
    SAFE_RELEASE( m_pWallTexture );
    SAFE_RELEASE( m_pEnvTexture );
    SAFE_RELEASE( m_pDetailTexture );

	return S_OK;
}

//-----------------------------------------------------------------------------
// Name: FinalCleanup()
// Desc: Called before the app exits, this function gives the app the chance
//       to cleanup after itself.
//-----------------------------------------------------------------------------
HRESULT CMyD3DApplication::FinalCleanup()
{
    SAFE_DELETE( m_pFont );
    SAFE_DELETE( m_pFontSmall );

    return S_OK;
}

//-----------------------------------------------------------------------------
// Name: ConfirmDevice()
// Desc: Called during device initialization, this code checks the device
//       for some minimum set of capabilities
//-----------------------------------------------------------------------------
HRESULT CMyD3DApplication::ConfirmDevice( D3DCAPS9* pCaps, DWORD dwBehavior,
                                          D3DFORMAT adapterFormat, D3DFORMAT backBufferFormat )
{
    if( (0 == ( pCaps->DestBlendCaps & D3DPBLENDCAPS_INVSRCCOLOR)) &&  // alpha blending
		(0 == ( pCaps->SrcBlendCaps & D3DPBLENDCAPS_SRCCOLOR)) &&
		(0 == ( pCaps->TextureOpCaps & D3DTEXOPCAPS_ADDSIGNED )) &&   // texture blending
		(0 == ( pCaps->TextureOpCaps & D3DTEXOPCAPS_MODULATE )) &&
		(0 == ( pCaps->TextureOpCaps & D3DTEXOPCAPS_MODULATE2X)) &&
		(0 == ( pCaps->TextureOpCaps & D3DTEXOPCAPS_MODULATE4X)) &&
		(0 == ( pCaps->TextureOpCaps & D3DTEXOPCAPS_ADD )) &&
		(0 == ( pCaps->TextureAddressCaps & D3DPTADDRESSCAPS_CLAMP)) &&		// texture addressing
		(0 == ( pCaps->TextureAddressCaps & D3DPTADDRESSCAPS_BORDER )) &&
		(0 == ( pCaps->TextureAddressCaps & D3DPTADDRESSCAPS_MIRRORONCE)))
        return E_FAIL;

    if( pCaps->MaxSimultaneousTextures < 2 )
        return E_FAIL;


    return S_OK;
}

//-----------------------------------------------------------------------------
// Name: CreateCube()
// Desc: Sets up the vertices for a cube.
//-----------------------------------------------------------------------------
HRESULT CMyD3DApplication::CreateCube( CUBEVERTEX* pVertices, WORD* pIndices )
{

    D3DXVECTOR3 p1 = D3DXVECTOR3(-1.0f, 1.0f,-1.0f);
    D3DXVECTOR3 p2 = D3DXVECTOR3( 1.0f, 1.0f,-1.0f);
    D3DXVECTOR3 p3 = D3DXVECTOR3( 1.0f,-1.0f,-1.0f);
    D3DXVECTOR3 p4 = D3DXVECTOR3(-1.0f,-1.0f,-1.0f);
    D3DXVECTOR3 p5 = D3DXVECTOR3(-1.0f, 1.0f, 1.0f);
    D3DXVECTOR3 p6 = D3DXVECTOR3(-1.0f,-1.0f, 1.0f);
    D3DXVECTOR3 p7 = D3DXVECTOR3( 1.0f,-1.0f, 1.0f);
    D3DXVECTOR3 p8 = D3DXVECTOR3( 1.0f, 1.0f, 1.0f);

    // Define the normals for the cube
    D3DXVECTOR3 n0( 0.0f, 0.0f,-1.0f ); // Front face
    D3DXVECTOR3 n1( 0.0f, 0.0f, 1.0f ); // Back face
    D3DXVECTOR3 n2( 0.0f, 1.0f, 0.0f ); // Bottom face
    D3DXVECTOR3 n3( 0.0f,-1.0f, 0.0f ); // Top face
    D3DXVECTOR3 n4( 1.0f, 0.0f, 0.0f ); // Left face
    D3DXVECTOR3 n5(-1.0f, 0.0f, 0.0f ); // Right face

    // Set up the vertices for the cube. Note: to prevent tiling problems,
    // the u/v coords are knocked slightly inwards.

    // Front face
    FILL_CUBEVERTEX( pVertices[0], p1, n0, 0.01f, 0.01f );
    FILL_CUBEVERTEX( pVertices[1], p2, n0, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[2], p3, n0, 0.99f, 0.99f );
    FILL_CUBEVERTEX( pVertices[3], p4, n0, 0.01f, 0.99f );

    // Back face
    FILL_CUBEVERTEX( pVertices[4], p5, n1, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[5], p6, n1, 0.99f, 0.99f );
    FILL_CUBEVERTEX( pVertices[6], p7, n1, 0.01f, 0.99f );
    FILL_CUBEVERTEX( pVertices[7], p8, n1, 0.01f, 0.01f );

    // Top face
    FILL_CUBEVERTEX( pVertices[8], p5, n2, 0.01f, 0.01f );
    FILL_CUBEVERTEX( pVertices[9], p8, n2, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[10], p2, n2, 0.99f, 0.99f );
    FILL_CUBEVERTEX( pVertices[11], p1, n2, 0.01f, 0.99f );

    // Bottom face
    FILL_CUBEVERTEX( pVertices[12], p6, n3, 0.01f, 0.99f );
    FILL_CUBEVERTEX( pVertices[13], p4, n3, 0.01f, 0.01f );
    FILL_CUBEVERTEX( pVertices[14], p3, n3, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[15], p7, n3, 0.99f, 0.99f );

    // Left face
    FILL_CUBEVERTEX( pVertices[16], p2, n4, 0.01f, 0.01f );
    FILL_CUBEVERTEX( pVertices[17], p8, n4, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[18], p7, n4, 0.99f, 0.99f );
    FILL_CUBEVERTEX( pVertices[19], p3, n4, 0.01f, 0.99f );

    // Right face
    FILL_CUBEVERTEX( pVertices[20], p1, n5, 0.99f, 0.01f );
    FILL_CUBEVERTEX( pVertices[21], p4, n5, 0.99f, 0.99f );
    FILL_CUBEVERTEX( pVertices[22], p6, n5, 0.01f, 0.99f );
    FILL_CUBEVERTEX( pVertices[23], p5, n5, 0.01f, 0.01f );


    // Set up the indices for the cube
    *pIndices++ =  0+0;   *pIndices++ =  0+1;   *pIndices++ =  0+2;
    *pIndices++ =  0+2;   *pIndices++ =  0+3;   *pIndices++ =  0+0;
    *pIndices++ =  4+0;   *pIndices++ =  4+1;   *pIndices++ =  4+2;
    *pIndices++ =  4+2;   *pIndices++ =  4+3;   *pIndices++ =  4+0;
    *pIndices++ =  8+0;   *pIndices++ =  8+1;   *pIndices++ =  8+2;
    *pIndices++ =  8+2;   *pIndices++ =  8+3;   *pIndices++ =  8+0;
    *pIndices++ = 12+0;   *pIndices++ = 12+1;   *pIndices++ = 12+2;
    *pIndices++ = 12+2;   *pIndices++ = 12+3;   *pIndices++ = 12+0;
    *pIndices++ = 16+0;   *pIndices++ = 16+1;   *pIndices++ = 16+2;
    *pIndices++ = 16+2;   *pIndices++ = 16+3;   *pIndices++ = 16+0;
    *pIndices++ = 20+0;   *pIndices++ = 20+1;   *pIndices++ = 20+2;
    *pIndices++ = 20+2;   *pIndices++ = 20+3;   *pIndices++ = 20+0;

   return S_OK;
}

//----------------------------------------------------------------------------
// Name: MsgProc()
// Desc: App custom WndProc function for handling mouse and keyboard input.
//----------------------------------------------------------------------------
LRESULT CMyD3DApplication::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                                    LPARAM lParam )
{
    // Perform commands when keys are rleased
    if( WM_KEYUP == uMsg )
    {
		HMENU hMenu = GetMenu(m_hWnd);

        switch( wParam )
        {
            case VK_F5:
                m_bFil1 = TRUE;
				m_bFil2 = FALSE;
                return 1;

            case VK_F6:
                m_bFil2 = TRUE;
				m_bFil1 = FALSE;
                return 1;

            case VK_F9:
                m_bAdd1 = TRUE;
				m_bAdd2 = m_bAdd3 = FALSE;
                return 1;

            case VK_F11:
                m_bAdd2 = TRUE;
				m_bAdd1 = m_bAdd3 = FALSE;
                return 1;

            case VK_F12:
                m_bAdd3 = TRUE;
				m_bAdd1 = m_bAdd2 = FALSE;
                return 1;

            case VK_F1:
                m_bDrawHelp = !m_bDrawHelp;
                return 1;

			case '1':
					m_bTex1 = TRUE; 
					m_bTex2 = m_bTex3 = m_bTex4 = m_bTex5 = m_bTex6 = m_bTex7 = m_bTex8 =FALSE;
					SetLights();
				return 1;

			case '2':
					m_bTex2 = TRUE; 
					m_bTex1 = m_bTex3 = m_bTex4 = m_bTex5 = m_bTex6 = m_bTex7 = m_bTex8 =FALSE;
					SetLights();
				return 1;

            case '3':   
					m_bTex3 = TRUE; 
					m_bTex2 = m_bTex1 = m_bTex4 = m_bTex5 = m_bTex6 = m_bTex7 = m_bTex8 =FALSE;
					SetLights();
				return 1;

            case '4':   
					m_bTex4 = TRUE;
					m_bTex2 = m_bTex3 = m_bTex1 = m_bTex5 = m_bTex6 = m_bTex7 = m_bTex8 =FALSE;
					SetLights();
			    return 1;

            case '5':
					m_bTex5 = TRUE; 
					m_bTex2 = m_bTex3 = m_bTex4 = m_bTex1 = m_bTex6 = m_bTex7 = m_bTex8 =FALSE;
					SetLights();
				return 1;

            case '6':   
					m_bTex6 = TRUE; 
					m_bTex2 = m_bTex3 = m_bTex4 = m_bTex5 = m_bTex1 = m_bTex7 = m_bTex8 = FALSE;
					SetLights();
				return 1;

            case '7':   
					m_bTex7 = TRUE; 
					m_bTex2 = m_bTex3 = m_bTex4 = m_bTex5 = m_bTex6 = m_bTex1 = m_bTex8 = FALSE;
					SetLights();
				return 1;

            case '8':   
					m_bTex8 = TRUE; 
					m_bTex2 = m_bTex3 = m_bTex4 = m_bTex5 = m_bTex6 = m_bTex7 = m_bTex1 = FALSE;
					SetLights();
				return 1;
		}
	}

    // Fall through to the app's main windows proc function
    return CD3DApplication::MsgProc( hWnd, uMsg, wParam, lParam );
}

HRESULT CMyD3DApplication::SetLights()
{
	if (m_bTex3 == TRUE || m_bTex4 == TRUE)
	{
	    m_pd3dDevice->SetRenderState(D3DRS_AMBIENT, 0);

		D3DLIGHT9 light;
		D3DUtil_InitLight( light, D3DLIGHT_DIRECTIONAL, 0.0f, -5.0f, -5.0f );
		m_pd3dDevice->SetLight( 0, &light );
		m_pd3dDevice->LightEnable( 0, TRUE );
	}
	else if (m_bTex7 == TRUE)
	{
		m_pd3dDevice->LightEnable( 0, FALSE);

		// Set the ambient light.
		m_pd3dDevice->SetRenderState(D3DRS_AMBIENT, 0x00aaffaa);
	}
  return S_OK;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
波多野结衣精品在线| 欧美优质美女网站| 一区二区在线免费| 精品国产制服丝袜高跟| 日韩欧美一区在线| 99久久免费国产| 日韩国产欧美一区二区三区| 国产精品盗摄一区二区三区| 欧美一级久久久久久久大片| www.综合网.com| 免费在线看成人av| 亚洲精品写真福利| 国产亚洲欧美在线| 日韩欧美一区中文| 欧美美女视频在线观看| 色婷婷久久久亚洲一区二区三区 | 国产成人综合网| 日韩高清在线一区| 一区二区三区高清| 中文字幕中文乱码欧美一区二区| 欧美xxxxx牲另类人与| 欧美日韩国产一级片| 91美女片黄在线观看| 成人黄色一级视频| 国产福利一区二区三区| 美国十次了思思久久精品导航| 亚洲福利一二三区| 亚洲综合一区二区三区| 最近日韩中文字幕| 中国色在线观看另类| 久久久久国产精品厨房| 久久综合狠狠综合久久综合88 | www国产亚洲精品久久麻豆| 欧美巨大另类极品videosbest| 欧美自拍偷拍一区| 色悠久久久久综合欧美99| 成人a级免费电影| 国产精品123| 成人综合婷婷国产精品久久免费| 国产经典欧美精品| 成人午夜视频福利| 成人黄色免费短视频| 99精品在线免费| 99re视频这里只有精品| 91亚洲资源网| 色丁香久综合在线久综合在线观看| 91猫先生在线| 色婷婷亚洲婷婷| 欧美日韩高清影院| 日韩欧美一区二区久久婷婷| 精品国产精品网麻豆系列| 久久综合九色综合久久久精品综合| 日韩精品一区二区三区老鸭窝 | 中文字幕成人在线观看| 国产精品久久久久久久久久免费看| 亚洲欧洲韩国日本视频| 亚洲美女视频在线| 亚洲综合精品久久| 蜜臀av亚洲一区中文字幕| 韩国理伦片一区二区三区在线播放| 国产麻豆视频一区| 99国产精品一区| 欧美日韩国产综合久久| 日韩精品一区二区三区在线观看| 久久久久久一二三区| 国产精品久久久久久久久果冻传媒| 亚洲伦理在线免费看| 亚洲线精品一区二区三区| 久久精品国产亚洲aⅴ| 豆国产96在线|亚洲| 欧美在线制服丝袜| 精品久久久久99| 中文字幕一区av| 午夜a成v人精品| 极品少妇xxxx偷拍精品少妇| 成人黄色电影在线| 欧美日韩高清一区| 香蕉影视欧美成人| 蜜桃av一区二区在线观看| 丁香婷婷综合五月| 精品1区2区3区| 26uuu亚洲| 亚洲综合一区二区精品导航| 九九精品视频在线看| 91社区在线播放| 精品美女在线观看| 一区二区三区久久| 国产一区二区三区美女| 日本电影欧美片| 久久亚洲二区三区| 亚洲va在线va天堂| 懂色av噜噜一区二区三区av| 欧美日韩午夜在线| 日本一区二区三区四区| 天天色综合天天| 成人99免费视频| 日韩亚洲欧美高清| 亚洲尤物视频在线| 丁香婷婷综合网| 日韩免费看的电影| 亚洲国产日日夜夜| 99riav久久精品riav| 亚洲精品一区二区三区四区高清 | 一区二区三区视频在线看| 久草精品在线观看| 欧美日韩国产另类一区| 国产精品久久久久影院| 极品少妇一区二区三区精品视频 | 欧美性猛片xxxx免费看久爱| 中文在线资源观看网站视频免费不卡| 日本91福利区| 欧美亚洲国产一区二区三区| 国产精品嫩草久久久久| 精品无人码麻豆乱码1区2区| 欧美嫩在线观看| 亚洲激情六月丁香| 成人看片黄a免费看在线| 国产亚洲视频系列| 国内精品国产三级国产a久久| 91精选在线观看| 亚洲一区二区三区四区五区中文| 成人黄色在线看| 欧美激情一区不卡| 国产高清成人在线| 久久精品一区二区三区av| 精品无码三级在线观看视频| 欧美大片在线观看一区二区| 天堂一区二区在线| 欧美日韩不卡一区| 亚洲黄色小视频| 日本韩国视频一区二区| 亚洲欧美另类久久久精品| 99视频一区二区三区| 国产精品国产自产拍高清av王其| 国产91精品免费| 国产欧美中文在线| 国产高清不卡二三区| 国产精品天天看| k8久久久一区二区三区| 国产精品家庭影院| 91女厕偷拍女厕偷拍高清| 亚洲色欲色欲www| 色偷偷成人一区二区三区91| 一级女性全黄久久生活片免费| 91国产精品成人| 亚洲成人在线网站| 欧美一级片在线| 久久精品国产秦先生| 久久久久成人黄色影片| 成人美女在线视频| 裸体一区二区三区| 久久久国际精品| k8久久久一区二区三区| 一区二区三区免费网站| 欧美日韩免费观看一区三区| 日本亚洲一区二区| 久久综合视频网| 懂色av中文字幕一区二区三区| ...av二区三区久久精品| 欧美午夜精品一区| 美女网站色91| 国产精品午夜在线观看| 91成人在线免费观看| 免费人成网站在线观看欧美高清| 精品日韩在线一区| av高清久久久| 亚洲高清免费观看| 精品久久久影院| 成人高清视频免费观看| 亚洲自拍偷拍九九九| 精品日韩欧美在线| 99久久综合国产精品| 日韩国产高清影视| 国产精品视频观看| 欧美三级韩国三级日本三斤| 久久99国产精品麻豆| 中文字幕亚洲区| 91精品欧美综合在线观看最新| 国产91精品入口| 五月综合激情日本mⅴ| 国产欧美精品一区二区色综合| 欧美性生活久久| 国产999精品久久| 香蕉成人伊视频在线观看| 久久久久国产成人精品亚洲午夜 | 国产婷婷色一区二区三区 | 国产色综合久久| 欧美在线色视频| 国产精品1024| 日韩电影一二三区| 国产女主播在线一区二区| 欧美日韩精品一区二区| 成人精品小蝌蚪| 免费亚洲电影在线| 一级做a爱片久久| 欧美激情中文字幕一区二区| 日韩一区二区三区视频| 99久久综合精品| 国产福利不卡视频| 日本特黄久久久高潮|