00001 /* 00002 * Copyright (c) 1998 by Tech Soft 3D, LLC. 00003 * The information contained herein is confidential and proprietary to 00004 * Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 * civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 * and criminal remedies in the event of unauthorized use or misappropriation 00007 * of its trade secrets. Use of this information by anyone other than 00008 * authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 * written non-disclosure agreement, expressly prescribing the scope and 00010 * manner of such use. 00011 * 00012 * $Id: tandt_8h-source.html,v 1.29 2008-03-10 07:09:28 stage Exp $ 00013 */ 00014 00015 #ifndef TANDT_DEFINED 00016 00017 /* Transform-and-clip data structures and information */ 00018 00019 # define TType_NOT_AT_ALL 1 /* No transform */ 00020 # define TType_XY_To_XY 2 /* HT_XY in --> HT_XY out */ 00021 # define TType_XYZ_To_XY 3 /* XYZ in --> HT_XY out */ 00022 # define TType_XYZ_To_XYZ 0 /* XYZ in --> XYZ out */ 00023 # define TType_XYZ_To_XY_W 5 /* XYZ in --> HT_XY/W out */ 00024 # define TType_XYZ_To_XYZ_W 4 /* XYZ in --> XYZ/W out */ 00025 # define TType_MAX 5 00026 # define Z_TRANSFORM(x) (!ANYBIT(x, 3)) 00027 # define W_TRANSFORM(x) ((x) >= 4) 00028 00029 00030 #define GROSS_CLIP 256 00031 00032 typedef unsigned char HT_Clip_Case; 00033 #define CC_WITHIN (HT_Clip_Case)0x00 00034 #define CC_OFF_TO_LEFT (HT_Clip_Case)0x01 /* must be in order! */ 00035 #define CC_OFF_TO_TOP (HT_Clip_Case)0x02 /* (corner-walking */ 00036 #define CC_OFF_TO_RIGHT (HT_Clip_Case)0x04 /* depends on it.) */ 00037 #define CC_OFF_TO_BOTTOM (HT_Clip_Case)0x08 00038 #define CC_BEHIND_THE_EYE (HT_Clip_Case)0x10 00039 #define CC_CUTTING_PLANE (HT_Clip_Case)0x20 00040 00041 00042 /* "WLIMIT" defines how close to the eye plane something can come without 00043 * being clipped. (HT_Camera target is at W=1.0, camera position is at W=0.0, 00044 * WLIMIT is in between.) The closer to zero it is, the more accurate the 00045 * X and Y but the more wild the Z/W. 00046 */ 00047 #define DEFAULT_WLIMIT -0.001f 00048 00049 00050 00051 #define TRANSA(m, p) ((m)[0][0]*(p).a+(m)[0][1]*(p).b+(m)[0][2]*(p).c+(m)[0][3]*(p).d) 00052 #define TRANSB(m, p) ((m)[1][0]*(p).a+(m)[1][1]*(p).b+(m)[1][2]*(p).c+(m)[1][3]*(p).d) 00053 #define TRANSC(m, p) ((m)[2][0]*(p).a+(m)[2][1]*(p).b+(m)[2][2]*(p).c+(m)[2][3]*(p).d) 00054 #define TRANSD(m, p) ((m)[3][0]*(p).a+(m)[3][1]*(p).b+(m)[3][2]*(p).c+(m)[3][3]*(p).d) 00055 00056 #define TRANSX(m, p) ((m)[0][0]*(p).x+(m)[1][0]*(p).y+(m)[2][0]*(p).z+(m)[3][0]) 00057 #define TRANSY(m, p) ((m)[0][1]*(p).x+(m)[1][1]*(p).y+(m)[2][1]*(p).z+(m)[3][1]) 00058 #define TRANSZ(m, p) ((m)[0][2]*(p).x+(m)[1][2]*(p).y+(m)[2][2]*(p).z+(m)[3][2]) 00059 #define TRANSW(m, p) ((m)[0][3]*(p).x+(m)[1][3]*(p).y+(m)[2][3]*(p).z+(m)[3][3]) 00060 #define TRANS2X(m,p) ((m)[0][0]*(p).x+(m)[1][0]*(p).y+(m)[3][0]) 00061 #define TRANS2Y(m,p) ((m)[0][1]*(p).x+(m)[1][1]*(p).y+(m)[3][1]) 00062 00063 /* Same as TRANSX,Y,Z but for use with vertex parameters... */ 00064 #define TRANS_VPU(m,p) ((m)[0][0]*(p)[0]+(m)[1][0]*(p)[1]+(m)[2][0]*(p)[2]+(m)[3][0]) 00065 #define TRANS_VPV(m,p) ((m)[0][1]*(p)[0]+(m)[1][1]*(p)[1]+(m)[2][1]*(p)[2]+(m)[3][1]) 00066 #define TRANS_VPW(m,p) ((m)[0][2]*(p)[0]+(m)[1][2]*(p)[1]+(m)[2][2]*(p)[2]+(m)[3][2]) 00067 #define TRANS_VPWW(m,p) ((m)[0][3]*(p)[0]+(m)[1][3]*(p)[1]+(m)[2][3]*(p)[2]+(m)[3][3]) 00068 00069 /* TRANS3[XYZ] is a TRANS[XYZ] that assumes the W column is 0 */ 00070 #define TRANS3X(m, p) ((m)[0][0]*(p).x+(m)[1][0]*(p).y+(m)[2][0]*(p).z) 00071 #define TRANS3Y(m, p) ((m)[0][1]*(p).x+(m)[1][1]*(p).y+(m)[2][1]*(p).z) 00072 #define TRANS3Z(m, p) ((m)[0][2]*(p).x+(m)[1][2]*(p).y+(m)[2][2]*(p).z) 00073 00074 #define TANDT_DEFINED 00075 #endif