aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpolymesh.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llpolymesh.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/llpolymesh.cpp')
-rw-r--r--linden/indra/newview/llpolymesh.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/linden/indra/newview/llpolymesh.cpp b/linden/indra/newview/llpolymesh.cpp
index d58ec74..4f339ac 100644
--- a/linden/indra/newview/llpolymesh.cpp
+++ b/linden/indra/newview/llpolymesh.cpp
@@ -261,7 +261,12 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
261 //------------------------------------------------------------------------- 261 //-------------------------------------------------------------------------
262 // Open the file 262 // Open the file
263 //------------------------------------------------------------------------- 263 //-------------------------------------------------------------------------
264 FILE *fp = LLFile::fopen(fileName, "rb"); 264 if(!fileName)
265 {
266 llerrs << "Filename is Empty!" << llendl;
267 return FALSE;
268 }
269 FILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/
265 if (!fp) 270 if (!fp)
266 { 271 {
267 llerrs << "can't open: " << fileName << llendl; 272 llerrs << "can't open: " << fileName << llendl;
@@ -271,14 +276,14 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
271 //------------------------------------------------------------------------- 276 //-------------------------------------------------------------------------
272 // Read a chunk 277 // Read a chunk
273 //------------------------------------------------------------------------- 278 //-------------------------------------------------------------------------
274 char header[128]; 279 char header[128]; /*Flawfinder: ignore*/
275 fread(header, sizeof(char), 128, fp); 280 fread(header, sizeof(char), 128, fp);
276 281
277 //------------------------------------------------------------------------- 282 //-------------------------------------------------------------------------
278 // Check for proper binary header 283 // Check for proper binary header
279 //------------------------------------------------------------------------- 284 //-------------------------------------------------------------------------
280 BOOL status = FALSE; 285 BOOL status = FALSE;
281 if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) 286 if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) /*Flawfinder: ignore*/
282 { 287 {
283 lldebugs << "Loading " << fileName << llendl; 288 lldebugs << "Loading " << fileName << llendl;
284 289
@@ -541,7 +546,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
541 //---------------------------------------------------------------- 546 //----------------------------------------------------------------
542 for (i=0; i < numSkinJoints; i++) 547 for (i=0; i < numSkinJoints; i++)
543 { 548 {
544 char jointName[64]; 549 char jointName[64]; /*Flawfinder: ignore*/
545 numRead = fread(jointName, sizeof(jointName), 1, fp); 550 numRead = fread(jointName, sizeof(jointName), 1, fp);
546 if (numRead != 1) 551 if (numRead != 1)
547 { 552 {
@@ -555,7 +560,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
555 //------------------------------------------------------------------------- 560 //-------------------------------------------------------------------------
556 // look for morph section 561 // look for morph section
557 //------------------------------------------------------------------------- 562 //-------------------------------------------------------------------------
558 char morphName[64]; 563 char morphName[64]; /*Flawfinder: ignore*/
559 while(fread(&morphName, sizeof(char), 64, fp) == 64) 564 while(fread(&morphName, sizeof(char), 64, fp) == 64)
560 { 565 {
561 if (!strcmp(morphName, "End Morphs")) 566 if (!strcmp(morphName, "End Morphs"))
@@ -739,8 +744,8 @@ LLPolyMesh *LLPolyMesh::getMesh(const LLString &name, LLPolyMesh* reference_mesh
739 //------------------------------------------------------------------------- 744 //-------------------------------------------------------------------------
740 // if not found, create a new one, add it to the list 745 // if not found, create a new one, add it to the list
741 //------------------------------------------------------------------------- 746 //-------------------------------------------------------------------------
742 char full_path[LL_MAX_PATH]; 747 char full_path[LL_MAX_PATH]; /*Flawfinder: ignore*/
743 sprintf(full_path, "%s", (gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name.c_str())).c_str()); 748 snprintf(full_path, LL_MAX_PATH, "%s", (gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name.c_str())).c_str()); /*Flawfinder: ignore*/
744 749
745 LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData(); 750 LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData();
746 if (reference_mesh) 751 if (reference_mesh)
@@ -799,7 +804,7 @@ void LLPolyMesh::dumpDiagInfo()
799 U32 total_faces = 0; 804 U32 total_faces = 0;
800 U32 total_kb = 0; 805 U32 total_kb = 0;
801 806
802 char buf[1024]; 807 char buf[1024]; /*Flawfinder: ignore*/
803 808
804 llinfos << "-----------------------------------------------------" << llendl; 809 llinfos << "-----------------------------------------------------" << llendl;
805 llinfos << " Global PolyMesh Table (DEBUG only)" << llendl; 810 llinfos << " Global PolyMesh Table (DEBUG only)" << llendl;
@@ -818,7 +823,7 @@ void LLPolyMesh::dumpDiagInfo()
818 S32 num_faces = mesh.mNumFaces; 823 S32 num_faces = mesh.mNumFaces;
819 U32 num_kb = mesh.getNumKB(); 824 U32 num_kb = mesh.getNumKB();
820 825
821 sprintf(buf, "%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name_p->c_str()); 826 snprintf(buf, sizeof(buf), "%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name_p->c_str()); /*Flawfinder: ignore*/
822 llinfos << buf << llendl; 827 llinfos << buf << llendl;
823 828
824 total_verts += num_verts; 829 total_verts += num_verts;
@@ -827,7 +832,7 @@ void LLPolyMesh::dumpDiagInfo()
827 } 832 }
828 833
829 llinfos << "-----------------------------------------------------" << llendl; 834 llinfos << "-----------------------------------------------------" << llendl;
830 sprintf(buf, "%8d %8d %8d TOTAL", total_verts, total_faces, total_kb ); 835 snprintf(buf, sizeof(buf), "%8d %8d %8d TOTAL", total_verts, total_faces, total_kb ); /*Flawfinder: ignore*/
831 llinfos << buf << llendl; 836 llinfos << buf << llendl;
832 llinfos << "-----------------------------------------------------" << llendl; 837 llinfos << "-----------------------------------------------------" << llendl;
833} 838}
@@ -906,12 +911,12 @@ void LLPolyMesh::initializeForMorph()
906 if (!mSharedData) 911 if (!mSharedData)
907 return; 912 return;
908 913
909 memcpy(mCoords, mSharedData->mBaseCoords, sizeof(LLVector3) * mSharedData->mNumVertices); 914 memcpy(mCoords, mSharedData->mBaseCoords, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
910 memcpy(mNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices); 915 memcpy(mNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
911 memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices); 916 memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
912 memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); 917 memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
913 memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); 918 memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
914 memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices); 919 memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
915 memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices); 920 memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);
916} 921}
917 922
@@ -1070,10 +1075,10 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
1070 mJointScales[joint] = bone_info->mScaleDeformation; 1075 mJointScales[joint] = bone_info->mScaleDeformation;
1071 1076
1072 // apply to children that need to inherit it 1077 // apply to children that need to inherit it
1073 for ( LLViewerJoint *child_joint = (LLViewerJoint *)joint->mChildren.getFirstData(); 1078 for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
1074 child_joint != NULL; 1079 iter != joint->mChildren.end(); ++iter)
1075 child_joint = (LLViewerJoint *)joint->mChildren.getNextData() )
1076 { 1080 {
1081 LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
1077 if (child_joint->inheritScale()) 1082 if (child_joint->inheritScale())
1078 { 1083 {
1079 LLVector3 childDeformation = LLVector3(child_joint->getScale()); 1084 LLVector3 childDeformation = LLVector3(child_joint->getScale());