diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-15 05:43:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-15 05:43:30 +0400 |
commit | c8798090a79edd893250aab1c30e09eec74451b5 (patch) | |
tree | 6583668bdb8713afd7411a81da72cede772e2785 /source/blender | |
parent | a41c0c324a021a2614ef13eb2fe3459f58227abc (diff) |
style changes & replace some memset's with zero initializers.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 25 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 6 |
2 files changed, 10 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 4a33bbdcd4a..d6e90ffab14 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -914,7 +914,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, float (*vertexNos)[3]= emdm->vertexNos; EditVert *eve; EditFace *efa; - DMVertexAttribs attribs; + DMVertexAttribs attribs= {{{0}}}; GPUVertexAttribs gattribs; MTFace *tf; int transp, new_transp, orig_transp, tfoffset; @@ -928,8 +928,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, layer = CustomData_get_layer_index(&em->fdata, CD_MTFACE); tfoffset = (layer == -1)? -1: em->fdata.layers[layer].offset; - memset(&attribs, 0, sizeof(attribs)); - /* always use smooth shading even for flat faces, else vertex colors wont interpolate */ glShadeModel(GL_SMOOTH); @@ -2522,8 +2520,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[ //assert(vert_index>=0 && vert_index<4); SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; - if(pMesh->mtface!=NULL) - { + if(pMesh->mtface!=NULL) { float * uv = pMesh->mtface[face_num].uv[vert_index]; fUV[0]=uv[0]; fUV[1]=uv[1]; } @@ -2539,8 +2536,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH); - if(!smoothnormal) // flat - { + if(!smoothnormal) { // flat if(pMesh->precomputedFaceNormals) { VECCOPY(fNorm, &pMesh->precomputedFaceNormals[3*face_num]); } @@ -2619,14 +2615,10 @@ void DM_add_tangent_layer(DerivedMesh *dm) // new computation method iCalcNewMethod = 1; - if(iCalcNewMethod!=0) - { - SGLSLMeshToTangent mesh2tangent; - SMikkTSpaceContext sContext; - SMikkTSpaceInterface sInterface; - memset(&mesh2tangent, 0, sizeof(SGLSLMeshToTangent)); - memset(&sContext, 0, sizeof(SMikkTSpaceContext)); - memset(&sInterface, 0, sizeof(SMikkTSpaceInterface)); + if(iCalcNewMethod != 0) { + SGLSLMeshToTangent mesh2tangent= {0}; + SMikkTSpaceContext sContext= {0}; + SMikkTSpaceInterface sInterface= {0}; mesh2tangent.precomputedFaceNormals = nors; mesh2tangent.mtface = mtface; @@ -2649,8 +2641,7 @@ void DM_add_tangent_layer(DerivedMesh *dm) iCalcNewMethod = genTangSpaceDefault(&sContext); } - if(!iCalcNewMethod) - { + if(!iCalcNewMethod) { /* sum tangents at connected vertices */ for(i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++) { v1= &mvert[mf->v1]; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index adbcc7c5e72..c1aea4c90fc 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -543,8 +543,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[ MTFace *tface= RE_vlakren_get_tface(pMesh->obr, vlr, pMesh->obr->actmtface, NULL, 0); const float *coord; - if(tface!=NULL) - { + if(tface != NULL) { coord= tface->uv[vert_index]; fUV[0]= coord[0]; fUV[1]= coord[1]; } @@ -570,8 +569,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1); - if(ftang!=NULL) - { + if(ftang!=NULL) { VECCOPY(&ftang[iVert*4+0], fvTangent); ftang[iVert*4+3]=fSign; } |