本文整理汇总了C++中Obstacle::getShape方法的典型用法代码示例。如果您正苦于以下问题:C++ Obstacle::getShape方法的具体用法?C++ Obstacle::getShape怎么用?C++ Obstacle::getShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obstacle
的用法示例。
在下文中一共展示了Obstacle::getShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Game::draw(GLUTRenderingContext * g) {
AABBf selectionUIVisual = selectedArea;
selectionUIVisual.validate();
g->setColor(0x88ff88);
selectionUIVisual.glDraw(false);
if (doingOperation) {
g->setColor(0xaaaaff);
g->drawLine(operationPoint, mousePosition);
}
delauny->draw(g_screen);
// return;
// draw selected obstacle indicator
if (selectedObstacles.size() > 0) {
g->setColor(0xaaffaa);
for (int i = 0; i < selectedObstacles.size(); ++i) {
Shape * s = selectedObstacles[i]->getShape();
g->drawCircle(s->getCenter(), s->getRadius(), false);
s->draw(g, true);
}
g->drawCircle(selectedOrigin, .1f, true);
}
g->setColor(0x00aaff);
g->printf(mousePosition, "%.2f, %.2f", mousePosition.x, mousePosition.y);
g->drawCircle(mousePosition, .1f, false);
// int layerColors[] = { 0x0088aa, 0x66aa88, 0x88aa22, 0x123456 };
// int layerColorsCount = sizeof(layerColors) / sizeof(layerColors[0]);
// objectMap.draw(g, layerColors, layerColorsCount);
// testing cone stuff
RaycastHit rh;
V2f hit, norm;
float dist = 0, maxDist = 0;
Obstacle * o;
g->drawCircle(userRay.start, .05f, true);
// TEST <-- TODO
V2f delta = mousePosition - userRay.start;
if (!delta.isZero()) { dist = delta.magnitude(); delta /= dist; }
maxDist = dist;
//TemplateSet<int> cellList;
//staticObstaclesMap->raycastCellList(mouseClick, delta, dist, cellList);
//for (int i = 0; i < cellList.size(); ++i) { staticObstaclesMap->cells[cellList[i]]->glDraw(true); }
if (raycast(userRay, rh, userRayDistance, false, o, -1))
{
g->setColor(0);
drawRaycastHit(rh, 1);
g->printf(rh.point, "%.2f, ", rh.distance);
}
g->drawLine(userRay.start, userRay.start + userRay.direction * userRayDistance);//userRay.glDraw();
for (int i = 0; i < obstacles.size(); ++i) {
Obstacle * obs = obstacles[i];
g->setColor(0x333333);
obs->getShape()->draw(g, false);
obs->getShape()->getClosestRaycastHit(mousePosition, rh);
g->setColor(0x888888);
drawRaycastHit(rh, .2f);
}
}