trpage_io.h
来自「最新osg包」· C头文件 代码 · 共 726 行 · 第 1/2 页
H
726 行
/* ************************ Copyright Terrain Experts Inc. Terrain Experts Inc (TERREX) reserves all rights to this source code unless otherwise specified in writing by the President of TERREX. This copyright may be updated in the future, in which case that version supercedes this one. ------------------- Terrex Experts Inc. 4400 East Broadway #314 Tucson, AZ 85711 info@terrex.com Tel: (520) 323-7990 ************************ */#ifndef _trpage_io_h_#define _trpage_io_h_/* trpage_io.h Token definitions and basic classes. */#include <trpage_sys.h>#ifndef TeAttrH/* was unsigned long, but it is used as if it was signed in the constructor * and code that set the handle are using a signed value. * 01-10-2006 David Fries */typedef long TeAttrHdl;#endif// Macros we may need#ifndef MIN// {secret}#define MIN(x,y) (((x) < (y)) ? (x) : (y))#endif#ifndef MAX// {secret}#define MAX(x,y) (((x) > (y)) ? (x) : (y))#endif// File header Magic Number#define TRPG_MAGIC 9480372// Current TerraPage major version#define TRPG_VERSION_MAJOR 2// Current TerraPage minor version#define TRPG_VERSION_MINOR 2// defined values for the version that doesn't need // a merge#define TRPG_NOMERGE_VERSION_MAJOR 2#define TRPG_NOMERGE_VERSION_MINOR 2// Non-existent token// {secret}#define TRPG_NOTOKEN 0// 16 bit token definition value. These are values such as TRPGTEXTABLE or TRPG_ATTACH, etc...typedef short trpgToken;// Tokens for paging data structures// Update the MINTOKEN and MAXTOKEN when you add tokens// {secret}#define TRPG_MINTOKEN 100// {secret}#define TRPG_PUSH 100// {secret}#define TRPG_POP 101// {secret}#define TRPGHEADER 200// {secret}#define TRPGHEAD_LODINFO 201// {secret}#define TRPGMATTABLE 300// Added 11/14/98 - New material table// {secret}#define TRPGMATTABLE2 301 // Added 11/14/98// {secret}#define TRPGSHORTMATTABLE 302 // {secret}#define TRPGMATERIAL 400// {secret}#define TRPGMAT_BASIC 401// {secret}#define TRPGMAT_SHADE 402// {secret}// {secret}#define TRPGMAT_SIZES 403// {secret}#define TRPGMAT_CULL 404// {secret}#define TRPGMAT_ALPHA 405// {secret}#define TRPGMAT_NORMAL 406// {secret}#define TRPGMAT_TEXTURE 407// {secret}#define TRPGMAT_BUMP 408// {secret}#define TRPGMAT_ATTR 409// {secret}#define TRPGMAT_HANDLE 410// {secret}#define TRPGMAT_TEXENV 500// {secret}#define TRPGMAT_TXENV_MODE 501// {secret}#define TRPGMAT_TXENV_FILTER 502// {secret}#define TRPGMAT_TXENV_WRAP 503// {secret}#define TRPGMAT_TXENV_BORDER 504// {secret}#define TRPGTEXTABLE 600// {secret}#define TRPGTEXTABLE2 601// {secret}#define TRPGTEXTURE 650// {secret}#define TRPGMODELREF 700// {secret}#define TRPGMODELREF2 701// {secret}#define TRPGMODELTABLE 800// {secret}#define TRPGTILETABLE 900// {secret}#define TRPG_TILE_ENTRY 901// {secret}#define TRPGTILETABLE2 902// {secret}#define TRPGTILEHEADER 1000// {secret}#define TRPG_TILE_MATLIST 1001// {secret}#define TRPG_TILE_MODELLIST 1002// {secret}#define TRPG_TILE_DATE 1003// {secret}#define TRPGLOCALMATERIAL 1004// {secret}#define TRPG_TILE_LOCMATLIST 1005// Lights support added by Nick// {secret}#define TRPGLIGHTTABLE 1100// {secret}#define TRPGLIGHTATTR 1150// {secret}#define TRPGLIGHTATTR_BASIC 1151// {secret}#define TRPGLIGHTATTR_RASCAL 1152// {secret}#define TRPGLIGHTATTR_CALLIGRAPHIC 1153// {secret}#define TRPGLIGHTATTR_PERFORMER 1154// {secret}#define TRPGLIGHTATTR_ANIMATION 1155// {secret}#define TRPGLIGHTATTR_COMMENT 1156// {secret}#define TRPGLIGHTATTR_HANDLE 1157// {secret}#define TRPGLIGHT 1160// {secret}#define TRPG_LIGHT 1160// {secret}#define TRPGRANGETABLE 1200// {secret}#define TRPG_RANGE 1201// Label and style support added 12-02// {secret}#define TRPG_TEXT_STYLE_TABLE 1300// {secret}#define TRPG_TEXT_STYLE 1301// {secret}#define TRPG_TEXT_STYLE_BASIC 1302// {secret}#define TRPG_SUPPORT_STYLE_TABLE 1310// {secret}#define TRPG_SUPPORT_STYLE 1311// {secret}#define TRPG_SUPPORT_STYLE_BASIC 1312// {secret}#define TRPG_LABEL_PROPERTY_TABLE 1320// {secret}#define TRPG_LABEL_PROPERTY 1321// {secret}#define TRPG_LABEL_PROPERTY_BASIC 1322// {secret}#define TRPG_LABEL 1330// {secret}#define TRPG_GROUP 2001// {secret}#define TRPG_BILLBOARD 2002// {secret}#define TRPG_LOD 2003// {secret}#define TRPG_TRANSFORM 2004// {secret}#define TRPG_MODELREF 2005// {secret}#define TRPG_LAYER 2006// {secret}#define TRPG_GEOMETRY 3000// {secret}#define TRPG_GEOM_PRIM 3001// {secret}#define TRPG_GEOM_MATERIAL 3002// {secret}#define TRPG_GEOM_VERT32 3003// {secret}#define TRPG_GEOM_VERT64 3004// {secret}#define TRPG_GEOM_NORM32 3005// {secret}#define TRPG_GEOM_NORM64 3006// {secret}#define TRPG_GEOM_COLOR 3007// {secret}#define TRPG_GEOM_TEX32 3008// {secret}#define TRPG_GEOM_TEX64 3009// {secret}#define TRPG_GEOM_EFLAG 3010// {secret}#define TRPG_ATTACH 4000// {secret}#define TRPG_CHILDREF 5000// {secret}#define TRPG_MAXTOKEN 5000// Basic data types/* 64 bit disk reference value. */typedef trpgllong trpgDiskRef;// {secret}typedef int trpgMatRef;/* Double precision 2 dimensional point. */TX_EXDECL class TX_CLDECL trpg2dPoint {public: double x, y; trpg2dPoint (void) { }; trpg2dPoint (double in_x,double in_y) { x = in_x; y = in_y; }; bool operator==(const trpg2dPoint& pt ) const { if ( x != pt.x ) return false; if ( y != pt.y ) return false; return true; }; bool operator!=(const trpg2dPoint& pt ) const { return !operator==(pt); };};/* Integer 2 dimensional point. This is used primarily as a 2D index value. */TX_EXDECL class TX_CLDECL trpg2iPoint {public: int x,y; trpg2iPoint (void) { }; trpg2iPoint (int in_x,int in_y) {x = in_x; y = in_y;};};/* Double precision 3 dimensional point. */TX_EXDECL class TX_CLDECL trpg3dPoint {public: double x,y,z; trpg3dPoint(void) { }; trpg3dPoint(double in_x,double in_y,double in_z) {x = in_x; y = in_y; z = in_z;} bool operator==(const trpg3dPoint& pt ) const { if ( x != pt.x ) return false; if ( y != pt.y ) return false; if ( z != pt.z ) return false; return true; }; bool operator!=(const trpg3dPoint& pt ) const { return !operator==(pt); };};/* Simple red, green, blue color definition */TX_EXDECL class TX_CLDECL trpgColor {public: trpgColor(float64 r,float64 g,float64 b) {red = r; green = g; blue = b;} trpgColor(void) { }; bool operator==(const trpgColor& color) { if ( color.red != red ) return false; if ( color.green != green ) return false; if ( color.blue != blue ) return false; return true; }; bool operator!=(const trpgColor& color) { return !operator==(color); }; float64 red,green,blue;};// Used to specify machine endianesstypedef enum {LittleEndian,BigEndian} trpgEndian;/* This is a base class for an abstract buffer type. It contains the virtual methods for writing data to an abstract device. The device implementation is up to the subclass. trpgReadBuffer performs the similar function for reading. {group:Low Level I/O} */TX_EXDECL class TX_CLDECL trpgWriteBuffer {public: virtual ~trpgWriteBuffer(void) { }; /* The add functions must be filled in by the child class They add data of the appropriate type to the current buffer. */ virtual void Add(int32) = 0; virtual void Add(int64) = 0; virtual void Add(const char *) = 0; virtual void Add(float32) = 0; virtual void Add(float64) = 0;//#if (bool != int32) virtual void Add(bool) = 0;//#endif virtual void Add(uint8) = 0;#if (trpgDiskRef != int64) virtual void Add(trpgDiskRef) = 0;#endif virtual void Add(trpgToken) = 0; /* Child class method. Returns the buffer to an original state. */ virtual void Reset(void) = 0; // See trpgMemWriteBuffer for details virtual void Begin(trpgToken) = 0; // See trpgMemWriteBuffer for details virtual void End(void) = 0; // See trpgMemWriteBuffer for details virtual void Push(void) = 0; // See trpgMemWriteBuffer for details virtual void Pop(void) = 0; // Some add functions are helpers for composite values that call the basic add functions virtual void Add(const trpg2iPoint &); virtual void Add(const trpg2dPoint &); virtual void Add(const trpg3dPoint &); virtual void Add(const trpgColor &); virtual void Add(const std::string &); /* Endianness is something the child class buffer type must set and use. This function returns the endiannes of the current buffer. */ virtual trpgEndian GetEndian(void) { return ness; }protected:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?