MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ScaleFaceUVs

Function ScaleFaceUVs

editor/RoomUVs.cpp:195–215  ·  view source on GitHub ↗

Scale all the UV values in a face from the center point (as defined by averaging the u & v values)

Source from the content-addressed store, hash-verified

193
194// Scale all the UV values in a face from the center point (as defined by averaging the u & v values)
195void ScaleFaceUVs(room *rp, int facenum, float scale) {
196 face *fp = &rp->faces[facenum];
197
198 int i;
199 float midu = 0, midv = 0;
200
201 for (i = 0; i < fp->num_verts; i++) {
202 midu += fp->face_uvls[i].u;
203 midv += fp->face_uvls[i].v;
204 }
205
206 midu /= fp->num_verts;
207 midv /= fp->num_verts;
208
209 for (i = 0; i < fp->num_verts; i++) {
210 fp->face_uvls[i].u = midu + (fp->face_uvls[i].u - midu) * scale;
211 fp->face_uvls[i].v = midv + (fp->face_uvls[i].v - midv) * scale;
212 }
213
214 World_changed = 1;
215}

Callers 1

OnLButtonDownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected