本文整理汇总了C++中ITexture::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ ITexture::GetHeight方法的具体用法?C++ ITexture::GetHeight怎么用?C++ ITexture::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITexture
的用法示例。
在下文中一共展示了ITexture::GetHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTextureSize
void CUIDraw::GetTextureSize(int iTextureID,float &rfSizeX,float &rfSizeY)
{
TTexturesMap::iterator Iter = m_texturesMap.find(iTextureID);
if(Iter != m_texturesMap.end())
{
ITexture *pTexture = (*Iter).second;
rfSizeX = (float) pTexture->GetWidth ();
rfSizeY = (float) pTexture->GetHeight ();
}
else
{
// Unknow texture !
CRY_ASSERT(0);
rfSizeX = 0.0f;
rfSizeY = 0.0f;
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:17,代码来源:UIDraw.cpp
示例2: tu_vec
void VFSPlugin_Q2BSP::AssignTextureCoords(IVertexBuffer *vb)
{
int a,b;
Mesh *m = m_fileinfo->mesh;
Vertex3f *v = m->GetPosition();
Vertex2f *tc = NULL;
BSPTexInfo *ti = NULL;
int *i = vb->GetIndex();
if((tc = (Vertex2f *)m->GetTexcoord()) == NULL){
tc = new Vertex2f[m->GetNumVertex()];
memset(tc,0,m->GetNumVertex()*sizeof(Vertex2f));
m->SetTexcoord(tc);
}
for(a=0;a<m_numtexinfo;a++){
ti = &m_texinfo[a];
if(strcmp(vb->GetName(),ti->name) == 0){
Maths::Vector tu_vec(ti->u_axis);
Maths::Vector tv_vec(ti->v_axis);
ITexture *texture = vb->GetTexture();
for(b=0;b<vb->GetNumIndex();b++){
Maths::Vector vec(v[i[b]]);
tc[i[b]].x = ( vec.DotProduct(tu_vec) + ti->u_offset) / texture->GetWidth();
tc[i[b]].y = ( vec.DotProduct(tv_vec) + ti->v_offset) / texture->GetHeight();
}
}
}
//for(a=0;a<m->GetNumVertex();a++) logfile << "texcoord["<<a<<"] = { " << tc[a].x << ", " << tc[b].y << " };" << std::endl;
// vb->SetTexcoord((float *)tc);
vb->SetTextureLayer(0,(float *)tc,vb->GetTexture());
}
示例3:
//------------------------------------------------------------------------------
void sqr::CLoadMapResInfo::MakeTerrainTexture()
{
CRenderDevice * pRender = NULL;
pRender = CRenderDevice::GetInst();
if ( pRender == NULL )
return;
CTerrainMesh * pTerrain = CMapEditApp::GetInst()->GetTerrain();
int texCnt = 0;
ITexture* pTexture = NULL;
if ( pTerrain->m_pTerrainTexture == NULL )
CGraphic::GetInst()->CreateEmptyTexture(EXPAND_MAX_SIZE,EXPAND_MAX_SIZE,1, TF_XRGB32,&(pTerrain->m_pTerrainTexture));
string texname = "";
map<string, int16>::iterator iter = m_mapTerrainTextureNames.begin();
map<string, int16>::iterator eiter = m_mapTerrainTextureNames.end();
set<string> erroTexList;
for ( iter; iter != eiter; ++iter )
{
texname = iter->first;
if( texname.empty() )
continue;
pTexture = pRender->GetTexture(texname);
if( texname.find("water.dds") != -1 )
continue;
if (NULL==pTexture)
{
string log = "拼接过程:"+texname+"纹理无法找到";
MessageBox(NULL,log.c_str(),"错误",MB_OK);
erroTexList.insert(texname);
continue;
}
if (NULL==pTexture->GetBuffer())
{
string log = "拼接过程:"+texname+"纹理无法找到";
MessageBox(NULL,log.c_str(),"错误",MB_OK);
continue;
}
UINT H = (texCnt/ROW_SIZE)*EXPAND_TEXTURE_SIZE;
UINT W = (texCnt%ROW_SIZE)*EXPAND_TEXTURE_SIZE;
if (pTexture->GetWidth()!=TEXTURE_SIZE||pTexture->GetHeight()!=TEXTURE_SIZE)
{
string log = "拼接过程:"+texname+"尺寸不合法,所有贴图纹理应为128X128";
erroTexList.insert(texname);
MessageBox(NULL,log.c_str(),"错误",MB_OK);
continue;
}
pRender->m_TerrainTexIndexs[texname] = texCnt;
//DebugOut("%d, %s\n", texCnt, texname.c_str());
++texCnt;
CIRect rectT,rectO;
_TEXLOCKED_RECT lockT,lockO;
rectO.top = rectO.left = 0;
rectO.bottom = rectO.right = TEXTURE_SIZE;
rectT.top = H;
rectT.bottom = H + EXPAND_TEXTURE_SIZE;
rectT.left = W;
rectT.right = W + EXPAND_TEXTURE_SIZE;
pTerrain->m_pTerrainTexture->Lock(0,&lockT,&rectT,0,LOCK_DISCARD);
pTexture->Lock(0,&lockO,&rectO,0,LOCK_READONLY);
//pTerrain->pTar = (TCHAR*)lockT.pBits;
TCHAR* pTar = (TCHAR*)lockT.pBits;
TCHAR* pOrc = (TCHAR*)lockO.pBits;
for (UINT i=0;i<EXPAND_SIZE;++i,pTar+=lockT.Pitch)
{
for ( UINT j=0;j<EXPAND_SIZE;++j)
{
memcpy(pTar+PixelSize*j,pOrc,PixelSize);
memcpy(pTar+lockO.Pitch+PixelSize*(j+EXPAND_SIZE),pOrc+lockO.Pitch-PixelSize,PixelSize);
}
memcpy(pTar+PixelSize*EXPAND_SIZE,pOrc,lockO.Pitch);
}
for (UINT i = 0;i<TEXTURE_SIZE;++i,pTar+=lockT.Pitch,pOrc+=lockO.Pitch)
{
for ( UINT j=0;j<EXPAND_SIZE;++j)
{
memcpy(pTar+PixelSize*j,pOrc,PixelSize);
memcpy(pTar+lockO.Pitch+PixelSize*(j+EXPAND_SIZE),pOrc+lockO.Pitch-PixelSize,PixelSize);
}
memcpy(pTar+PixelSize*EXPAND_SIZE,pOrc,lockO.Pitch);
}
pOrc-=lockO.Pitch;
for (UINT i=0;i<EXPAND_SIZE;++i,pTar+=lockT.Pitch)
{
for ( UINT j=0;j<EXPAND_SIZE;++j)
{
//.........这里部分代码省略.........