Copy texture from current face to adjacent face, tiling the UV coordinates Parameters: destrp,destface - room:face that the propagate is based on srcrp,srcface - room:face that is changed Return: 1 if success, 0 if faces not adjacent
| 212 | // srcrp,srcface - room:face that is changed |
| 213 | // Return: 1 if success, 0 if faces not adjacent |
| 214 | int HTexturePropagateToFace(room *destrp, int destface, room *srcrp, int srcface, bool tex) { |
| 215 | face *dfp = &destrp->faces[destface]; |
| 216 | face *sfp = &srcrp->faces[srcface]; |
| 217 | int v0, v1; |
| 218 | |
| 219 | // Get shared edge |
| 220 | if (destrp != srcrp) { // Faces in different rooms |
| 221 | if (!FindSharedEdgeAcrossRooms(destrp, destface, srcrp, srcface, &v0, &v1)) |
| 222 | return 0; |
| 223 | } else { // Faces in same room |
| 224 | if (!FindSharedEdge(dfp, sfp, &v0, &v1)) |
| 225 | return 0; |
| 226 | } |
| 227 | |
| 228 | if (tex) { |
| 229 | #ifdef NEWEDITOR |
| 230 | SwitchTexture(destrp, dfp->tmap, sfp->tmap); |
| 231 | #endif |
| 232 | |
| 233 | // Copy texture from Curface |
| 234 | dfp->tmap = sfp->tmap; |
| 235 | } |
| 236 | |
| 237 | // Assign uvs from shared edge to rest of verts in face |
| 238 | AssignUVsToFace(destrp, destface, &sfp->face_uvls[(v1 + 1) % sfp->num_verts], &sfp->face_uvls[v1], v0, |
| 239 | (v0 + 1) % dfp->num_verts); |
| 240 | |
| 241 | // Success |
| 242 | return 1; |
| 243 | } |
| 244 | |
| 245 | // Copy texture UVs from one face to another |
| 246 | // Parameters: destrp,destface - room:face that is changed |
no test coverage detected