2010-09-01 10:37:10 +00:00
|
|
|
#ifndef SetBrush_h
|
|
|
|
#define SetBrush_h
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-09 11:46:38 +00:00
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
|
|
|
|
#include "QF/mathlib.h"
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-09 11:46:38 +00:00
|
|
|
#include "TexturePalette.h"
|
|
|
|
|
|
|
|
#define MAX_FACES 16
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
typedef struct {
|
|
|
|
int numpoints;
|
|
|
|
vec5_t points[8]; // variable sized
|
2003-03-18 19:48:24 +00:00
|
|
|
} winding_t;
|
|
|
|
|
|
|
|
#define MAX_POINTS_ON_WINDING 64
|
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
typedef struct {
|
|
|
|
vec3_t normal;
|
|
|
|
float dist;
|
2003-03-18 19:48:24 +00:00
|
|
|
} plane_t;
|
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
typedef struct {
|
2003-03-18 19:48:24 +00:00
|
|
|
// implicit rep
|
2010-09-11 10:06:04 +00:00
|
|
|
vec3_t planepts[3];
|
|
|
|
texturedef_t texture;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// cached rep
|
2010-09-11 10:06:04 +00:00
|
|
|
plane_t plane;
|
|
|
|
qtexture_t *qtexture;
|
|
|
|
float light; // 0 - 1.0
|
|
|
|
winding_t *w;
|
2003-03-18 19:48:24 +00:00
|
|
|
} face_t;
|
|
|
|
|
|
|
|
#define ON_EPSILON 0.1
|
|
|
|
#define FP_EPSILON 0.01
|
|
|
|
#define VECTOR_EPSILON 0.0001
|
|
|
|
|
|
|
|
#define SIDE_FRONT 0
|
|
|
|
#define SIDE_BACK 1
|
|
|
|
#define SIDE_ON 2
|
|
|
|
|
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
winding_t *ClipWinding (winding_t * in, plane_t *split);
|
|
|
|
winding_t *CopyWinding (winding_t * w);
|
|
|
|
winding_t *NewWinding (int points);
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
@interface SetBrush:NSObject {
|
|
|
|
BOOL regioned; // not active
|
|
|
|
BOOL selected;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
BOOL invalid; // not a proper polyhedron
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
id parent; // the entity this brush is in
|
|
|
|
vec3_t bmins, bmaxs;
|
|
|
|
vec3_t entitycolor;
|
|
|
|
int numfaces;
|
|
|
|
face_t faces[MAX_FACES];
|
2003-03-18 19:48:24 +00:00
|
|
|
}
|
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-initOwner: own mins:(float *)
|
|
|
|
mins
|
|
|
|
maxs:(float *)
|
|
|
|
maxs
|
|
|
|
texture:(texturedef_t *)
|
|
|
|
tex;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-initFromScript:(struct script_s *)
|
|
|
|
script
|
|
|
|
owner:
|
|
|
|
own;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-setMins:(float *)
|
|
|
|
mins
|
|
|
|
maxs:(float *)
|
|
|
|
maxs;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-parent;
|
|
|
|
-setParent:(id) p;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-setEntityColor:(vec3_t) color;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-calcWindings;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-writeToFILE:(FILE *)
|
|
|
|
f
|
|
|
|
region:(BOOL)
|
|
|
|
reg;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-(BOOL) selected;
|
|
|
|
-(BOOL) regioned;
|
|
|
|
-setSelected:(BOOL) s;
|
|
|
|
-setRegioned:(BOOL) s;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-getMins:(vec3_t)
|
|
|
|
mins
|
|
|
|
maxs:(vec3_t)
|
|
|
|
maxs;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-(BOOL) containsPoint:(vec3_t) pt;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-freeWindings;
|
|
|
|
-removeIfInvalid;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern vec3_t
|
|
|
|
region_min,
|
|
|
|
region_max;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-newRegion;
|
|
|
|
|
|
|
|
-(texturedef_t *) texturedef;
|
|
|
|
-(texturedef_t *) texturedefForFace:(int) f;
|
|
|
|
-setTexturedef:(texturedef_t *) tex;
|
|
|
|
-setTexturedef:(texturedef_t *)
|
|
|
|
tex
|
|
|
|
forFace:(int)
|
|
|
|
f;
|
|
|
|
|
|
|
|
-XYDrawSelf;
|
|
|
|
-ZDrawSelf;
|
|
|
|
-CameraDrawSelf;
|
|
|
|
-XYRenderSelf;
|
|
|
|
-CameraRenderSelf;
|
|
|
|
|
|
|
|
-hitByRay: (vec3_t) p1: (vec3_t) p2: (float *) time:(int *) face;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// single brush actions
|
|
|
|
//
|
2010-09-11 10:06:04 +00:00
|
|
|
extern int
|
|
|
|
numcontrolpoints;
|
|
|
|
extern float *
|
|
|
|
controlpoints[MAX_FACES * 3];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-getZdragface:(vec3_t) dragpoint;
|
|
|
|
-getXYdragface:(vec3_t) dragpoint;
|
|
|
|
-getXYShearPoints:(vec3_t) dragpoint;
|
|
|
|
|
|
|
|
-addFace:(face_t *) f;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// multiple brush actions
|
|
|
|
//
|
2010-09-11 10:06:04 +00:00
|
|
|
-carveByClipper;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern vec3_t
|
|
|
|
sb_translate;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-translate;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern id
|
|
|
|
carve_in,
|
|
|
|
carve_out;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-select;
|
|
|
|
-deselect;
|
|
|
|
-remove;
|
|
|
|
-flushTextures;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern vec3_t
|
|
|
|
sb_mins,
|
|
|
|
sb_maxs;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-addToBBox;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern vec3_t
|
|
|
|
sel_x,
|
|
|
|
sel_y,
|
|
|
|
sel_z;
|
|
|
|
extern vec3_t
|
|
|
|
sel_org;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-transform;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-flipNormals;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-carve;
|
|
|
|
-setCarveVars;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern id
|
|
|
|
sb_newowner;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
-moveToEntity;
|
|
|
|
|
|
|
|
-takeCurrentTexture;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:06:04 +00:00
|
|
|
extern vec3_t
|
|
|
|
select_min,
|
|
|
|
select_max;
|
|
|
|
|
|
|
|
-selectPartial;
|
|
|
|
-selectComplete;
|
|
|
|
-regionPartial;
|
|
|
|
-regionComplete;
|
|
|
|
|
|
|
|
extern float
|
|
|
|
sb_floor_dir,
|
|
|
|
sb_floor_dist;
|
|
|
|
|
|
|
|
-feetToFloor;
|
|
|
|
|
|
|
|
-(int) getNumBrushFaces;
|
|
|
|
-(face_t *) getBrushFace:(int) which;
|
|
|
|
|
|
|
|
@end
|
|
|
|
#endif // SetBrush_h
|