本文整理汇总了C++中LLVertexBuffer::getTexCoord0Strider方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVertexBuffer::getTexCoord0Strider方法的具体用法?C++ LLVertexBuffer::getTexCoord0Strider怎么用?C++ LLVertexBuffer::getTexCoord0Strider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVertexBuffer
的用法示例。
在下文中一共展示了LLVertexBuffer::getTexCoord0Strider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_vertex_buffers_from_model
void create_vertex_buffers_from_model(LLModel* model, std::vector<LLPointer <LLVertexBuffer> >& vertex_buffers)
{
#if 0 //VECTORIZE THIS ?
vertex_buffers.clear();
for (S32 i = 0; i < model->getNumVolumeFaces(); ++i)
{
const LLVolumeFace &vf = model->getVolumeFace(i);
U32 num_vertices = vf.mNumVertices;
U32 num_indices = vf.mNumIndices;
if (!num_vertices || ! num_indices)
{
continue;
}
LLVertexBuffer* vb =
new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0, 0);
vb->allocateBuffer(num_vertices, num_indices, TRUE);
LLStrider<LLVector3> vertex_strider;
LLStrider<LLVector3> normal_strider;
LLStrider<LLVector2> tc_strider;
LLStrider<U16> index_strider;
vb->getVertexStrider(vertex_strider);
vb->getNormalStrider(normal_strider);
vb->getTexCoord0Strider(tc_strider);
vb->getIndexStrider(index_strider);
// build vertices and normals
for (U32 i = 0; (S32)i < num_vertices; i++)
{
*(vertex_strider++) = vf.mVertices[i].mPosition;
*(tc_strider++) = vf.mVertices[i].mTexCoord;
LLVector3 normal = vf.mVertices[i].mNormal;
normal.normalize();
*(normal_strider++) = normal;
}
// build indices
for (U32 i = 0; i < num_indices; i++)
{
*(index_strider++) = vf.mIndices[i];
}
vertex_buffers.push_back(vb);
}
#endif
}
示例2: getGeometry
void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
{
LLFastTimer ftm(FTM_REBUILD_TERRAIN_VB);
LLVertexBuffer* buffer = group->mVertexBuffer;
//get vertex buffer striders
LLStrider<LLVector3> vertices;
LLStrider<LLVector3> normals;
LLStrider<LLVector2> texcoords2;
LLStrider<LLVector2> texcoords;
LLStrider<U16> indices;
llassert_always(buffer->getVertexStrider(vertices));
llassert_always(buffer->getNormalStrider(normals));
llassert_always(buffer->getTexCoord0Strider(texcoords));
llassert_always(buffer->getTexCoord1Strider(texcoords2));
llassert_always(buffer->getIndexStrider(indices));
U32 indices_index = 0;
U32 index_offset = 0;
for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
{
LLFace* facep = *i;
facep->setIndicesIndex(indices_index);
facep->setGeomIndex(index_offset);
facep->setVertexBuffer(buffer);
LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject();
patchp->getGeometry(vertices, normals, texcoords, texcoords2, indices);
indices_index += facep->getIndicesCount();
index_offset += facep->getGeomCount();
}
buffer->flush();
mFaceList.clear();
}
示例3: getGeometry
void LLParticlePartition::getGeometry(LLSpatialGroup* group)
{
LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
LLFastTimer ftm(mDrawableType == LLPipeline::RENDER_TYPE_GRASS ?
LLFastTimer::FTM_REBUILD_GRASS_VB :
LLFastTimer::FTM_REBUILD_PARTICLE_VB);
std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater());
U32 index_count = 0;
U32 vertex_count = 0;
group->clearDrawMap();
LLVertexBuffer* buffer = group->mVertexBuffer;
LLStrider<U16> indicesp;
LLStrider<LLVector3> verticesp;
LLStrider<LLVector3> normalsp;
LLStrider<LLVector2> texcoordsp;
LLStrider<LLColor4U> colorsp;
buffer->getVertexStrider(verticesp);
buffer->getNormalStrider(normalsp);
buffer->getColorStrider(colorsp);
buffer->getTexCoord0Strider(texcoordsp);
buffer->getIndexStrider(indicesp);
LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
{
LLFace* facep = *i;
LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
facep->setGeomIndex(vertex_count);
facep->setIndicesIndex(index_count);
facep->mVertexBuffer = buffer;
facep->setPoolType(LLDrawPool::POOL_ALPHA);
object->getGeometry(facep->getTEOffset(), verticesp, normalsp, texcoordsp, colorsp, indicesp);
vertex_count += facep->getGeomCount();
index_count += facep->getIndicesCount();
S32 idx = draw_vec.size()-1;
BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
F32 vsize = facep->getVirtualSize();
if (idx >= 0 && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
draw_vec[idx]->mTexture == facep->getTexture() &&
(U16) (draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount()) <= (U32) gGLManager.mGLMaxVertexRange &&
//draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() < 4096 &&
draw_vec[idx]->mFullbright == fullbright)
{
draw_vec[idx]->mCount += facep->getIndicesCount();
draw_vec[idx]->mEnd += facep->getGeomCount();
draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, vsize);
}
else
{
U32 start = facep->getGeomIndex();
U32 end = start + facep->getGeomCount()-1;
U32 offset = facep->getIndicesStart();
U32 count = facep->getIndicesCount();
LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), buffer, fullbright);
info->mExtents[0] = group->mObjectExtents[0];
info->mExtents[1] = group->mObjectExtents[1];
info->mVSize = vsize;
draw_vec.push_back(info);
//for alpha sorting
facep->setDrawInfo(info);
}
}
buffer->setBuffer(0);
mFaceList.clear();
}
示例4: updateMesh
void LLVOTree::updateMesh()
{
LLMatrix4 matrix;
// Translate to tree base HACK - adjustment in Z plants tree underground
const LLVector3 &pos_agent = getPositionAgent();
//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
LLMatrix4 trans_mat;
trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
trans_mat *= matrix;
// Rotate to tree position and bend for current trunk/wind
// Note that trunk stiffness controls the amount of bend at the trunk as
// opposed to the crown of the tree
//
const F32 TRUNK_STIFF = 22.f;
LLQuaternion rot =
LLQuaternion(mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(mTrunkBend.mV[VX], mTrunkBend.mV[VY], 0)) *
LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) *
getRotation();
LLMatrix4 rot_mat(rot);
rot_mat *= trans_mat;
F32 radius = getScale().magVec()*0.05f;
LLMatrix4 scale_mat;
scale_mat.mMatrix[0][0] =
scale_mat.mMatrix[1][1] =
scale_mat.mMatrix[2][2] = radius;
scale_mat *= rot_mat;
// const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f;
// const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f;
F32 droop = mDroop + 25.f*(1.f - mTrunkBend.magVec());
S32 stop_depth = 0;
F32 alpha = 1.0;
U32 vert_count = 0;
U32 index_count = 0;
calcNumVerts(vert_count, index_count, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, mBranches);
LLFace* facep = mDrawable->getFace(0);
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
buff->allocateBuffer(vert_count, index_count, TRUE);
facep->setVertexBuffer(buff);
LLStrider<LLVector3> vertices;
LLStrider<LLVector3> normals;
LLStrider<LLVector2> tex_coords;
LLStrider<U16> indices;
U16 idx_offset = 0;
buff->getVertexStrider(vertices);
buff->getNormalStrider(normals);
buff->getTexCoord0Strider(tex_coords);
buff->getIndexStrider(indices);
genBranchPipeline(vertices, normals, tex_coords, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
mReferenceBuffer->flush();
buff->flush();
}