本文整理汇总了C++中Sector::getNumVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ Sector::getNumVertices方法的具体用法?C++ Sector::getNumVertices怎么用?C++ Sector::getNumVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sector
的用法示例。
在下文中一共展示了Sector::getNumVertices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: L1_GetSectorOppositeEdge
void L1_GetSectorOppositeEdge() {
lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
if (!lua_isstring(nameObj)) {
lua_pushnil();
return;
}
Actor *actor = getactor(actorObj);
const char *name = lua_getstring(nameObj);
int numSectors = g_grim->getCurrScene()->getSectorCount();
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->getCurrScene()->getSectorBase(i);
if (strmatch(sector->getName(), name)) {
if (sector->getNumVertices() != 4)
warning("GetSectorOppositeEdge(): cheat box with %d (!= 4) edges!", sector->getNumVertices());
Graphics::Vector3d* vertices = sector->getVertices();
Sector::ExitInfo e;
sector->getExitInfo(actor->getPos(), -actor->getPuckVector(), &e);
float frac = (e.exitPoint - vertices[e.edgeVertex + 1]).magnitude() / e.edgeDir.magnitude();
e.edgeVertex -= 2;
if (e.edgeVertex < 0)
e.edgeVertex += sector->getNumVertices();
Graphics::Vector3d edge = vertices[e.edgeVertex + 1] - vertices[e.edgeVertex];
Graphics::Vector3d p = vertices[e.edgeVertex] + edge * frac;
lua_pushnumber(p.x());
lua_pushnumber(p.y());
lua_pushnumber(p.z());
return;
}
}
lua_pushnil();
}
示例2: drawShadowPlanes
void GfxTinyGL::drawShadowPlanes() {
tglEnable(TGL_SHADOW_MASK_MODE);
if (!_currentShadowArray->shadowMask) {
_currentShadowArray->shadowMask = new byte[_screenWidth * _screenHeight];
_currentShadowArray->shadowMaskSize = _screenWidth * _screenHeight;
}
memset(_currentShadowArray->shadowMask, 0, _screenWidth * _screenHeight);
tglSetShadowMaskBuf(_currentShadowArray->shadowMask);
_currentShadowArray->planeList.begin();
for (SectorListType::iterator i = _currentShadowArray->planeList.begin(); i != _currentShadowArray->planeList.end(); ++i) {
Sector *shadowSector = i->sector;
tglBegin(TGL_POLYGON);
for (int k = 0; k < shadowSector->getNumVertices(); k++) {
tglVertex3f(shadowSector->getVertices()[k].x(), shadowSector->getVertices()[k].y(), shadowSector->getVertices()[k].z());
}
tglEnd();
}
tglSetShadowMaskBuf(NULL);
tglDisable(TGL_SHADOW_MASK_MODE);
}