本文整理汇总了C++中CGutModel_DX9::ConvertToDX9Model方法的典型用法代码示例。如果您正苦于以下问题:C++ CGutModel_DX9::ConvertToDX9Model方法的具体用法?C++ CGutModel_DX9::ConvertToDX9Model怎么用?C++ CGutModel_DX9::ConvertToDX9Model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGutModel_DX9
的用法示例。
在下文中一共展示了CGutModel_DX9::ConvertToDX9Model方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, 1.0f, 0.1f, 100.0f);
InitStateDX9();
CGutModel::SetTexturePath("../../textures/");
g_Model_DX9.ConvertToDX9Model(&g_Model);
g_SpotLightModel_DX9.ConvertToDX9Model(&g_SpotLightModel);
g_material_stencilpass.m_bCullFace = false;
g_material_spotlightpass.m_bBlend = true;
g_material_spotlightpass.m_SrcBlend = D3DBLEND_ONE;
g_material_spotlightpass.m_DestBlend = D3DBLEND_ONE;
g_material_spotlightpass.m_Material.Diffuse.r =
g_material_spotlightpass.m_Material.Diffuse.g =
g_material_spotlightpass.m_Material.Diffuse.b =
g_material_spotlightpass.m_Material.Diffuse.a = 0.3f;
return true;
}
示例2: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, 1.0f, 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->CreateTexture(g_framebuffer_w, g_framebuffer_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_pTexture, NULL);
device->CreateDepthStencilSurface(g_framebuffer_w, g_framebuffer_h, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &g_pDepthStencil, NULL);
device->CreateTexture(g_framebuffer_w, g_framebuffer_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_pBlurTextures[0], NULL);
device->CreateTexture(g_framebuffer_w, g_framebuffer_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_pBlurTextures[1], NULL);
}
// 載入模型
{
CGutModel::SetTexturePath("../../textures/");
g_Model_DX9.ConvertToDX9Model(&g_Model);
g_Terrain_DX9.ConvertToDX9Model(&g_Terrain);
}
// 設定貼圖內插方法
{
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
device->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
device->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
device->SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
}
return true;
}
示例3: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
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);
// 畫出正向跟反向的三角形
device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
CGutModel::SetTexturePath("../../textures/");
for ( int t=0; t<MAX_NUM_TEXTURES; t++ )
{
// trilinear filter
device->SetSamplerState(t, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(t, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(t, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
}
g_Model_DX9.ConvertToDX9Model(&g_Model);
return true;
}
示例4: InitResourceDX9
bool InitResourceDX9(void)
{
g_orient_matrix.Identity();
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
if ( !ReInitResourceDX9() )
return false;
g_pPostEffect = GutLoadFXShaderDX9("../../shaders/Posteffect.fx");
if ( NULL==g_pPostEffect )
return false;
g_pWaterEffect = GutLoadFXShaderDX9("../../shaders/Watereffect.fx");
if ( NULL==g_pWaterEffect )
return false;
g_pWaterTexture = GutLoadTexture_DX9("../../textures/lena.tga");
if ( NULL==g_pWaterTexture )
return false;
g_Model_DX9.ConvertToDX9Model(&g_Model);
return true;
}
示例5: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
g_projection_matrix = GutMatrixPerspectiveRH_DirectX(g_fFOV, 1.0f, 0.1f, 100.0f);
InitStateDX9();
CGutModel::SetTexturePath("../../textures/");
g_Model_DX9.ConvertToDX9Model(&g_Model_textured);
return true;
}
示例6: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
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);
// 載入貼圖
const char *texture_array[] = {
"../../textures/uffizi_right.tga",
"../../textures/uffizi_left.tga",
"../../textures/uffizi_top.tga",
"../../textures/uffizi_bottom.tga",
"../../textures/uffizi_back.tga", // `右手座標系上 Z+ 為鏡頭後方.`
"../../textures/uffizi_front.tga" // `右手座標系上 Z- 為鏡頭前方.`
};
g_pTexture = GutLoadCubemapTexture_DX9(texture_array);
if ( g_pTexture==NULL )
{
// 有些舊硬體不支援 mipmapped cubemap , 改載入 dds 的版本.
g_pTexture = GutLoadCubemapTexture_DX9("../../textures/uffizi_cubemap.dds");
if ( g_pTexture==NULL )
return false;
}
if ( !g_Model_DX9.ConvertToDX9Model(&g_Model) )
return false;
return true;
}
示例7: InitResourceDX9
bool InitResourceDX9(void)
{
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
CGutModel::SetTexturePath("../../textures/");
g_pTexture = GutLoadTexture_DX9("../../textures/lena.tga", &g_ImageInfo);
g_pEffect = GutLoadFXShaderDX9("../../shaders/Posteffect.fx");
if ( NULL==g_pEffect )
return false;
g_pRefractionFX = GutLoadFXShaderDX9("../../shaders/Refraction.fx");
if ( NULL==g_pRefractionFX )
return false;
g_Model_DX9.ConvertToDX9Model(&g_Model);
if ( !ReInitResourceDX9() )
return false;
return true;
}
示例8: InitResourceDX9
bool InitResourceDX9(void)
{
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
for ( int i=0; i<NUM_FRAMEBUFFERS; i++ )
{
g_pFrameBuffer[i] = NULL;
g_pFrameSurface[i] = NULL;
}
CGutModel::SetTexturePath("../../textures/");
if ( !g_Model_DX9.ConvertToDX9Model(&g_Model) )
return false;
g_pEffect = GutLoadFXShaderDX9("../../shaders/Posteffect.fx");
if ( NULL==g_pEffect )
return false;
g_pAddImageShader = g_pEffect->GetTechniqueByName("DrawImage");
g_pBlurShader = g_pEffect->GetTechniqueByName("BlurImage");
g_pBrightnessShader = g_pEffect->GetTechniqueByName("Brightness");
if ( NULL==g_pAddImageShader || NULL==g_pBlurShader ||
NULL==g_pBrightnessShader )
return false;
g_pExposureEffect = GutLoadFXShaderDX9("../../shaders/Exposure.fx");
if ( NULL==g_pExposureEffect )
return false;
if ( !ReInitResourceDX9() )
return false;
return true;
}
示例9: InitResourceDX9
bool InitResourceDX9(void)
{
// 取得Direct3D 9裝置
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 設定視角轉換矩陣
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);
for ( int t=0; t<MAX_NUM_TEXTURES; t++ )
{
// trilinear filter
device->SetSamplerState(t, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(t, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(t, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
}
g_Model_DX9.ConvertToDX9Model(&g_Model);
//g_Model_DX9.SetCullMode(D3DCULL_NONE);
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);
device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
//device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
return true;
}