本文整理汇总了C++中CGroupMap::addDeco方法的典型用法代码示例。如果您正苦于以下问题:C++ CGroupMap::addDeco方法的具体用法?C++ CGroupMap::addDeco怎么用?C++ CGroupMap::addDeco使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGroupMap
的用法示例。
在下文中一共展示了CGroupMap::addDeco方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
//***************************************************************
void CAutoGroup::update(const CVector &testPos, const std::string &paletteEntry, bool valid)
{
//H_AUTO(R2_CAutoGroup_update)
_TestPos = testPos;
_PaletteEntry = paletteEntry;
_AutoGroupEnabled = valid;
CInstance *candidate = getGroupingCandidate();
if (!candidate && _AutoGroup.isAddedToWorldMap())
{
clear();
}
else if (candidate)
{
// update the display
if (!_AutoGroup.isAddedToWorldMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->addDeco(&_AutoGroup);
}
}
CDisplayerVisual *dv = candidate->getDisplayerVisual();
nlassert(dv); // should not be null because getGrou^pingCandidate succeeded
_PrimRenderVertices.resize(2);
CVector pos = dv->isCompound() ? dv->getSon(0)->getWorldPos() : dv->getWorldPos();
_PrimRenderVertices[0] = pos;
_PrimRenderVertices[1] = _TestPos;
_AutoGroup.setVertices(_PrimRenderVertices);
_AutoGroup.addDecalsToRenderList();
}
}
示例2: updateWorldMapPresence
// *********************************************************************************************************
void CDisplayerVisualEntity::updateWorldMapPresence()
{
//H_AUTO(R2_CDisplayerVisualEntity_updateWorldMapPresence)
if (!getActive()) return;
// if not in current map then remove
// if entity not in that map then ignore
bool inIsland = false;
CIslandCollision &col = getEditor().getIslandCollision();
R2::CScenarioEntryPoints::CCompleteIsland *currIsland = col.getCurrIslandDesc();
if (currIsland)
{
inIsland = currIsland->isIn(getWorldPos2f());
}
// in map (displayed only if selectable for now)
if (getDisplayedInstance()->getSelectable() && inIsland)
{
if (!_MapDeco.isAddedToMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
_MapDeco.setDisplayedInstance(getDisplayedInstance(), true);
// retrieve icon from the displayed object (lua code)
CLuaState &ls = getEditor().getLua();
std::string texName = "";
{
CLuaStackChecker lsc(&ls);
if (getDisplayedInstance()->getLuaProjection().callMethodByNameNoThrow("getSelectBarIcon", 0, 1))
{
texName = ls.toString(-1);
ls.pop();
}
}
gm->addDeco(&_MapDeco);
_MapDeco.setCloseTexture(texName);
_MapDeco.invalidateCoords();
}
}
}
else
{
if (_MapDeco.isAddedToMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->removeDeco(&_MapDeco);
}
}
}
}
示例3: setActive
// *********************************************************************************************************
void CDisplayerVisualShape::setActive(bool active)
{
//H_AUTO(R2_CDisplayerVisualShape_setActive)
if (active == _Active) return;
if (!active)
{
deleteShape();
}
else
{
if (!_MapDeco.isAddedToMap() && _WorldMapDisplay)
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
_MapDeco.setDisplayedInstance(getDisplayedInstance(), false);
gm->addDeco(&_MapDeco);
_MapDeco.invalidateCoords();
}
}
}
_Touched = true;
_Active = active;
}
示例4: update
//.........这里部分代码省略.........
_TraversedPrimInfos.push_back(CTraversedPrimInfo());
_TraversedPrimInfos.back().PrimDisplay = nextDV;
_TraversedPrimInfos.back().Visible = nextDV->getActualDisplayMode() != DisplayModeHidden;
CWorldPosCache wpc;
wpc.DV = nextDV;
wpc.WorldPos2f = nextDV->getWorldPos2f();
_WPCache.push_back(wpc);
if (nextDV->getActualDisplayMode() != DisplayModeHidden
&& prevDV->getActualDisplayMode() != DisplayModeHidden)
{
// special case for regions
if (nextZone->isKindOf("Region"))
{
// first case : previous zone is not a region
if (!prevZone || !prevZone->isKindOf("Region"))
{
// search shortest distance bewteen last pos and the region
CVector entryPos;
if (nextDV->evalEnterPoint(prevDV->evalExitPoint(), entryPos))
{
addFootSteps(CLine(prevDV->evalExitPoint(), entryPos));
}
else
{
addWanderSteps(prevDV->evalExitPoint());
}
}
else
{
// region-region footsteps
// just use the couple of vertices for which the distance is the smallest
static std::vector<CVector2f> r0;
static std::vector<CVector2f> r1;
prevDV->getSonsWorldPos2f(r0);
nextDV->getSonsWorldPos2f(r1);
if (!r0.empty() && !r1.empty())
{
CVector2f p0, p1;
float bestDist = FLT_MAX;
for(uint k = 0; k < r0.size(); ++k)
{
for(uint l = 0; l < r0.size(); ++l)
{
float dist = (r0[k] - r1[l]).norm();
if (dist <bestDist)
{
bestDist = dist;
p0 = r0[k];
p1 = r1[l];
}
}
}
nlassert(bestDist != FLT_MAX);
addFootSteps(CLine(p0.asVector(), p1.asVector()));
}
}
}
else
{
// special case if prev zone is a region
if (prevZone && prevZone->isKindOf("Region"))
{
// search shortest distance bewteen last pos and the region
CVector entryPos;
if (prevDV->evalEnterPoint(nextDV->evalLinkPoint(), entryPos))
{
addFootSteps(CLine(entryPos, nextDV->evalLinkPoint()));
}
else
{
addWanderSteps(nextDV->evalLinkPoint());
}
}
else
{
// simple footsteps between last & new pos
addFootSteps(CLine(prevDV->evalExitPoint(), nextDV->evalLinkPoint()));
}
}
}
prevDV = nextDV;
prevZone = nextZone;
}
//
CGroupMap *gm = CTool::getWorldMap();
if (!_AddedToWorldMap && gm)
{
gm->addDeco(this);
}
if (_AddedToWorldMap)
{
setWorldMapNumEdges((uint)_FootSteps.size());
nlassert(gm);
onUpdate(*gm);
}
}