/********************************************************************** *< FILE: mesh.h DESCRIPTION: Main include file for triangle meshes. CREATED BY: Don Brittain HISTORY: *> Copyright (c) 1994, All Rights Reserved. **********************************************************************/ #ifndef _MESH_H_ #define _MESH_H_ #include "channels.h" #include "snap.h" #include #include "export.h" #include "vedge.h" //DS #include "utillib.h" #include "tab.h" #include "baseinterface.h" // These typedefs must be the same as each other, since // vertex colors are contained in a MeshMap. typedef Point3 UVVert; typedef Point3 VertColor; #define MESH_USE_EXT_CVARRAY (-32767) #define MESH_MULTI_PROCESSING TRUE // TRUE turns on mp vertex transformation #define MESH_CAGE_BACKFACE_CULLING // for "cage" orange gizmo meshes in EMesh, EPoly, Mesh Select, etc. class ISave; class ILoad; class IHardwareShader; class TriStrip; class MeshNormalSpec; #define NEWMESH class RNormal { public: RNormal() { smGroup = mtlIndex = 0; } void setNormal(const Point3 &nor) { normal = nor; } void addNormal(const Point3 &nor) { normal += nor; } void normalize(void) { normal = Normalize(normal); } Point3 & getNormal(void) { return normal; } void setSmGroup(DWORD g) { smGroup = g; } void addSmGroup(DWORD g) { smGroup |= g; } DWORD getSmGroup(void) { return smGroup; } void setMtlIndex(MtlID i){ mtlIndex = i; } MtlID getMtlIndex(void) { return mtlIndex; } void setRGB(Point3 &clr) { rgb = clr; }; Point3 & getRGB(void) { return rgb; } private: Point3 normal; DWORD smGroup; MtlID mtlIndex; Point3 rgb; }; // RVertex flags: contain clip flags, number of normals at the vertex // and the number of normals that have already been rendered. // fine PLANE_MASK 0x00003f00UL -- now in gfx.h #define NORCT_MASK 0x000000ffUL #define SPECIFIED_NORMAL 0x00004000UL #define OUT_LEFT 0x00010000UL #define OUT_RIGHT 0x00020000UL #define OUT_TOP 0x00040000UL #define OUT_BOTTOM 0x00080000UL #define RECT_MASK 0x000f0000UL #define RND_MASK 0xfff00000UL #define RND_NOR0 0x00100000UL #define RND_NOR(n) (RND_NOR0 << (n)) class RVertex { public: RVertex() { rFlags = 0; ern = NULL; } DllExport ~RVertex(); DWORD rFlags; int pos[3]; RNormal rn; RNormal *ern; }; #if 0 // moved to gfx.h DB 8/7/00 // Face Flags: // 3 LSBs hold the edge visibility flags // Bit 3 indicates the presence of texture verticies // if bit is 1, edge is visible #define EDGE_VIS 1 #define EDGE_INVIS 0 // first edge-visibility bit field #define VIS_BIT 0x0001 #define VIS_MASK 0x0007 #define EDGE_A (1<<0) #define EDGE_B (1<<1) #define EDGE_C (1<<2) #define EDGE_ALL (EDGE_A|EDGE_B|EDGE_C) #define FACE_HIDDEN (1<<3) #define HAS_TVERTS (1<<4) // DO NOT USE: This flag is obselete. #define FACE_WORK (1<<5) // used in various algorithms #define FACE_STRIP (1<<6) // The mat ID is stored in the HIWORD of the face flags #define FACE_MATID_SHIFT 16 #define FACE_MATID_MASK 0xFFFF #endif class Face { public: DWORD v[3]; DWORD smGroup; DWORD flags; Face() { smGroup = flags = 0; } MtlID getMatID() {return (int)((flags>>FACE_MATID_SHIFT)&FACE_MATID_MASK);} void setMatID(MtlID id) {flags &= 0xFFFF; flags |= (DWORD)(id<