#include "qedefs.h" id clipper_i; @implementation Clipper - init { [super init]; clipper_i = self; return self; } - (BOOL) hide { int oldnum; oldnum = num; num = 0; return (oldnum > 0); } - flipNormal { vec3_t temp; switch (num) { case 2: VectorCopy (pos[0], temp); VectorCopy (pos[1], pos[0]); VectorCopy (temp, pos[1]); break; case 3: VectorCopy (pos[0], temp); VectorCopy (pos[2], pos[0]); VectorCopy (temp, pos[2]); break; default: qprintf ("no clip plane"); NSBeep (); } return self; } - (BOOL) getFace: (face_t *) f { vec3_t v1, v2, norm; int i; VectorCopy (vec3_origin, plane.normal); plane.dist = 0; if (num < 2) return NO; if (num == 2) { VectorCopy (pos[0], pos[2]); pos[2][2] += 16; } for (i=0 ; i<3 ; i++) VectorCopy (pos[i], f->planepts[i]); VectorSubtract (pos[2], pos[0], v1); VectorSubtract (pos[1], pos[0], v2); CrossProduct (v1, v2, norm); VectorNormalize (norm); if ( !norm[0] && !norm[1] && !norm[2] ) return NO; [texturepalette_i getTextureDef: &f->texture]; return YES; } /* ================ XYClick ================ */ - XYClick: (NSPoint) pt { int i; vec3_t new; new[0] = [xyview_i snapToGrid: pt.x]; new[1] = [xyview_i snapToGrid: pt.y]; new[2] = [map_i currentMinZ]; // see if a point is already there for (i=0 ; ix - pos[i][0] > 10) || fabs(pt->y - pos[i][1] > 10)) continue; // drag this point } return NO; } - ZClick: (NSPoint) pt { return self; } //============================================================================= - carve { [map_i makeSelectedPerform: @selector(carveByClipper)]; num = 0; return self; } - cameraDrawSelf { vec3_t mid; int i; linecolor (1,0.5,0); for (i=0 ; i