1 /*
2      PLIB - A Suite of Portable Game Libraries
3      Copyright (C) 1998,2002  Steve Baker
4 
5      This library is free software; you can redistribute it and/or
6      modify it under the terms of the GNU Library General Public
7      License as published by the Free Software Foundation; either
8      version 2 of the License, or (at your option) any later version.
9 
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      Library General Public License for more details.
14 
15      You should have received a copy of the GNU Library General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 
19      For further information visit http://plib.sourceforge.net
20 
21      $Id: ssgLocal.h 1996 2004-12-29 07:19:40Z sjbaker $
22 */
23 
24 
25 #define _SSG_PUBLIC  public
26 
27 #include "ssg.h"
28 
29 void _ssgStartOfFrameInit  () ;
30 void _ssgEndOfFrameCleanup () ;
31 
32 
33 extern void (*__ssgEnableTable[64])() ;
34 extern void (*__ssgDisableTable[64])() ;
35 
36 extern sgMat4 _ssgOpenGLAxisSwapMatrix ;
37 extern int    _ssgIsHotTest ;
38 extern int    _ssgIsLosTest ;
39 extern int    _ssgFileVersionNumber ;
40 
41 void _ssgForceLineState () ;
42 
43 void _ssgDrawDList () ;
44 void _ssgSetTweenState ( float state, int mode ) ;
45 void _ssgPushMatrix ( sgMat4 m ) ;
46 void _ssgPopMatrix  () ;
47 void _ssgLoadMatrix ( sgMat4 m ) ;
48 void _ssgLoadTexMatrix ( sgMat4 m ) ;
49 void _ssgUnloadTexMatrix () ;
50 void _ssgDrawLeaf   ( ssgLeaf *l ) ;
51 
52 void _ssgAddHit ( ssgLeaf *l, int trinum, sgMat4 mat, sgVec4 pl ) ;
53 void _ssgPushPath ( ssgEntity *l ) ;
54 void _ssgPopPath () ;
55 
56 extern int stats_num_vertices    ;
57 extern int stats_num_leaves      ;
58 extern int stats_isect_triangles ;
59 extern int stats_cull_test       ;
60 extern int stats_isect_test      ;
61 extern int stats_bind_textures   ;
62 
63 extern int stats_hot_triangles   ;
64 extern int stats_hot_test        ;
65 extern int stats_hot_no_trav     ;
66 extern int stats_hot_radius_reject ;
67 extern int stats_hot_triv_accept ;
68 extern int stats_hot_straddle    ;
69 
70 extern int stats_los_triangles   ;
71 extern int stats_los_test        ;
72 extern int stats_los_no_trav     ;
73 extern int stats_los_radius_reject ;
74 extern int stats_los_triv_accept ;
75 extern int stats_los_straddle    ;
76 
77 extern ssgState *( *_ssgGetAppState)( char *) ;
78 
79 void _ssgReadFloat   ( FILE *fd,                float *var ) ;
80 void _ssgWriteFloat  ( FILE *fd, const          float  var ) ;
81 void _ssgReadUInt    ( FILE *fd,       unsigned int   *var ) ;
82 void _ssgWriteUInt   ( FILE *fd, const unsigned int    var ) ;
83 void _ssgReadInt     ( FILE *fd,                int   *var ) ;
84 void _ssgWriteInt    ( FILE *fd, const          int    var ) ;
85 void _ssgReadUShort  ( FILE *fd,       unsigned short *var ) ;
86 void _ssgWriteUShort ( FILE *fd, const unsigned short  var ) ;
87 void _ssgReadShort   ( FILE *fd,                short *var ) ;
88 void _ssgWriteShort  ( FILE *fd, const          short  var ) ;
89 
90 void _ssgReadFloat   ( FILE *fd, const unsigned int n,                float *var ) ;
91 void _ssgWriteFloat  ( FILE *fd, const unsigned int n, const          float *var ) ;
92 void _ssgReadUInt    ( FILE *fd, const unsigned int n,       unsigned int   *var ) ;
93 void _ssgWriteUInt   ( FILE *fd, const unsigned int n, const unsigned int   *var ) ;
94 void _ssgReadInt     ( FILE *fd, const unsigned int n,                int   *var ) ;
95 void _ssgWriteInt    ( FILE *fd, const unsigned int n, const          int   *var ) ;
96 void _ssgReadUShort  ( FILE *fd, const unsigned int n,       unsigned short *var ) ;
97 void _ssgWriteUShort ( FILE *fd, const unsigned int n, const unsigned short *var ) ;
98 void _ssgReadShort   ( FILE *fd, const unsigned int n,                short *var ) ;
99 void _ssgWriteShort  ( FILE *fd, const unsigned int n, const          short *var ) ;
100 void _ssgReadBytes   ( FILE *fd, const unsigned int n,                 void *var ) ;
101 void _ssgWriteBytes  ( FILE *fd, const unsigned int n, const           void *var ) ;
102 
103 void _ssgReadString  ( FILE *fd,       char **var ) ;
104 void _ssgWriteString ( FILE *fd, const char  *var ) ;
105 
106 void _ssgReadVec2    ( FILE *fd, sgVec2 var ) ;
107 void _ssgWriteVec2   ( FILE *fd, const sgVec2 var ) ;
108 void _ssgReadVec3    ( FILE *fd, sgVec3 var ) ;
109 void _ssgWriteVec3   ( FILE *fd, const sgVec3 var ) ;
110 void _ssgReadVec4    ( FILE *fd, sgVec4 var ) ;
111 void _ssgWriteVec4   ( FILE *fd, const sgVec4 var ) ;
112 
113 void _ssgReadMat4    ( FILE *fd, sgMat4 var ) ;
114 void _ssgWriteMat4   ( FILE *fd, const sgMat4 var ) ;
115 
116 int _ssgReadError    ( void ) ;
117 int _ssgWriteError   ( void ) ;
118 
119 float _ssgGetCurrentTweenState () ;
120 int   _ssgGetCurrentTweenMode  () ;
121 void  _ssgSetCurrentTweenSettings ( float tweenstate, int tweenmode ) ;
122 void  _ssgSetRealCurrentTweenSettings ( float tweenstate, int tweenmode ) ;
123 
124 /*
125   Routines for storing arbitrary ssgBase derived objects within SSG files.
126   Both functions return 1 on success, and 0 on failure.
127   If an object is encountered that is not derived from type_mask, then
128   the loading is aborted and 0 returned.
129 */
130 int _ssgSaveObject ( FILE * , ssgBase * ) ;
131 int _ssgLoadObject ( FILE * , ssgBase ** , int type_mask = 0 ) ;
132 
133 extern class ssgStatistics _ssgCurrStatistics ;
134 extern bool          _ssgBackFaceCollisions ;
135 
136 
137