本文整理汇总了C++中COperator::GetGridIndexHot方法的典型用法代码示例。如果您正苦于以下问题:C++ COperator::GetGridIndexHot方法的具体用法?C++ COperator::GetGridIndexHot怎么用?C++ COperator::GetGridIndexHot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COperator
的用法示例。
在下文中一共展示了COperator::GetGridIndexHot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CToolHideTileRegionInView::Render()
{
if( m_bShow )
{
invisiblePool::iterator beg = m_invisibleTileRegionIndexs.begin();
invisiblePool::iterator end = m_invisibleTileRegionIndexs.end();
for ( beg; beg!= end; ++beg )
{
int nTileRegionIndex = beg->first;
int nSubTileRegionIndex = -1;
const subRegIndexPool subIndexs = beg->second;
for ( subRegIndexPool::const_iterator iter = subIndexs.begin(); iter != subIndexs.end(); ++ iter )
{
nSubTileRegionIndex = *iter;
this->RenderOneTileRegion(nTileRegionIndex, nSubTileRegionIndex, m_pTileRegionSetTexture);
}
}
}
CTerrainMesh *pTerrain = CMapEditApp::GetInst()->GetEditingMesh();
COperator *pOperator = CMapEditApp::GetInst()->GetOperator();
int nHotGrid = pOperator->GetGridIndexHot();
SGrid &grid = pTerrain->GetGrid(nHotGrid);
int nHotTileRegionIndex = grid.dwBufferIndex;
int nSubTileRegionIndex = grid.bSubRenderUnitIndex;
this->RenderOneTileRegion(nHotTileRegionIndex, nSubTileRegionIndex, m_pTileRegionLockTexture);
}
示例2: OperatorDeleteTileRegion
void CToolHideTileRegionInView::OperatorDeleteTileRegion()
{
CTerrainMesh *pTerrain = CMapEditApp::GetInst()->GetEditingMesh();
COperator *pOperator = CMapEditApp::GetInst()->GetOperator();
int nHotGrid = pOperator->GetGridIndexHot();
const SGrid &grid = pTerrain->GetGrid(nHotGrid);
STileRegion *pTileregion = pTerrain->GetTileRegion(grid.dwBufferIndex);
int nHotTileRegionIndex = grid.dwBufferIndex;
if( pTileregion )
{
invisiblePool::iterator iter = m_invisibleTileRegionIndexs.find(nHotTileRegionIndex);
if ( iter != m_invisibleTileRegionIndexs.end() )
{
int nTileRegionIndex = iter->first;
int nSubTileRegionIndex = -1;
const subRegIndexPool subIndexs = iter->second;
iter->second.erase(grid.bSubRenderUnitIndex);
if( iter->second.empty() )
m_invisibleTileRegionIndexs.erase(iter);
}
STileRenderRegionUnit *pRenderRegionUnit = pTileregion->vRenderRegionUnits[grid.bSubRenderUnitIndex];
pRenderRegionUnit->bIsVisibleInView = true;
pTerrain->SetTerrainNodeVisbileMark(nHotTileRegionIndex, grid.bSubRenderUnitIndex, true);
}
::SendMessage(m_hTileRegionView, WM_TILEREGIONVIEW_REFRESH,0,0);
}
示例3: OnEvent
void CToolMainPlayer::OnEvent(const CMsg& msg)
{
COperator * pOperator = CMapEditApp::GetInst()->GetOperator();
CTerrainMesh * pTerrainMesh = CMapEditApp::GetInst()->GetEditingMesh();
switch ( msg.msgSource )
{
case MGS_MOUSEMSG:
{
if( msg.msgType.key_type == MGT_MOUSE_LBNDOWN )
{
if ( m_ani != "" && m_ani != "run01" )
{
if( !m_pMainPlayer->SetNextAnimation("run01",FramePair(0,-1),true,200,1.0f) )
{
if( m_pMainPlayer->SetNextAnimation("run01_y",FramePair(0,-1),true,200,1.0f) )
m_ani = "run01_y";
}
else
m_ani = "run01";
}
else
{
m_pMainPlayer->SetNextAnimation("stand01",FramePair(0,-1),true,200,1.0f) ;
}
if ( pTerrainMesh->IsValid(pOperator->GetGridIndexHot()) )
{
m_bStop = false;
m_vEnd = pOperator->GetHitPoint();
//实时更新区域值
CSceneRegionMgr::GetInst()->CalcRegionLightByRegionDistance(m_vEnd);
m_vStart = m_vPos;
m_fRoad = (m_vEnd-m_vStart).Mag();
m_vDir = m_vEnd - m_vPos;
m_vDir.y = 0.0f;
m_vDir.normalize();
m_mat._11 = m_vDir.z;
m_mat._13 = -m_vDir.x;
m_mat._31 = m_vDir.x;
m_mat._33 = m_vDir.z;
}
}
}
break;
}
}
示例4: OnEvent
void CToolHideTileRegionInView::OnEvent(const CMsg& msg)
{
CTerrainMesh * pTerrain = CMapEditApp::GetInst()->GetTerrain();
switch ( msg.msgSource )
{
case MGS_KEYMSG:
{
switch(msg.msgType.key_type)
{
case MGT_KEY_DOWN:
{
switch(msg.msgInfo.key_info)
{
case MGI_KEY_F3:
{
this->OperatorAddTileRegionIndex();
}
return;
default:
break;
}
}
default:
return;
}
}
case MGS_MOUSEMSG:
{
switch(msg.msgType.mouse_type)
{
case MGT_MOUSE_MOVE:
CTerrainMesh *pTerrain = CMapEditApp::GetInst()->GetEditingMesh();
COperator *pOperator = CMapEditApp::GetInst()->GetOperator();
int nHotGrid = pOperator->GetGridIndexHot();
SGrid &grid = pTerrain->GetGrid(nHotGrid);
int nHotTileRegionIndex = grid.dwBufferIndex;
::SendMessage(m_hTileRegionView,WM_TILEREGIONVIEW_MARK, 0,(LPARAM)&nHotTileRegionIndex);
break;
}
default:
break;
}
}
}
示例5: OperatorAddTileRegionIndex
void CToolHideTileRegionInView::OperatorAddTileRegionIndex()
{
COperator *pOperator = CMapEditApp::GetInst()->GetOperator();
int nHotGrid = pOperator->GetGridIndexHot();
CTerrainMesh *pTerrain = CMapEditApp::GetInst()->GetEditingMesh();
const SGrid &grid = pTerrain->GetGrid(nHotGrid);
int nHotTileRegionIndex = grid.dwBufferIndex;
STileRegion *pTileregion = pTerrain->GetTileRegion(nHotTileRegionIndex);
if( pTileregion )
{
m_invisibleTileRegionIndexs[nHotTileRegionIndex].insert(grid.bSubRenderUnitIndex);
STileRenderRegionUnit *pRenderRegionUnit = pTileregion->vRenderRegionUnits[grid.bSubRenderUnitIndex];
pRenderRegionUnit->bIsVisibleInView = false;
pTerrain->SetTerrainNodeVisbileMark(nHotTileRegionIndex, grid.bSubRenderUnitIndex, false);
}
::SendMessage(m_hTileRegionView, WM_TILEREGIONVIEW_REFRESH,0,0);
}
示例6: Render
void CMapEditEffectObj::Render()
{
DWORD dwCurrentTime = (uint32)GetProcessTime();
DWORD pretime = ::timeGetTime();
static DWORD dwCurrentTimeForBestMinimap = dwCurrentTime;
dwCurrentTimeForBestMinimap = dwCurrentTime;
CTerrainMesh *pTerrain = CMapEditApp::GetInst()->GetEditingMesh();
COperator *pOperator = CMapEditApp::GetInst()->GetOperator();
if ( EES_MOVING == sModelCommonPro.eEditState )
{
int nGridIndexBlockCenter;
if ( sModelCommonPro.bCameraOriented )
{
CVector3f v;
if ( !CPicker::GetInst()->GetIntersected(v,&nGridIndexBlockCenter) )
{
nGridIndexBlockCenter = pOperator->GetGridIndexHot();
}
}
else
{
nGridIndexBlockCenter = pOperator->GetGridIndexHot();
}
nGridIndexBlockCenter += ( sModelCommonPro.nXGroupOffset + sModelCommonPro.nZGroupOffset*pTerrain->GetWidth() );
if ( !pTerrain->IsValid(nGridIndexBlockCenter) )
{
return;
}
SGrid &gridBlockCenter = pTerrain->GetGrid(nGridIndexBlockCenter);
sModelCommonPro.vBlockCenter = gridBlockCenter.vCenter;
int nImageCenterGridIndex = this->GetUserOffsetAdjustedGridIndex(gridBlockCenter.dwGridIndex);
SGrid &gridImageCenter = pTerrain->GetGrid(nImageCenterGridIndex);
sModelCommonPro.vImageCenter = gridImageCenter.vCenter;
sModelCommonPro.matWorldOff.SetTranslate(sModelCommonPro.vBlockCenter.x, sModelCommonPro.vImageCenter.y, sModelCommonPro.vBlockCenter.z);
sModelCommonPro.mat = sModelCommonPro.matSelfOff*sModelCommonPro.matUserOffset*sModelCommonPro.matWorldOff;
if( m_pWireBox )
m_pWireBox->SetAbsolute(sModelCommonPro.WireBoxMat);
}
CColor color;
color.A = 255;
///如果是场景灯的话,呈显黄色
if( sModelCommonPro.bEffectLight )
{
color.R = 255;
color.G = 255;
color.B = 0;
}
else
{
color.R = 125;
color.G = 125;
color.B = 125;
}
CEditModel::SetAmbient(color);
CEditModel::SetDiffuse(color);
CEditModel::SetRenderStyle(ROS_LIGHTMAT1);
//CEditModel::SetVisible(CMainWindowTarget::GetInst()->GetGroup()->GetCamera() != 0);
SetPosition(sModelCommonPro.mat.GetLoc());
if( !CSceneEnvMgr::GetInst()->GetIsGenerateMinMap() )
CEditModel::OnPreRender(dwCurrentTime,CMainWindowTarget::GetInst()->GetGroup()->GetCamera());
else
CEditModel::OnPreRender(dwCurrentTime,NULL);
//CEditModel::SetFixMatrix(sModelCommonPro.mat);
CEditModel::Render(/*dwCurrentTime, &rs*/);
if ( !CCameraManager::GetInst()->GetMapEditCamera()->GetIsOrthogonal() &&
this->GetLocked() || this->GetSelected() && (!sModelCommonPro.bEffectBase) )
{
if( m_pWireBox )
{
m_pWireBox->SetAbsolute(sModelCommonPro.WireBoxMat);
CTerrainAdhereRenderer::GetInst()->AddRenderWireBox(m_pWireBox);
}
//RenderBigBoxDebug(this);
}
DWORD postime = ::timeGetTime();
//.........这里部分代码省略.........
示例7: OnEvent
void CToolSetTileHeight::OnEvent(ip::CInputDevice::SEvent & event)
{
COperator * pOperator = CXFile::GetInstance()->GetOperator();
CTerrainMesh * pTerrainMesh = CXFile::GetInstance()->GetTerrainMesh();
switch ( event.eType )
{
case ip::EIET_KB_KEYUP:
{
// shrink brush
if ( event.dwData == DIK_MINUS )
{
if ( pOperator->GetBrushSize() > 1 ) pOperator->DecBrushSize();
}
// amplify brush
if ( event.dwData == DIK_EQUALS )
{
pOperator->IncBrushSize();
}
//switch(event.dwData)
//{
//case DIK_3:
// {
// pOperator->SetHeightType((COperator::ESET_HEIGHT_TYPE)((pOperator->GetHeightType() + 1) % pOperator->GetHeightTypeCount()));
// }
//break;
//case DIK_4:
// {
// pOperator->SetAxisType((COperator::EAXIS_TYPE)((pOperator->GetAxisType() + 1) % pOperator->GetAxisTypeCount()));
// }
//break;
//case DIK_5:
// {
// pOperator->SetWayType((COperator::ESET_WAY_TYPE)((pOperator->GetWayType() + 1) % pOperator->GetWayTypeCount()));
// }
//break;
//}
}
break;
case ip::EIET_MS_BTNUP :
case ip::EIET_MS_MOVE :
{
if ( ip::CInputDevice::GetInstance()->GetButtonState(MK_LBUTTON) )
{
DWORD dwTextureHandleHot = pOperator->GetTextureHandleHot();
DWORD dwLayerHot = pOperator->GetLayerHot();
CCmdSetVertexHeight * pCmd = new CCmdSetVertexHeight;
// set grids via brush size
if ( pOperator->GetGridIndexHot() != INVALID )
{
DWORD dwCnt = 4*pOperator->GetBrushSize()*pOperator->GetBrushSize();
DWORD dwGridIndex = pOperator->GetGridIndexHot() - pOperator->GetBrushSize() - pOperator->GetBrushSize() * pTerrainMesh->GetWidth();
for ( DWORD j = 0; j < dwCnt; j++)
{
if ( j )
{
if ( !(j % (2 * pOperator->GetBrushSize())) )
dwGridIndex += pTerrainMesh->GetWidth() - 2*pOperator->GetBrushSize() + 1;
else
++dwGridIndex;
}
// check for valid grid
if ( dwGridIndex < 0 || dwGridIndex > pTerrainMesh->GetDepth() * pTerrainMesh->GetWidth() )
{
continue;
}
CTerrainMesh::SGrid & grid = pTerrainMesh->GetGrid(dwGridIndex);
for ( int i = 0; i < 4; i++)
{
pCmd->AddVertex(grid.dwVertexIndex[i]);
}
}
}
CCmdMgr::GetInstance()->Do(pCmd);
}
}
break;
}
}