本文整理汇总了C++中Polygon2d::VerteciesCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygon2d::VerteciesCount方法的具体用法?C++ Polygon2d::VerteciesCount怎么用?C++ Polygon2d::VerteciesCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon2d
的用法示例。
在下文中一共展示了Polygon2d::VerteciesCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PolygonShape::PolygonShape(const Polygon2d& polygon, Material& attrs):
m_polygon(polygon) {
b2Vec2* vertecies = new b2Vec2[polygon.VerteciesCount()];
const Vertecies& polygonVertecies = polygon.GetVertecies();
for (size_t vertexNo = 0; vertexNo < polygonVertecies.size(); ++vertexNo) {
vertecies[vertexNo] = ToBox2dVec(polygonVertecies[vertexNo]);
}
m_polygonShapePtr = new b2PolygonShape();
m_polygonShapePtr->Set(vertecies, polygon.VerteciesCount());
delete[] vertecies;
Construct(m_polygonShapePtr, attrs);
}
示例2: sizeof
void D3DRenderContext::RenderSolidPolygon(const Polygon2d& p, const ivec3& color) const {
WireGeometryVertex* points = new WireGeometryVertex[p.VerteciesCount() + 1];
for (uint i = 0; i <= p.VerteciesCount(); ++i) {
if (i == p.VerteciesCount()) {
points[i].x = p[0].x;
points[i].y = p[0].y;
points[i].z = MAX_ZCHOOORD;
points[i].color = D3DCOLOR_XRGB(color.x, color.y, color.z);
} else {
points[i].x = p[i].x;
points[i].y = p[i].y;
points[i].z = MAX_ZCHOOORD;
points[i].color = D3DCOLOR_XRGB(color.x, color.y, color.z);
}
}
m_d3dDevice->SetFVF(D3DFVF_WIRE_GEOMETRY_VERTEX);
m_d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, p.VerteciesCount(), static_cast<void*>(points), sizeof(WireGeometryVertex));
delete[] points;
}