1 2 /* 3 A* ------------------------------------------------------------------- 4 B* This file contains source code for the PyMOL computer program 5 C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 6 D* ------------------------------------------------------------------- 7 E* It is unlawful to modify or remove this copyright notice. 8 F* ------------------------------------------------------------------- 9 G* Please see the accompanying LICENSE file for further information. 10 H* ------------------------------------------------------------------- 11 I* Additional authors of this source file include: 12 -* 13 -* 14 -* 15 Z* ------------------------------------------------------------------- 16 */ 17 #ifndef _H_Basis 18 #define _H_Basis 19 20 #include"Map.h" 21 #include"Vector.h" 22 23 #define cPrimSphere 1 24 #define cPrimCylinder 2 25 #define cPrimTriangle 3 26 #define cPrimSausage 4 27 #define cPrimCharacter 5 28 #define cPrimEllipsoid 6 29 #define cPrimCone 7 30 31 32 /* proposed 33 34 #define cPrimNodePush 8 35 #define cPrimNodePop 9 36 #define cPrimNodeAdd 10 37 #define cPrimBreak 11 38 39 */ 40 41 #define cCylCapNone 0 42 #define cCylCapFlat 1 43 #define cCylCapRound 2 44 45 #define cCylShaderCap1Flat 0x01 46 #define cCylShaderCap2Flat 0x02 47 #define cCylShaderCap1RoundBit 0x04 48 #define cCylShaderCap2RoundBit 0x08 49 #define cCylShaderCap1Round (cCylShaderCap1Flat | cCylShaderCap1RoundBit) 50 #define cCylShaderCap2Round (cCylShaderCap2Flat | cCylShaderCap2RoundBit) 51 52 #define cCylShaderInterpColor 0x10 53 #define cCylShaderBothCapsRound (cCylShaderCap1Round | cCylShaderCap2Round) 54 #define cCylShaderBothCapsFlat (cCylShaderCap1Flat | cCylShaderCap2Flat) 55 56 #define cCylShaderMask 0x1F 57 58 typedef struct { 59 int vert; 60 float v1[3], v2[3], v3[3]; 61 float n0[3], n1[3], n2[3], n3[3]; 62 float c1[3], c2[3], c3[3], ic[3], tr[3]; /* ic = interior color, tr = transparency */ 63 float r1, r2, l1; 64 float trans; 65 int char_id; 66 char type, cap1, cap2, cull; 67 char wobble, ramped, no_lighting; 68 /* float wobble_param[3] eliminated to save space */ 69 } CPrimitive; /* currently 172 bytes -> appoximately 6.5 million primitives per gigabyte */ 70 71 typedef struct { 72 PyMOLGlobals *G; 73 MapType *Map; 74 float *Vertex, *Normal, *Precomp; 75 float *Radius, *Radius2, MaxRadius, MinVoxel; 76 int *Vert2Normal; 77 int NVertex; 78 int NNormal; 79 float LightNormal[3]; /* for lights - this is the direction of the light rays */ 80 float SpecNormal[3]; /* for computing specular reflections */ 81 float Color[3]; /* for lights */ 82 Matrix33f Matrix; 83 } CBasis; 84 85 typedef struct { 86 float base[3]; /* where is this light ray starting from */ 87 CPrimitive *prim; 88 float impact[3]; 89 float tri1, tri2; 90 float sphere[3]; /* sphere location if reflecting off of one */ 91 float surfnormal[3]; /* normal of reflecting surface */ 92 float dist; 93 float dotgle, flat_dotgle; 94 float reflect[3]; 95 float trans; 96 float dir[3]; /* what is the direction of this light ray? */ 97 float skip[3]; 98 } RayInfo; 99 100 typedef struct { 101 CBasis *Basis; 102 RayInfo *rr; 103 int except1, except2; /* primitives to avoid */ 104 int *vert2prim; 105 int shadow; 106 float front; 107 float back; 108 float excl_trans; 109 int trans_shadows; 110 int nearest_shadow; 111 int check_interior; 112 int label_shadow_mode; 113 CPrimitive *prim; 114 MapCache cache; 115 float fudge0, fudge1; 116 /* returns */ 117 int interior_flag; 118 int pass; 119 float back_dist; 120 } BasisCallRec; 121 122 int BasisInit(PyMOLGlobals * G, CBasis * I, int group_id); 123 void BasisFinish(CBasis * I, int group_id); 124 int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, 125 float *volume, 126 int group_id, int block_base, 127 int perspective, float front, float size_hint); 128 129 void BasisSetupMatrix(CBasis * I); 130 void BasisGetTriangleNormal(CBasis * I, RayInfo * r, int i, float *fc, int perspective); 131 void BasisGetEllipsoidNormal(CBasis * I, RayInfo * r, int i, int perspective); 132 void BasisTrianglePrecompute(float *v1, float *v2, float *v3, float *pre); 133 void BasisTrianglePrecomputePerspective(float *v1, float *v2, float *v3, float *pre); 134 135 int BasisHitPerspective(BasisCallRec * BC); 136 int BasisHitOrthoscopic(BasisCallRec * BC); 137 int BasisHitShadow(BasisCallRec * BC); 138 139 void BasisGetTriangleFlatDotgle(CBasis * I, RayInfo * r, int i); 140 void BasisGetTriangleFlatDotglePerspective(CBasis * I, RayInfo * r, int i); 141 142 void BasisCylinderSausagePrecompute(float *dir, float *pre); 143 144 #define PROFILE_BASIS_OFF 145 146 #endif 147