Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ScatterSky::_initVBIB()
- {
- SphereMesh sphere(SphereMesh::Icosahedron);
- SphereMesh::TriangleMesh *sphereMesh = sphere.getMesh( 10 );
- // Vertex Buffer...
- mPrimCount = sphereMesh->numPoly;
- mVertCount = mPrimCount * 3;
- mVB.set( GFX, mVertCount, GFXBufferTypeStatic );
- ScatterSkyVertex *pVert = mVB.lock();
- if(!pVert) return;
- for (S32 i=0; i<numPoly; i++)
- {
- for ( S32 j=0; j < 3; ++j )
- {
- pVert->point = sphereMesh->poly[i].pnt[j];
- pVert->point.normalize();
- pVert->point *= 200000.0f;
- pVert++
- }
- }
- mVB.unlock();
- // Primitive Buffer...
- mPrimBuffer.set( GFX, mPrimCount * 3, mPrimCount, GFXBufferTypeStatic );
- U16 *pIdx = NULL;
- mPrimBuffer.lock(&pIdx);
- U32 curIdx = 0;
- for (S32 i=0; i<numPoly; i++)
- {
- U32 offset = i*3;
- pIdx[curIdx] = offset;
- curIdx++;
- pIdx[curIdx] = offset + 1;
- curIdx++;
- pIdx[curIdx] = offset + 2;
- curIdx++;
- }
- mPrimBuffer.unlock();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement