📄 t3dlib6.h
字号:
// destructor ///////////////////////////////////////////////////
~CPARSERV1() ;
// reset file system ////////////////////////////////////////////
int Reset();
// open file /////////////////////////////////////////////////////
int Open(char *filename);
// close file ////////////////////////////////////////////////////
int Close();
// get line //////////////////////////////////////////////////////
char *Getline(int mode);
// sets the comment string ///////////////////////////////////////
int SetComment(char *string);
// find pattern in line //////////////////////////////////////////
int Pattern_Match(char *string, char *pattern, ...);
// VARIABLE DECLARATIONS /////////////////////////////////////////
public:
FILE *fstream; // file pointer
char buffer[PARSER_BUFFER_SIZE]; // line buffer
int length; // length of current line
int num_lines; // number of lines processed
char comment[PARSER_MAX_COMMENT]; // single line comment string
// pattern matching parameter storage, easier that variable arguments
// anything matched will be stored here on exit from the call to pattern()
char pstrings[PATTERN_MAX_ARGS][PATTERN_BUFFER_SIZE]; // any strings
int num_pstrings;
float pfloats[PATTERN_MAX_ARGS]; // any floats
int num_pfloats;
int pints[PATTERN_MAX_ARGS]; // any ints
int num_pints;
}; // end CLASS CPARSERV1 //////////////////////////////////////////////
typedef CPARSERV1 *CPARSERV1_PTR;
// MACROS ///////////////////////////////////////////////////////////////////
#define SIGN(x) ((x) > 0 ? (1) : (-1))
// this builds a 32 bit color value in 8.8.8.a format (8-bit alpha mode)
#define _RGBA32BIT(r,g,b,a) ((a) + ((b) << 8) + ((g) << 16) + ((r) << 24))
// this builds extract the RGB components of a 16 bit color value in 5.5.5 format (1-bit alpha mode)
#define _RGB555FROM16BIT(RGB, r,g,b) { *r = ( ((RGB) >> 10) & 0x1f); *g = (((RGB) >> 5) & 0x1f); *b = ( (RGB) & 0x1f); }
// this extracts the RGB components of a 16 bit color value in 5.6.5 format (green dominate mode)
#define _RGB565FROM16BIT(RGB, r,g,b) { *r = ( ((RGB) >> 11) & 0x1f); *g = (((RGB) >> 5) & 0x3f); *b = ((RGB) & 0x1f); }
// TYPES ///////////////////////////////////////////////////////////////////
// PROTOTYPES //////////////////////////////////////////////////////////////
void Draw_OBJECT4DV1_Solid(OBJECT4DV1_PTR obj, UCHAR *video_buffer, int lpitch);
void Draw_RENDERLIST4DV1_Solid(RENDERLIST4DV1_PTR rend_list, UCHAR *video_buffer, int lpitch);
void Draw_OBJECT4DV1_Solid16(OBJECT4DV1_PTR obj, UCHAR *video_buffer, int lpitch);
void Draw_RENDERLIST4DV1_Solid16(RENDERLIST4DV1_PTR rend_list, UCHAR *video_buffer, int lpitch);
int Convert_Bitmap_8_16(BITMAP_FILE_PTR bitmap);
int StripChars(char *string_in, char *string_out, char *strip_chars, int case_on=1);
int ReplaceChars(char *string_in, char *string_out, char *replace_chars, char rep_char, int case_on=1);
char *StringLtrim(char *string);
char *StringRtrim(char *string);
float IsFloat(char *fstring);
int IsInt(char *istring);
int Load_OBJECT4DV1_3DSASC(OBJECT4DV1_PTR obj, char *filename,
VECTOR4D_PTR scale, VECTOR4D_PTR pos, VECTOR4D_PTR rot,
int vertex_flags=0);
int Load_OBJECT4DV1_COB(OBJECT4DV1_PTR obj, // pointer to object
char *filename, // filename of Caligari COB file
VECTOR4D_PTR scale, // initial scaling factors
VECTOR4D_PTR pos, // initial position
VECTOR4D_PTR rot, // initial rotations
int vertex_flags=0); // flags to re-order vertices
// and perform transforms
int RGBto8BitIndex(UCHAR r, UCHAR g, UCHAR b, LPPALETTEENTRY palette, int flush_cache);
int RGB_16_8_Indexed_Intensity_Table_Builder(LPPALETTEENTRY src_palette, // source palette
UCHAR rgbilookup[256][256], // lookup table
int intensity_normalization=1);
int RGB_16_8_IndexedRGB_Table_Builder(int rgb_format, // format we want to build table for
LPPALETTEENTRY src_palette, // source palette
UCHAR *rgblookup); // lookup table
// lighting system
int Init_Light_LIGHTV1(int index, // index of light to create (0..MAX_LIGHTS-1)
int _state, // state of light
int _attr, // type of light, and extra qualifiers
RGBAV1 _c_ambient, // ambient light intensity
RGBAV1 _c_diffuse, // diffuse light intensity
RGBAV1 _c_specular, // specular light intensity
POINT4D_PTR _pos, // position of light
VECTOR4D_PTR _dir, // direction of light
float _kc, // attenuation factors
float _kl,
float _kq,
float _spot_inner, // inner angle for spot light
float _spot_outer, // outer angle for spot light
float _pf); // power factor/falloff for spot lights
int Reset_Lights_LIGHTV1(void);
// material system
int Reset_Materials_MATV1(void);
// inserts an object into renderlist with shaded color override
int Insert_OBJECT4DV1_RENDERLIST4DV12(RENDERLIST4DV1_PTR rend_list,
OBJECT4DV1_PTR obj,
int insert_local=0,
int lighting_on=0);
// light an object
int Light_OBJECT4DV1_World16(OBJECT4DV1_PTR obj, // object to process
CAM4DV1_PTR cam, // camera position
LIGHTV1_PTR lights, // light list (might have more than one)
int max_lights); // maximum lights in list
int Light_OBJECT4DV1_World(OBJECT4DV1_PTR obj, // object to process
CAM4DV1_PTR cam, // camera position
LIGHTV1_PTR lights, // light list (might have more than one)
int max_lights); // maximum lights in list
// light the entire rendering list
int Light_RENDERLIST4DV1_World(RENDERLIST4DV1_PTR rend_list, // list to process
CAM4DV1_PTR cam, // camera position
LIGHTV1_PTR lights, // light list (might have more than one)
int max_lights); // maximum lights in list
// light the entire rendering list
int Light_RENDERLIST4DV1_World16(RENDERLIST4DV1_PTR rend_list, // list to process
CAM4DV1_PTR cam, // camera position
LIGHTV1_PTR lights, // light list (might have more than one)
int max_lights); // maximum lights in list
// z-sort algorithm (simple painters algorithm)
void Sort_RENDERLIST4DV1(RENDERLIST4DV1_PTR rend_list, int sort_method=SORT_POLYLIST_AVGZ);
// avg z-compare
int Compare_AvgZ_POLYF4DV1(const void *arg1, const void *arg2);
// near z-compare
int Compare_NearZ_POLYF4DV1(const void *arg1, const void *arg2);
// far z-compare
int Compare_FarZ_POLYF4DV1(const void *arg1, const void *arg2);
// GLOBALS ///////////////////////////////////////////////////////////////////
extern MATV1 materials[MAX_MATERIALS]; // materials in system
extern int num_materials; // current number of materials
extern LIGHTV1 lights[MAX_LIGHTS]; // lights in system
extern int num_lights; // current number of lights
// these look up tables are used by the 8-bit lighting engine
// the first one holds a color translation table in the form of each
// row is a color 0..255, and each row consists of 256 shades of that color
// the data in each row is the color/intensity indices and the resulting value
// is an 8-bit index into the real color lookup that should be used as the color
// the second table works by each index being a compressed 16bit RGB value
// the data indexed by that RGB value IS the index 0..255 of the real
// color lookup that matches the desired color the closest
extern UCHAR rgbilookup[256][256]; // intensity RGB 8-bit lookup storage
extern UCHAR rgblookup[65536]; // RGB 8-bit color lookup
//////////////////////////////////////////////////////////////////////////////
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -