aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerjointmesh.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llviewerjointmesh.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llviewerjointmesh.cpp')
-rw-r--r--linden/indra/newview/llviewerjointmesh.cpp290
1 files changed, 23 insertions, 267 deletions
diff --git a/linden/indra/newview/llviewerjointmesh.cpp b/linden/indra/newview/llviewerjointmesh.cpp
index d90db4a..5c73319 100644
--- a/linden/indra/newview/llviewerjointmesh.cpp
+++ b/linden/indra/newview/llviewerjointmesh.cpp
@@ -193,48 +193,6 @@ BOOL LLViewerJointMesh::allocateSkinData( U32 numSkinJoints )
193} 193}
194 194
195//----------------------------------------------------------------------------- 195//-----------------------------------------------------------------------------
196// getSkinJointByIndex()
197//-----------------------------------------------------------------------------
198S32 LLViewerJointMesh::getBoundJointsByIndex(S32 index, S32 &joint_a, S32& joint_b)
199{
200 S32 num_joints = 0;
201 if (mNumSkinJoints == 0)
202 {
203 return num_joints;
204 }
205
206 joint_a = -1;
207 joint_b = -1;
208
209 LLPolyMesh *reference_mesh = mMesh->getReferenceMesh();
210
211 if (index < reference_mesh->mJointRenderData.count())
212 {
213 LLJointRenderData* render_datap = reference_mesh->mJointRenderData[index];
214 if (render_datap->mSkinJoint)
215 {
216 joint_a = render_datap->mSkinJoint->mJoint->mJointNum;
217 }
218 num_joints++;
219 }
220 if (index + 1 < reference_mesh->mJointRenderData.count())
221 {
222 LLJointRenderData* render_datap = reference_mesh->mJointRenderData[index + 1];
223 if (render_datap->mSkinJoint)
224 {
225 joint_b = render_datap->mSkinJoint->mJoint->mJointNum;
226
227 if (joint_a == -1)
228 {
229 joint_a = render_datap->mSkinJoint->mJoint->getParent()->mJointNum;
230 }
231 }
232 num_joints++;
233 }
234 return num_joints;
235}
236
237//-----------------------------------------------------------------------------
238// LLViewerJointMesh::freeSkinData() 196// LLViewerJointMesh::freeSkinData()
239//----------------------------------------------------------------------------- 197//-----------------------------------------------------------------------------
240void LLViewerJointMesh::freeSkinData() 198void LLViewerJointMesh::freeSkinData()
@@ -554,6 +512,8 @@ void llDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, G
554 { 512 {
555 glDrawRangeElements(mode,start,end,count,type,indices); 513 glDrawRangeElements(mode,start,end,count,type,indices);
556 } 514 }
515
516 gPipeline.addTrianglesDrawn(count/3);
557} 517}
558 518
559//-------------------------------------------------------------------- 519//--------------------------------------------------------------------
@@ -577,32 +537,13 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
577 //---------------------------------------------------------------- 537 //----------------------------------------------------------------
578 if (!gRenderForSelect) 538 if (!gRenderForSelect)
579 { 539 {
580 if ((mFace->getPool()->getVertexShaderLevel() > 0)) 540 glColor4fv(mColor.mV);
581 {
582 glColor4f(0,0,0,1);
583
584 if (gMaterialIndex > 0)
585 {
586 glVertexAttrib4fvARB(gMaterialIndex, mColor.mV);
587 }
588
589 if (mShiny && gSpecularIndex > 0)
590 {
591 glVertexAttrib4fARB(gSpecularIndex, 1,1,1,1);
592 }
593 }
594 else
595 {
596 glColor4fv(mColor.mV);
597 }
598 } 541 }
599 542
600 stop_glerror(); 543 stop_glerror();
601 544
602 LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), gRenderForSelect ? 0.0f : mShiny && !(mFace->getPool()->getVertexShaderLevel() > 0)); 545 LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), gRenderForSelect ? 0.0f : mShiny && !(mFace->getPool()->getVertexShaderLevel() > 0));
603 546
604 LLGLEnable texture_2d((gRenderForSelect && isTransparent()) ? GL_TEXTURE_2D : 0);
605
606 //---------------------------------------------------------------- 547 //----------------------------------------------------------------
607 // setup current texture 548 // setup current texture
608 //---------------------------------------------------------------- 549 //----------------------------------------------------------------
@@ -660,8 +601,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
660 gImageList.getImage(IMG_DEFAULT_AVATAR)->bind(); 601 gImageList.getImage(IMG_DEFAULT_AVATAR)->bind();
661 } 602 }
662 603
663 LLGLDisable tex(gRenderForSelect && !isTransparent() ? GL_TEXTURE_2D : 0);
664
665 if (gRenderForSelect) 604 if (gRenderForSelect)
666 { 605 {
667 if (isTransparent()) 606 if (isTransparent())
@@ -676,92 +615,18 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
676 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE); // GL_TEXTURE_ENV_COLOR is set in renderPass1 615 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE); // GL_TEXTURE_ENV_COLOR is set in renderPass1
677 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); 616 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
678 } 617 }
679 } 618 else
680 else
681 {
682 //----------------------------------------------------------------
683 // by default, backface culling is enabled
684 //----------------------------------------------------------------
685 /*if (sRenderPass == AVATAR_RENDER_PASS_CLOTHING_INNER)
686 { 619 {
687 LLImageGL::bindExternalTexture( sClothingMaskImageName, 1, GL_TEXTURE_2D ); 620 LLImageGL::unbindTexture(0);
688
689 glClientActiveTextureARB(GL_TEXTURE0_ARB);
690 glActiveTextureARB(GL_TEXTURE0_ARB);
691 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
692 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
693 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
694
695 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
696 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
697
698 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
699 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
700
701 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
702 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
703
704 glClientActiveTextureARB(GL_TEXTURE1_ARB);
705 glEnable(GL_TEXTURE_2D); // Texture unit 1
706 glActiveTextureARB(GL_TEXTURE1_ARB);
707 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
708 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, sClothingInnerColor.mV);
709 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB);
710 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
711
712 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
713 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
714
715 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_CONSTANT_ARB);
716 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
717
718 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
719 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
720
721 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_TEXTURE);
722 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
723 } 621 }
724 else if (sRenderPass == AVATAR_RENDER_PASS_CLOTHING_OUTER)
725 {
726 glAlphaFunc(GL_GREATER, 0.1f);
727 LLImageGL::bindExternalTexture( sClothingMaskImageName, 1, GL_TEXTURE_2D );
728
729 glClientActiveTextureARB(GL_TEXTURE0_ARB);
730 glActiveTextureARB(GL_TEXTURE0_ARB);
731 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
732 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
733 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
734
735 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
736 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
737
738 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
739 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
740
741 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
742 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
743
744 glClientActiveTextureARB(GL_TEXTURE1_ARB);
745 glEnable(GL_TEXTURE_2D); // Texture unit 1
746 glActiveTextureARB(GL_TEXTURE1_ARB);
747 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
748 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
749 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
750
751 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
752 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
753
754 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
755 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
756 }*/
757 } 622 }
758 623
759 mFace->mVertexBuffer->setBuffer(sRenderMask); 624 mFace->mVertexBuffer->setBuffer(sRenderMask);
760 625
761 U32 start = mMesh->mFaceVertexOffset; 626 U32 start = mMesh->mFaceVertexOffset;
762 U32 end = start + mMesh->mFaceVertexCount - 1; 627 U32 end = start + mMesh->mFaceVertexCount - 1;
763 U32 count = mMesh->mFaceIndexCount; 628 U32 count = mMesh->mFaceIndexCount;
764 U32* indicesp = ((U32*) mFace->mVertexBuffer->getIndicesPointer()) + mMesh->mFaceIndexOffset; 629 U16* indicesp = ((U16*) mFace->mVertexBuffer->getIndicesPointer()) + mMesh->mFaceIndexOffset;
765 630
766 if (mMesh->hasWeights()) 631 if (mMesh->hasWeights())
767 { 632 {
@@ -771,11 +636,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
771 { 636 {
772 uploadJointMatrices(); 637 uploadJointMatrices();
773 } 638 }
774 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_INT, indicesp); 639 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp);
775 } 640 }
776 else 641 else
777 { 642 {
778 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_INT, indicesp); 643 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp);
779 } 644 }
780 } 645 }
781 else 646 else
@@ -783,7 +648,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
783 glPushMatrix(); 648 glPushMatrix();
784 LLMatrix4 jointToWorld = getWorldMatrix(); 649 LLMatrix4 jointToWorld = getWorldMatrix();
785 glMultMatrixf((GLfloat*)jointToWorld.mMatrix); 650 glMultMatrixf((GLfloat*)jointToWorld.mMatrix);
786 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_INT, indicesp); 651 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp);
787 glPopMatrix(); 652 glPopMatrix();
788 } 653 }
789 654
@@ -794,21 +659,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
794 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 659 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
795 } 660 }
796 661
797 /*if (sRenderPass != AVATAR_RENDER_PASS_SINGLE)
798 {
799 LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
800 glActiveTextureARB(GL_TEXTURE1_ARB);
801 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
802
803 // Return to the default texture.
804 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
805 glClientActiveTextureARB(GL_TEXTURE0_ARB);
806 glActiveTextureARB(GL_TEXTURE0_ARB);
807
808 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
809 glAlphaFunc(GL_GREATER, 0.01f);
810 }*/
811
812 if (mTexture.notNull()) { 662 if (mTexture.notNull()) {
813 if (!mTexture->getClampS()) { 663 if (!mTexture->getClampS()) {
814 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 664 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -846,37 +696,36 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32
846//----------------------------------------------------------------------------- 696//-----------------------------------------------------------------------------
847void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) 697void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind)
848{ 698{
849 U32 i;
850
851 mFace = face; 699 mFace = face;
852 700
701 if (mFace->mVertexBuffer.isNull())
702 {
703 return;
704 }
705
853 LLStrider<LLVector3> verticesp; 706 LLStrider<LLVector3> verticesp;
854 LLStrider<LLVector3> normalsp; 707 LLStrider<LLVector3> normalsp;
855 LLStrider<LLVector3> binormalsp;
856 LLStrider<LLVector2> tex_coordsp; 708 LLStrider<LLVector2> tex_coordsp;
857 LLStrider<F32> vertex_weightsp; 709 LLStrider<F32> vertex_weightsp;
858 LLStrider<LLVector4> clothing_weightsp; 710 LLStrider<LLVector4> clothing_weightsp;
859 LLStrider<U32> indicesp; 711 LLStrider<U16> indicesp;
860 712
861 // Copy data into the faces from the polymesh data. 713 // Copy data into the faces from the polymesh data.
862 if (mMesh && mValid) 714 if (mMesh && mValid)
863 { 715 {
864 if (mMesh->getNumVertices()) 716 if (mMesh->getNumVertices())
865 { 717 {
866 S32 index = face->getGeometryAvatar(verticesp, normalsp, binormalsp, tex_coordsp, vertex_weightsp, clothing_weightsp); 718 stop_glerror();
719 face->getGeometryAvatar(verticesp, normalsp, tex_coordsp, vertex_weightsp, clothing_weightsp);
720 stop_glerror();
867 face->mVertexBuffer->getIndexStrider(indicesp); 721 face->mVertexBuffer->getIndexStrider(indicesp);
722 stop_glerror();
868 723
869 if (-1 == index) 724 for (U16 i = 0; i < mMesh->getNumVertices(); i++)
870 {
871 return;
872 }
873
874 for (i = 0; i < mMesh->getNumVertices(); i++)
875 { 725 {
876 verticesp[mMesh->mFaceVertexOffset + i] = *(mMesh->getCoords() + i); 726 verticesp[mMesh->mFaceVertexOffset + i] = *(mMesh->getCoords() + i);
877 tex_coordsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getTexCoords() + i); 727 tex_coordsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getTexCoords() + i);
878 normalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getNormals() + i); 728 normalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getNormals() + i);
879 binormalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getBinormals() + i);
880 vertex_weightsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getWeights() + i); 729 vertex_weightsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getWeights() + i);
881 if (damp_wind) 730 if (damp_wind)
882 { 731 {
@@ -1001,6 +850,8 @@ void LLViewerJointMesh::updateGeometryOriginal(LLFace *mFace, LLPolyMesh *mMesh)
1001 850
1002 o_normals[bidx] = normals[index] * gBlendRotMat; 851 o_normals[bidx] = normals[index] * gBlendRotMat;
1003 } 852 }
853
854 buffer->setBuffer(0);
1004} 855}
1005 856
1006const U32 UPDATE_GEOMETRY_CALL_MASK = 0x1FFF; // 8K samples before overflow 857const U32 UPDATE_GEOMETRY_CALL_MASK = 0x1FFF; // 8K samples before overflow
@@ -1166,99 +1017,4 @@ void LLViewerJointMesh::dump()
1166 } 1017 }
1167} 1018}
1168 1019
1169void LLViewerJointMesh::writeCAL3D(apr_file_t* fp, S32 material_num, LLCharacter* characterp)
1170{
1171 apr_file_printf(fp, "\t<SUBMESH NUMVERTICES=\"%d\" NUMFACES=\"%d\" MATERIAL=\"%d\" NUMLODSTEPS=\"0\" NUMSPRINGS=\"0\" NUMTEXCOORDS=\"1\">\n", mMesh->getNumVertices(), mMesh->getNumFaces(), material_num);
1172
1173 const LLVector3* mesh_coords = mMesh->getCoords();
1174 const LLVector3* mesh_normals = mMesh->getNormals();
1175 const LLVector2* mesh_uvs = mMesh->getTexCoords();
1176 const F32* mesh_weights = mMesh->getWeights();
1177 LLVector3 mesh_offset;
1178 LLVector3 scale(1.f, 1.f, 1.f);
1179 S32 joint_a = -1;
1180 S32 joint_b = -1;
1181 S32 num_bound_joints = 0;
1182
1183 if(!mMesh->hasWeights())
1184 {
1185 num_bound_joints = 1;
1186 LLJoint* cur_joint = this;
1187 while(cur_joint)
1188 {
1189 if (cur_joint->mJointNum != -1 && joint_a == -1)
1190 {
1191 joint_a = cur_joint->mJointNum;
1192 }
1193 mesh_offset += cur_joint->getSkinOffset();
1194 cur_joint = cur_joint->getParent();
1195 }
1196 }
1197
1198 for (S32 i = 0; i < (S32)mMesh->getNumVertices(); i++)
1199 {
1200 LLVector3 coord = mesh_coords[i];
1201
1202 if (mMesh->hasWeights())
1203 {
1204 // calculate joint to which this skinned vertex is bound
1205 num_bound_joints = getBoundJointsByIndex(llfloor(mesh_weights[i]), joint_a, joint_b);
1206 LLJoint* first_joint = characterp->getCharacterJoint(joint_a);
1207 LLJoint* second_joint = characterp->getCharacterJoint(joint_b);
1208
1209 LLVector3 first_joint_offset;
1210 LLJoint* cur_joint = first_joint;
1211 while(cur_joint)
1212 {
1213 first_joint_offset += cur_joint->getSkinOffset();
1214 cur_joint = cur_joint->getParent();
1215 }
1216
1217 LLVector3 second_joint_offset;
1218 cur_joint = second_joint;
1219 while(cur_joint)
1220 {
1221 second_joint_offset += cur_joint->getSkinOffset();
1222 cur_joint = cur_joint->getParent();
1223 }
1224
1225 LLVector3 first_coord = coord - first_joint_offset;
1226 first_coord.scaleVec(first_joint->getScale());
1227 LLVector3 second_coord = coord - second_joint_offset;
1228 if (second_joint)
1229 {
1230 second_coord.scaleVec(second_joint->getScale());
1231 }
1232
1233 coord = lerp(first_joint_offset + first_coord, second_joint_offset + second_coord, fmodf(mesh_weights[i], 1.f));
1234 }
1235
1236 // add offset to move rigid mesh to target location
1237 coord += mesh_offset;
1238 coord *= 100.f;
1239
1240 apr_file_printf(fp, " <VERTEX ID=\"%d\" NUMINFLUENCES=\"%d\">\n", i, num_bound_joints);
1241 apr_file_printf(fp, " <POS>%.4f %.4f %.4f</POS>\n", coord.mV[VX], coord.mV[VY], coord.mV[VZ]);
1242 apr_file_printf(fp, " <NORM>%.6f %.6f %.6f</NORM>\n", mesh_normals[i].mV[VX], mesh_normals[i].mV[VY], mesh_normals[i].mV[VZ]);
1243 apr_file_printf(fp, " <TEXCOORD>%.6f %.6f</TEXCOORD>\n", mesh_uvs[i].mV[VX], 1.f - mesh_uvs[i].mV[VY]);
1244 if (num_bound_joints >= 1)
1245 {
1246 apr_file_printf(fp, " <INFLUENCE ID=\"%d\">%.2f</INFLUENCE>\n", joint_a + 1, 1.f - fmod(mesh_weights[i], 1.f));
1247 }
1248 if (num_bound_joints == 2)
1249 {
1250 apr_file_printf(fp, " <INFLUENCE ID=\"%d\">%.2f</INFLUENCE>\n", joint_b + 1, fmod(mesh_weights[i], 1.f));
1251 }
1252 apr_file_printf(fp, " </VERTEX>\n");
1253 }
1254
1255 LLPolyFace* mesh_faces = mMesh->getFaces();
1256 for (S32 i = 0; i < mMesh->getNumFaces(); i++)
1257 {
1258 apr_file_printf(fp, " <FACE VERTEXID=\"%d %d %d\" />\n", mesh_faces[i][0], mesh_faces[i][1], mesh_faces[i][2]);
1259 }
1260
1261 apr_file_printf(fp, " </SUBMESH>\n");
1262}
1263
1264// End 1020// End