本文整理汇总了C++中SMeshBuffer::getVertexCount方法的典型用法代码示例。如果您正苦于以下问题:C++ SMeshBuffer::getVertexCount方法的具体用法?C++ SMeshBuffer::getVertexCount怎么用?C++ SMeshBuffer::getVertexCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMeshBuffer
的用法示例。
在下文中一共展示了SMeshBuffer::getVertexCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeshBuffer_SetVertex
void MeshBuffer_SetVertex(IntPtr meshb, unsigned int nr, IntPtr vert)
{
SMeshBuffer *mb = ((SMeshBuffer*)meshb);
if(nr >= mb->getVertexCount())
{
mb->Vertices.push_back(*((S3DVertex*)vert));
MeshBuffer_SetVertex(meshb, nr, vert);
}
else
(((S3DVertex*)(mb->getVertices()))[nr]) = *((S3DVertex*)vert);
}
示例2: MeshBuffer_SetColor
void MeshBuffer_SetColor(IntPtr meshb, M_SCOLOR color)
{
SMeshBuffer *mb = ((SMeshBuffer*)meshb);
int cnt = mb->getVertexCount();
//mb->grab();
for (int i=0;i<cnt;i++)
{
mb->Vertices[i].Color = MU_SCOLOR(color);
}
mb->setDirty(irr::scene::EBT_VERTEX);
}
示例3: createMesh
//.........这里部分代码省略.........
u16 attrib=0;
core::stringc token;
token.reserve(32);
while (file->getPos() < filesize)
{
if (!binary)
{
if (getNextToken(file, token) != "facet")
{
if (token=="endsolid")
break;
mesh->drop();
return 0;
}
if (getNextToken(file, token) != "normal")
{
mesh->drop();
return 0;
}
}
getNextVector(file, normal, binary);
if (!binary)
{
if (getNextToken(file, token) != "outer")
{
mesh->drop();
return 0;
}
if (getNextToken(file, token) != "loop")
{
mesh->drop();
return 0;
}
}
for (u32 i=0; i<3; ++i)
{
if (!binary)
{
if (getNextToken(file, token) != "vertex")
{
mesh->drop();
return 0;
}
}
getNextVector(file, vertex[i], binary);
}
if (!binary)
{
if (getNextToken(file, token) != "endloop")
{
mesh->drop();
return 0;
}
if (getNextToken(file, token) != "endfacet")
{
mesh->drop();
return 0;
}
}
else
{
file->read(&attrib, 2);
#ifdef __BIG_ENDIAN__
attrib = os::Byteswap::byteswap(attrib);
#endif
}
SMeshBuffer* mb = reinterpret_cast<SMeshBuffer*>(mesh->getMeshBuffer(mesh->getMeshBufferCount()-1));
u32 vCount = mb->getVertexCount();
video::SColor color(0xffffffff);
if (attrib & 0x8000)
color = video::A1R5G5B5toA8R8G8B8(attrib);
if (normal==core::vector3df())
normal=core::plane3df(vertex[2],vertex[1],vertex[0]).Normal;
mb->Vertices.push_back(video::S3DVertex(vertex[2],normal,color, core::vector2df()));
mb->Vertices.push_back(video::S3DVertex(vertex[1],normal,color, core::vector2df()));
mb->Vertices.push_back(video::S3DVertex(vertex[0],normal,color, core::vector2df()));
mb->Indices.push_back(vCount);
mb->Indices.push_back(vCount+1);
mb->Indices.push_back(vCount+2);
} // end while (file->getPos() < filesize)
mesh->getMeshBuffer(0)->recalculateBoundingBox();
// Create the Animated mesh if there's anything in the mesh
SAnimatedMesh* pAM = 0;
if ( 0 != mesh->getMeshBufferCount() )
{
mesh->recalculateBoundingBox();
pAM = new SAnimatedMesh();
pAM->Type = EAMT_OBJ;
pAM->addMesh(mesh);
pAM->recalculateBoundingBox();
}
mesh->drop();
return pAM;
}
示例4: axis
GLlink(ISceneNode *i_parent, ISceneManager *i_mgr, s32 i_id,
const LinkInfo &i_li, BodyInfo_var i_binfo) :
ISceneNode(i_parent, i_mgr, i_id),
m_jointId(i_li.jointId) {
setAutomaticCulling(scene::EAC_OFF);
setPosition(vector3df( i_li.translation[0],
-i_li.translation[1],
i_li.translation[2]));
Vector3 axis(i_li.rotation[0],
i_li.rotation[1],
i_li.rotation[2]);
Matrix33 R;
hrp::calcRodrigues(R, axis, i_li.rotation[3]);
Vector3 rpy(rpyFromRot(R));
//std::cout << "rpy:" << rpy << std::endl;
setRotation(vector3df(-180/M_PI*rpy[0],
180/M_PI*rpy[1],
-180/M_PI*rpy[2]));
m_axis << i_li.jointAxis[0], i_li.jointAxis[1], i_li.jointAxis[2];
ShapeInfoSequence_var sis = i_binfo->shapes();
AppearanceInfoSequence_var ais = i_binfo->appearances();
MaterialInfoSequence_var mis = i_binfo->materials();
TextureInfoSequence_var txs = i_binfo->textures();
const TransformedShapeIndexSequence& tsis = i_li.shapeIndices;
core::vector3df vertex;
core::vector3df normal;
for (unsigned int l=0; l<tsis.length(); l++) {
SMesh* mesh = new SMesh();
SMeshBuffer* meshBuffer = new SMeshBuffer();
mesh->addMeshBuffer(meshBuffer);
meshBuffer->drop();
const TransformedShapeIndex &tsi = tsis[l];
short index = tsi.shapeIndex;
ShapeInfo& si = sis[index];
const float *vertices = si.vertices.get_buffer();
const LongSequence& triangles = si.triangles;
const AppearanceInfo& ai = ais[si.appearanceIndex];
const float *normals = ai.normals.get_buffer();
//std::cout << "length of normals = " << ai.normals.length() << std::endl;
const LongSequence& normalIndices = ai.normalIndices;
//std::cout << "length of normalIndices = " << normalIndices.length() << std::endl;
const int numTriangles = triangles.length() / 3;
//std::cout << "numTriangles = " << numTriangles << std::endl;
video::SColor color(0xffffffff);
if (ai.colors.length()) {
color.set(0xff,
0xff*ai.colors[0],
0xff*ai.colors[1],
0xff*ai.colors[2]);
} else if (ai.materialIndex >= 0) {
const MaterialInfo& mi = mis[ai.materialIndex];
color.set(0xff,
0xff*mi.diffuseColor[0],
0xff*mi.diffuseColor[1],
0xff*mi.diffuseColor[2]);
} else {
std::cout << "no material" << std::endl;
}
SMeshBuffer* mb = reinterpret_cast<SMeshBuffer*>(mesh->getMeshBuffer(mesh->getMeshBufferCount()-1));
u32 vCount = mb->getVertexCount();
const DblArray12& tfm = tsi.transformMatrix;
CMatrix4<f32> cmat;
for (int i=0; i<3; i++) {
for (int j=0; j<4; j++) {
cmat[j*4+i] = tfm[i*4+j];
}
}
cmat[3] = cmat[7] = cmat[11] = 0.0;
cmat[15] = 1.0;
vector3df pos = cmat.getTranslation();
pos.Y *= -1;
vector3df rpy = cmat.getRotationDegrees();
rpy.X *= -1;
rpy.Z *= -1;
vector3df scale = cmat.getScale();
const float *textureCoordinate = NULL;
if (ai.textureIndex >= 0) {
textureCoordinate = ai.textureCoordinate.get_buffer();
//std::cout << "length of textureCoordinate:" << ai.textureCoordinate.length() << std::endl;
//std::cout << "length of vertices:" << si.vertices.length() << std::endl;
}
for(int j=0; j < numTriangles; ++j) {
if (!ai.normalPerVertex) {
int p;
if (normalIndices.length() == 0) {
//.........这里部分代码省略.........