diff options
author | Jacek Antonelli | 2008-08-15 23:45:44 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:44 -0500 |
commit | acfdcf2b1deeb04698174c78e8cb22b093445bb1 (patch) | |
tree | 811293650bcf81d01ea7c54d7c2cf263110aa329 /linden/indra/newview/llface.cpp | |
parent | Second Life viewer sources 1.20.2 (diff) | |
download | meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.zip meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.gz meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.bz2 meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.xz |
Second Life viewer sources 1.20.3
Diffstat (limited to 'linden/indra/newview/llface.cpp')
-rw-r--r-- | linden/indra/newview/llface.cpp | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/linden/indra/newview/llface.cpp b/linden/indra/newview/llface.cpp index 0c8de14..f480d8d 100644 --- a/linden/indra/newview/llface.cpp +++ b/linden/indra/newview/llface.cpp | |||
@@ -263,8 +263,14 @@ void LLFace::setDrawable(LLDrawable *drawable) | |||
263 | 263 | ||
264 | void LLFace::setSize(const S32 num_vertices, const S32 num_indices) | 264 | void LLFace::setSize(const S32 num_vertices, const S32 num_indices) |
265 | { | 265 | { |
266 | mGeomCount = num_vertices; | 266 | if (mGeomCount != num_vertices || |
267 | mIndicesCount = num_indices; | 267 | mIndicesCount != num_indices) |
268 | { | ||
269 | mGeomCount = num_vertices; | ||
270 | mIndicesCount = num_indices; | ||
271 | mVertexBuffer = NULL; | ||
272 | mLastVertexBuffer = NULL; | ||
273 | } | ||
268 | } | 274 | } |
269 | 275 | ||
270 | //============================================================================ | 276 | //============================================================================ |
@@ -368,8 +374,6 @@ void LLFace::renderForSelect(U32 data_mask) | |||
368 | #if !LL_RELEASE_FOR_DOWNLOAD | 374 | #if !LL_RELEASE_FOR_DOWNLOAD |
369 | LLGLState::checkClientArrays(data_mask); | 375 | LLGLState::checkClientArrays(data_mask); |
370 | #endif | 376 | #endif |
371 | U16* indicesp = (U16*) mVertexBuffer->getIndicesPointer() + mIndicesIndex; | ||
372 | |||
373 | if (gPickFaces && mTEOffset != -1) | 377 | if (gPickFaces && mTEOffset != -1) |
374 | { | 378 | { |
375 | // mask off high 4 bits (16 total possible faces) | 379 | // mask off high 4 bits (16 total possible faces) |
@@ -386,40 +390,26 @@ void LLFace::renderForSelect(U32 data_mask) | |||
386 | { | 390 | { |
387 | glPushMatrix(); | 391 | glPushMatrix(); |
388 | glMultMatrixf((float*) mDrawablep->getRegion()->mRenderMatrix.mMatrix); | 392 | glMultMatrixf((float*) mDrawablep->getRegion()->mRenderMatrix.mMatrix); |
389 | glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); | 393 | mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); |
390 | glPopMatrix(); | 394 | glPopMatrix(); |
391 | } | 395 | } |
392 | else | 396 | else |
393 | { | 397 | { |
394 | glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); | 398 | mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); |
395 | } | 399 | } |
396 | } | 400 | } |
397 | else | 401 | else |
398 | { | 402 | { |
399 | glPushMatrix(); | 403 | glPushMatrix(); |
400 | glMultMatrixf((float*)getRenderMatrix().mMatrix); | 404 | glMultMatrixf((float*)getRenderMatrix().mMatrix); |
401 | glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); | 405 | mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); |
402 | glPopMatrix(); | ||
403 | } | ||
404 | } | ||
405 | else if (mGeomCount > 0) | ||
406 | { | ||
407 | if (isState(GLOBAL)) | ||
408 | { | ||
409 | glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount); | ||
410 | } | ||
411 | else | ||
412 | { | ||
413 | glPushMatrix(); | ||
414 | glMultMatrixf((float*)getRenderMatrix().mMatrix); | ||
415 | glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount); | ||
416 | glPopMatrix(); | 406 | glPopMatrix(); |
417 | } | 407 | } |
418 | } | 408 | } |
419 | } | 409 | } |
420 | } | 410 | } |
421 | 411 | ||
422 | void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color, const S32 offset, const S32 count) | 412 | void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) |
423 | { | 413 | { |
424 | if(mDrawablep.isNull() || mVertexBuffer.isNull()) | 414 | if(mDrawablep.isNull() || mVertexBuffer.isNull()) |
425 | { | 415 | { |
@@ -443,27 +433,12 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color, const S32 | |||
443 | glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); | 433 | glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); |
444 | } | 434 | } |
445 | 435 | ||
446 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | ||
447 | glEnableClientState(GL_VERTEX_ARRAY); | ||
448 | glEnableClientState(GL_NORMAL_ARRAY); | ||
449 | |||
450 | mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); | 436 | mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); |
451 | #if !LL_RELEASE_FOR_DOWNLOAD | 437 | #if !LL_RELEASE_FOR_DOWNLOAD |
452 | LLGLState::checkClientArrays(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); | 438 | LLGLState::checkClientArrays(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); |
453 | #endif | 439 | #endif |
454 | U16* indicesp = ((U16*) mVertexBuffer->getIndicesPointer()) + mIndicesIndex; | 440 | mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex); |
455 | 441 | ||
456 | if (count) | ||
457 | { | ||
458 | glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, indicesp + offset); | ||
459 | } | ||
460 | else | ||
461 | { | ||
462 | glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); | ||
463 | } | ||
464 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | ||
465 | glDisableClientState(GL_NORMAL_ARRAY); | ||
466 | |||
467 | glPopMatrix(); | 442 | glPopMatrix(); |
468 | } | 443 | } |
469 | } | 444 | } |
@@ -542,8 +517,6 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count) | |||
542 | } | 517 | } |
543 | else | 518 | else |
544 | { | 519 | { |
545 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | ||
546 | glEnableClientState(GL_VERTEX_ARRAY); | ||
547 | llassert(mGeomIndex >= 0); | 520 | llassert(mGeomIndex >= 0); |
548 | if (count) | 521 | if (count) |
549 | { | 522 | { |
@@ -568,7 +541,6 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count) | |||
568 | glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount); | 541 | glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount); |
569 | } | 542 | } |
570 | } | 543 | } |
571 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | ||
572 | } | 544 | } |
573 | 545 | ||
574 | glDisable(GL_POLYGON_OFFSET_FILL); | 546 | glDisable(GL_POLYGON_OFFSET_FILL); |
@@ -1251,16 +1223,7 @@ S32 LLFace::pushVertices(const U16* index_array) const | |||
1251 | { | 1223 | { |
1252 | if (mIndicesCount) | 1224 | if (mIndicesCount) |
1253 | { | 1225 | { |
1254 | if (mGeomCount <= gGLManager.mGLMaxVertexRange && | 1226 | mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); |
1255 | mIndicesCount <= (U32) gGLManager.mGLMaxIndexRange) | ||
1256 | { | ||
1257 | glDrawRangeElements(GL_TRIANGLES, mGeomIndex, mGeomIndex + mGeomCount-1, mIndicesCount, | ||
1258 | GL_UNSIGNED_SHORT, index_array + mIndicesIndex); | ||
1259 | } | ||
1260 | else | ||
1261 | { | ||
1262 | glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, index_array+mIndicesIndex); | ||
1263 | } | ||
1264 | gPipeline.addTrianglesDrawn(mIndicesCount/3); | 1227 | gPipeline.addTrianglesDrawn(mIndicesCount/3); |
1265 | } | 1228 | } |
1266 | 1229 | ||