| 769 | } |
| 770 | |
| 771 | int GetIndex(const float *p, const float *texCoord) |
| 772 | { |
| 773 | |
| 774 | int vcount = mNumVertices/3; |
| 775 | |
| 776 | if(vcount>0) |
| 777 | { |
| 778 | //New MS STL library checks indices in debug build, so zero causes an assert if it is empty. |
| 779 | const float *v = &mVertices[0]; |
| 780 | const float *t = texCoord != NULL ? &mTexCoords[0] : NULL; |
| 781 | |
| 782 | for (int i=0; i<vcount; i++) |
| 783 | { |
| 784 | if ( v[0] == p[0] && v[1] == p[1] && v[2] == p[2] ) |
| 785 | { |
| 786 | if (texCoord == NULL || (t[0] == texCoord[0] && t[1] == texCoord[1])) |
| 787 | { |
| 788 | return i; |
| 789 | } |
| 790 | } |
| 791 | v+=3; |
| 792 | if (t != NULL) |
| 793 | t += 2; |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | Resize(mVertices, mMaxVertices, mNumVertices, mNumVertices + 3); |
| 798 | mVertices[mNumVertices++] = p[0]; |
| 799 | mVertices[mNumVertices++] = p[1]; |
| 800 | mVertices[mNumVertices++] = p[2]; |
| 801 | |
| 802 | if (texCoord != NULL) |
| 803 | { |
| 804 | Resize(mTexCoords, mMaxTexCoords, mNumTexCoords, mNumTexCoords + 2); |
| 805 | mTexCoords[mNumTexCoords++] = texCoord[0]; |
| 806 | mTexCoords[mNumTexCoords++] = texCoord[1]; |
| 807 | } |
| 808 | |
| 809 | return vcount; |
| 810 | } |
| 811 | |
| 812 | virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3, bool textured) |
| 813 | { |