本文整理汇总了C++中core::array::const_pointer方法的典型用法代码示例。如果您正苦于以下问题:C++ array::const_pointer方法的具体用法?C++ array::const_pointer怎么用?C++ array::const_pointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::array
的用法示例。
在下文中一共展示了array::const_pointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawElements
// this function is for 32bit indices
void drawElements(
IVideoDriver* driver,
const core::array<video::S3DVertex>& vertices,
const core::array<s32>& indices,
scene::E_PRIMITIVE_TYPE primType)
{
if (!driver)
return;
u32 primCount = 0;
const u32& indexCount = indices.size();
switch (primType)
{
case scene::EPT_POINTS:
primCount = indexCount;
break;
case scene::EPT_LINE_STRIP:
primCount = indexCount-1;
break;
case scene::EPT_LINE_LOOP:
primCount = indexCount-1;
break;
case scene::EPT_LINES:
primCount = indexCount/2;
break;
case scene::EPT_TRIANGLE_STRIP:
primCount = (indexCount-2)/3;
break;
case scene::EPT_TRIANGLE_FAN:
primCount = (indexCount-2)/3;
break;
case scene::EPT_TRIANGLES:
primCount = indexCount/3;
break;
case scene::EPT_QUAD_STRIP:
primCount = (indexCount-2)/4;
break;
case scene::EPT_QUADS:
primCount = indexCount/4;
break;
case scene::EPT_POLYGON:
primCount = indexCount-1;
break;
case scene::EPT_POINT_SPRITES:
primCount = indexCount;
break;
default:
break;
}
driver->drawVertexPrimitiveList( vertices.const_pointer(),
vertices.size(), indices.const_pointer(),
primCount, video::EVT_STANDARD,
primType, video::EIT_32BIT);
}
示例2: if
//.........这里部分代码省略.........
//------------------------------------------------------// Invert triangle direction
for (s32 face=0; face<faceCount; face++) // Irrlicht wants indices in the opposite order
{
u16 faceA = faceBuffer[face*3]; // Swap first and last vertex index
faceBuffer[face*3] = faceBuffer[face*3+2]; // Set the first to the last
faceBuffer[face*3+2] = faceA; // And the last to the first
}
//------------------------------------------------------// Finally! Time to draw everthing
Material.BackfaceCulling = false;
float k;
if(draw_mode != DM_DEFAULT)
{
video::SMaterial debug_material;
debug_material.Wireframe = true;
debug_material.BackfaceCulling = false;
debug_material.Lighting = false;
driver->setMaterial(debug_material);
/* so that debug looks good for all sizes of models*/
k = EXTENT_K * BoundingBox.getExtent().getLength();
}
else
{
driver->setMaterial( Material );
}
if(draw_mode == DM_DEFAULT)
{
driver->drawIndexedTriangleList(irrVertexBuffer.const_pointer(),
vertexCount,
faceBuffer.const_pointer(),
faceCount);
}
else if(draw_mode == DM_WIREFRAME ||
draw_mode == DM_WIREFRAME_AND_SKELETON)
{
/* draw faces */
for (s32 face=0; face<faceCount; ++face)
{
u16 i1, i2, i3;
i1 = faceBuffer[face*3+0];
i2 = faceBuffer[face*3+1];
i3 = faceBuffer[face*3+2];
driver->draw3DLine(core::vector3df(vertexBuffer[i1].X,
vertexBuffer[i1].Y,
vertexBuffer[i1].Z),
core::vector3df(vertexBuffer[i2].X,
vertexBuffer[i2].Y,
vertexBuffer[i2].Z),
video::SColor(255,0,0,255));
driver->draw3DLine(core::vector3df(vertexBuffer[i2].X,
vertexBuffer[i2].Y,
vertexBuffer[i2].Z),
core::vector3df(vertexBuffer[i3].X,
vertexBuffer[i3].Y,
vertexBuffer[i3].Z),
video::SColor(255,0,0,255));
driver->draw3DLine(core::vector3df(vertexBuffer[i3].X,
vertexBuffer[i3].Y,
vertexBuffer[i3].Z),