本文整理汇总了C++中CTexture::Get_Handle方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::Get_Handle方法的具体用法?C++ CTexture::Get_Handle怎么用?C++ CTexture::Get_Handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::Get_Handle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CSprite::Render(CShader::E_RENDER_MODE _eMode)
{
if(CSceneMgr::Instance()->Get_Camera()->Get_Frustum()->IsPointInFrustum(m_vPosition) == CFrustum::E_FRUSTUM_RESULT_OUTSIDE)
{
return;
}
INode::Render(_eMode);
ICamera* pCamera = CSceneMgr::Instance()->Get_Camera();
CShader* pShader = m_pMaterial->Get_Shader(_eMode);
switch (_eMode)
{
case CShader::E_RENDER_MODE_SIMPLE:
{
if(pShader == NULL)
{
std::cout<<"[CCrossBoxEffect::Render] Shader MODE_SIMPLE is NULL"<<std::endl;
return;
}
pShader->Set_Matrix(m_mWorld, CShader::E_ATTRIBUTE_MATRIX_WORLD);
pShader->Set_Matrix(pCamera->Get_Projection(), CShader::E_ATTRIBUTE_MATRIX_PROJECTION);
pShader->Set_Matrix(pCamera->Get_View(), CShader::E_ATTRIBUTE_MATRIX_VIEW);
pShader->Set_CustomVector2(m_vTexcoordOffset, "EXT_TexcoordOffset");
pShader->Set_CustomVector2(m_vTexcoordRepeat, "EXT_TexcoordRepeat");
for(unsigned int i = 0; i < k_TEXTURES_MAX_COUNT; ++i)
{
CTexture* pTexture = m_pMaterial->Get_Texture(i);
if(pTexture == NULL)
{
continue;
}
pShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(i));
}
}
break;
case CShader::E_RENDER_MODE_REFLECTION:
{
}
break;
case CShader::E_RENDER_MODE_REFRACTION:
{
}
break;
case CShader::E_RENDER_MODE_SCREEN_NORMAL_MAP:
{
if(pShader == NULL)
{
std::cout<<"[CCrossBoxEffect::Render] Shader MODE_SCREEN_NORMAL_MAP is NULL"<<std::endl;
return;
}
pShader->Enable();
pShader->Set_Matrix(m_mWorld, CShader::E_ATTRIBUTE_MATRIX_WORLD);
pShader->Set_Matrix(pCamera->Get_Projection(), CShader::E_ATTRIBUTE_MATRIX_PROJECTION);
pShader->Set_Matrix(pCamera->Get_View(), CShader::E_ATTRIBUTE_MATRIX_VIEW);
for(unsigned int i = 0; i < k_TEXTURES_MAX_COUNT; ++i)
{
CTexture* pTexture = m_pMaterial->Get_Texture(i);
if(pTexture == NULL)
{
continue;
}
pShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(i));
}
}
break;
default:
break;
}
m_pMesh->Get_VertexBufferRef()->Enable(_eMode);
m_pMesh->Get_IndexBufferRef()->Enable();
unsigned int iNumIndexes = m_pMesh->Get_IndexBufferRef()->Get_NumWorkingIndexes();
glDrawElements(GL_TRIANGLES, iNumIndexes, GL_UNSIGNED_SHORT, (void*) m_pMesh->Get_IndexBufferRef()->Get_SourceDataFromVRAM());
m_pMesh->Get_IndexBufferRef()->Disable();
m_pMesh->Get_VertexBufferRef()->Disable(_eMode);
pShader->Disable();
}
示例2: Draw_TextureDetail
void CHeightMapSetter::Draw_TextureDetail(void)
{
CSceneMgr::Instance()->Get_RenderMgr()->BeginDrawMode(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_COLOR);
CMaterial::Set_ExtCommitedShaderRef(m_pPostRenderScreenPlaneShader);
unsigned int iTextureIndex = 0;
for(unsigned int i = 0; i < k_TEXTURES_MAX_COUNT; i += 2)
{
CTexture* pTexture = m_pTexturesDetailLayers[i];
if(pTexture == NULL)
{
continue;
}
m_pPostRenderScreenPlaneShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(iTextureIndex));
iTextureIndex++;
}
m_pPostRenderScreenPlaneShader->Set_Texture(Get_TextureSplatting(), CShader::E_TEXTURE_SLOT_07);
m_pPostRenderScreenPlaneMesh->Get_VertexBufferRef()->Enable(CShader::E_RENDER_MODE_SIMPLE);
m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Enable();
glDrawElements(GL_TRIANGLES, m_pPostRenderScreenPlaneMesh->Get_NumIndexes(), GL_UNSIGNED_SHORT, (void*) m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Get_SourceDataFromVRAM());
m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Disable();
m_pPostRenderScreenPlaneMesh->Get_VertexBufferRef()->Disable(CShader::E_RENDER_MODE_SIMPLE);
CSceneMgr::Instance()->Get_RenderMgr()->EndDrawMode(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_COLOR);
m_hTextureDetailColor = CSceneMgr::Instance()->Get_RenderMgr()->Get_OffScreenTexture(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_COLOR);
CSceneMgr::Instance()->Get_RenderMgr()->BeginDrawMode(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_NORMAL);
CMaterial::Set_ExtCommitedShaderRef(m_pPostRenderScreenPlaneShader);
iTextureIndex = 0;
for(unsigned int i = 1; i < k_TEXTURES_MAX_COUNT; i += 2)
{
CTexture* pTexture = m_pTexturesDetailLayers[i];
if(pTexture == NULL)
{
continue;
}
m_pPostRenderScreenPlaneShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(iTextureIndex));
iTextureIndex++;
}
m_pPostRenderScreenPlaneShader->Set_Texture(Get_TextureSplatting(), CShader::E_TEXTURE_SLOT_07);
m_pPostRenderScreenPlaneMesh->Get_VertexBufferRef()->Enable(CShader::E_RENDER_MODE_SIMPLE);
m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Enable();
glDrawElements(GL_TRIANGLES, m_pPostRenderScreenPlaneMesh->Get_NumIndexes(), GL_UNSIGNED_SHORT, (void*) m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Get_SourceDataFromVRAM());
m_pPostRenderScreenPlaneMesh->Get_IndexBufferRef()->Disable();
m_pPostRenderScreenPlaneMesh->Get_VertexBufferRef()->Disable(CShader::E_RENDER_MODE_SIMPLE);
CSceneMgr::Instance()->Get_RenderMgr()->EndDrawMode(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_NORMAL);
m_hTextureDetailNormal = CSceneMgr::Instance()->Get_RenderMgr()->Get_OffScreenTexture(CScreenSpacePostMgr::E_OFFSCREEN_MODE_LANDSCAPE_DETAIL_NORMAL);
m_bIsTextureDetailCreated = true;
}
示例3: Render
void CSkyBox::Render(CShader::E_RENDER_MODE _eMode)
{
if(!m_pMaterial->Check_RenderMode(_eMode))
{
std::cout<<"[CSkyBox::Render] Render mode incorrect"<<std::endl;
return;
}
INode::Render(_eMode);
ICamera* pCamera = CSceneMgr::Instance()->Get_Camera();
CShader* pShader = m_pMaterial->Get_Shader(_eMode);
m_pMaterial->Commit(_eMode);
switch (_eMode)
{
case CShader::E_RENDER_MODE_SIMPLE:
{
if(pShader == NULL)
{
std::cout<<"[CModel::Render] Shader MODE_SIMPLE is NULL"<<std::endl;
return;
}
pShader->Set_Matrix(m_mWorld, CShader::E_ATTRIBUTE_MATRIX_WORLD);
pShader->Set_Matrix(pCamera->Get_Projection(), CShader::E_ATTRIBUTE_MATRIX_PROJECTION);
pShader->Set_Matrix(pCamera->Get_View(), CShader::E_ATTRIBUTE_MATRIX_VIEW);
for(unsigned int i = 0; i < k_TEXTURES_MAX_COUNT; ++i)
{
CTexture* pTexture = m_pMaterial->Get_Texture(i);
if(pTexture == NULL)
{
continue;
}
pShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(i));
}
}
break;
case CShader::E_RENDER_MODE_REFLECTION:
{
if(pShader == NULL)
{
std::cout<<"[CModel::Render] Shader MODE_SIMPLE is NULL"<<std::endl;
return;
}
pShader->Set_Matrix(m_mWorld, CShader::E_ATTRIBUTE_MATRIX_WORLD);
pShader->Set_Matrix(pCamera->Get_Projection(), CShader::E_ATTRIBUTE_MATRIX_PROJECTION);
pShader->Set_Matrix(pCamera->Get_View(), CShader::E_ATTRIBUTE_MATRIX_VIEW);
for(unsigned int i = 0; i < k_TEXTURES_MAX_COUNT; ++i)
{
CTexture* pTexture = m_pMaterial->Get_Texture(i);
if(pTexture == NULL)
{
continue;
}
pShader->Set_Texture(pTexture->Get_Handle(), static_cast<CShader::E_TEXTURE_SLOT>(i));
}
}
break;
case CShader::E_RENDER_MODE_REFRACTION:
{
}
break;
default:
break;
}
m_pMesh->Get_VertexBufferRef()->Enable(_eMode);
m_pMesh->Get_IndexBufferRef()->Enable();
glDrawElements(GL_TRIANGLES, m_pMesh->Get_NumIndexes(), GL_UNSIGNED_SHORT, (void*) m_pMesh->Get_IndexBufferRef()->Get_SourceDataFromVRAM());
m_pMesh->Get_IndexBufferRef()->Disable();
m_pMesh->Get_VertexBufferRef()->Disable(_eMode);
}