Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/cloth.c
| Show First 20 Lines • Show All 829 Lines • ▼ Show 20 Lines | static void cloth_from_mesh ( ClothModifierData *clmd, Mesh *mesh ) | ||||
| const unsigned int looptri_num = mesh->runtime.looptris.len; | const unsigned int looptri_num = mesh->runtime.looptris.len; | ||||
| /* Allocate our vertices. */ | /* Allocate our vertices. */ | ||||
| clmd->clothObject->mvert_num = mvert_num; | clmd->clothObject->mvert_num = mvert_num; | ||||
| clmd->clothObject->verts = MEM_callocN(sizeof(ClothVertex) * clmd->clothObject->mvert_num, "clothVertex"); | clmd->clothObject->verts = MEM_callocN(sizeof(ClothVertex) * clmd->clothObject->mvert_num, "clothVertex"); | ||||
| if (clmd->clothObject->verts == NULL) { | if (clmd->clothObject->verts == NULL) { | ||||
| cloth_free_modifier(clmd); | cloth_free_modifier(clmd); | ||||
| modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->verts"); | modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->verts"); | ||||
| printf("cloth_free_modifier clmd->clothObject->verts\n"); | |||||
| return; | return; | ||||
| } | } | ||||
| /* save face information */ | /* save face information */ | ||||
| clmd->clothObject->tri_num = looptri_num; | clmd->clothObject->tri_num = looptri_num; | ||||
| clmd->clothObject->tri = MEM_mallocN(sizeof(MVertTri) * looptri_num, "clothLoopTris"); | clmd->clothObject->tri = MEM_mallocN(sizeof(MVertTri) * looptri_num, "clothLoopTris"); | ||||
| if (clmd->clothObject->tri == NULL) { | if (clmd->clothObject->tri == NULL) { | ||||
| cloth_free_modifier(clmd); | cloth_free_modifier(clmd); | ||||
| modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->looptri"); | modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->looptri"); | ||||
| printf("cloth_free_modifier clmd->clothObject->looptri\n"); | |||||
| return; | return; | ||||
| } | } | ||||
| BKE_mesh_runtime_verttri_from_looptri(clmd->clothObject->tri, mloop, looptri, looptri_num); | BKE_mesh_runtime_verttri_from_looptri(clmd->clothObject->tri, mloop, looptri, looptri_num); | ||||
| /* Free the springs since they can't be correct if the vertices | /* Free the springs since they can't be correct if the vertices | ||||
| * changed. | * changed. | ||||
| */ | */ | ||||
| if ( clmd->clothObject->springs != NULL ) | if ( clmd->clothObject->springs != NULL ) | ||||
| MEM_freeN ( clmd->clothObject->springs ); | MEM_freeN ( clmd->clothObject->springs ); | ||||
| } | } | ||||
| /*************************************************************************************** | /*************************************************************************************** | ||||
| * SPRING NETWORK GPU_BATCH_BUILDING IMPLEMENTATION BEGIN | * SPRING NETWORK GPU_BATCH_BUILDING IMPLEMENTATION BEGIN | ||||
| ***************************************************************************************/ | ***************************************************************************************/ | ||||
| BLI_INLINE void spring_verts_ordered_set(ClothSpring *spring, int v0, int v1) | BLI_INLINE void spring_verts_ordered_set(ClothSpring *spring, int v0, int v1) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 789 Lines • Show Last 20 Lines | |||||