home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / texmap / texmap.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  6KB  |  162 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/texmap/rcs/texmap.h $
  15.  * $Revision: 1.17 $
  16.  * $Author: mike $
  17.  * $Date: 1994/11/10 11:09:16 $
  18.  *
  19.  * Include file for entities using texture mapper library.
  20.  *
  21.  * $Log: texmap.h $
  22.  * Revision 1.17  1994/11/10  11:09:16  mike
  23.  * detail level stuff.
  24.  * 
  25.  * Revision 1.16  1994/11/09  22:55:32  matt
  26.  * Added variable Current_seg_depth for detail level optimization
  27.  * 
  28.  * Revision 1.15  1994/06/09  16:10:04  mike
  29.  * Add prototype for SC2000
  30.  * 
  31.  * Revision 1.14  1994/05/25  18:46:16  matt
  32.  * Added gr_upoly_tmap_ylr(), which generates ylr's for a polygon
  33.  * 
  34.  * Revision 1.13  1994/05/25  09:47:12  mike
  35.  * Added interface support for linear texture mapper (Mike change, Matt commnet)
  36.  * 
  37.  * Revision 1.12  1994/05/24  17:30:43  mike
  38.  * Prototype a bunch of linear, vertical scanning functions.
  39.  * 
  40.  * Revision 1.11  1994/05/19  23:26:14  mike
  41.  * Add constants NUM_LIGHTING_VALUES, MAX_LIGHTING_VALUE, MIN_LIGHTING_VALUE,
  42.  * all part of new lighting_values_in_0_to_1 system.
  43.  * 
  44.  * Revision 1.10  1994/05/14  17:19:21  matt
  45.  * Added externs
  46.  * 
  47.  * Revision 1.9  1994/04/13  23:55:44  matt
  48.  * Increased max_tmap_verts from 16 to 25
  49.  * 
  50.  * Revision 1.8  1994/03/31  08:35:43  mike
  51.  * Prototype for gr_upoly_tmap.
  52.  * 
  53.  * Revision 1.7  1994/02/08  15:17:54  mike
  54.  * define label for MAX_TMAP_VERTS
  55.  * 
  56.  * Revision 1.6  1994/01/31  15:41:51  mike
  57.  * Add texture_map_lin_lin_sky_v
  58.  * 
  59.  * Revision 1.5  1994/01/18  10:49:40  mike
  60.  * prototype for texture_map_lin_lin_sky
  61.  * 
  62.  * Revision 1.4  1993/11/30  17:09:46  mike
  63.  * prototype for compute_lighting_value.
  64.  * 
  65.  * Revision 1.3  1993/11/22  10:50:38  matt
  66.  * Add ifndef around body of file
  67.  * 
  68.  * Revision 1.2  1993/10/06  12:41:25  mike
  69.  * Change prototype for draw_tmap.
  70.  * 
  71.  * Revision 1.1  1993/09/08  17:29:11  mike
  72.  * Initial revision
  73.  * 
  74.  *
  75.  */
  76.  
  77. #ifndef _TEXMAP_H
  78. #define _TEXMAP_H
  79.  
  80. #include "fix.h"
  81. #include "3d.h"
  82. #include "gr.h"
  83.  
  84. #define    NUM_LIGHTING_LEVELS 32
  85. #define MAX_TMAP_VERTS 25
  86. #define MAX_LIGHTING_VALUE    ((NUM_LIGHTING_LEVELS-1)*F1_0/NUM_LIGHTING_LEVELS)
  87. #define MIN_LIGHTING_VALUE    (F1_0/NUM_LIGHTING_LEVELS)
  88.  
  89. // -------------------------------------------------------------------------------------------------------
  90. extern fix compute_lighting_value(g3s_point *vertptr);
  91.  
  92. // -------------------------------------------------------------------------------------------------------
  93. // This is the main texture mapper call.
  94. //    tmap_num references a texture map defined in Texmap_ptrs.
  95. //    nverts = number of vertices
  96. //    vertbuf is a pointer to an array of vertex pointers
  97. extern void draw_tmap(grs_bitmap *bp, int nverts, g3s_point **vertbuf);
  98.  
  99. // -------------------------------------------------------------------------------------------------------
  100. // Texture map vertex.
  101. //    The fields r,g,b and l are mutually exclusive.  r,g,b are used for rgb lighting.
  102. //    l is used for intensity based lighting.
  103. typedef struct g3ds_vertex {
  104.     fix    x,y,z;
  105.     fix    u,v;
  106.     fix    x2d,y2d;
  107.     fix    l;
  108.     fix    r,g,b;
  109. } g3ds_vertex;
  110.  
  111. // A texture map is defined as a polygon with u,v coordinates associated with
  112. // one point in the polygon, and a pair of vectors describing the orientation
  113. // of the texture map in the world, from which the deltas Du_dx, Dv_dy, etc.
  114. // are computed.
  115. typedef struct g3ds_tmap {
  116.     int    nv;            // number of vertices
  117.     g3ds_vertex    verts[MAX_TMAP_VERTS];    // up to 8 vertices, this is inefficient, change
  118. } g3ds_tmap;
  119.  
  120. // -------------------------------------------------------------------------------------------------------
  121.  
  122. //    Note:    Not all interpolation method and lighting combinations are supported.
  123. //    Set Interpolation_method to 0/1/2 for linear/linear, perspective/linear, perspective/perspective
  124. extern    int    Interpolation_method;
  125.  
  126. // Set Lighting_on to 0/1/2 for no lighting/intensity lighting/rgb lighting
  127. extern    int    Lighting_on;
  128.  
  129. // HACK INTERFACE: how far away the current segment (& thus texture) is
  130. extern    int    Current_seg_depth;        
  131. extern    int    Max_perspective_depth;        //    Deepest segment at which perspective interpolation will be used.
  132. extern    int    Max_linear_depth;                //    Deepest segment at which linear interpolation will be used.
  133. extern    int    Max_flat_depth;                //    Deepest segment at which flat shading will be used. (If not flat shading, then what?)
  134.  
  135. //    These are pointers to texture maps.  If you want to render texture map #7, then you will render
  136. //    the texture map defined by Texmap_ptrs[7].
  137. extern    grs_bitmap Texmap_ptrs[];
  138. extern    grs_bitmap Texmap4_ptrs[];
  139.  
  140. // Interface for sky renderer
  141. extern void texture_map_lin_lin_sky(grs_bitmap *srcb, g3ds_tmap *t);
  142. extern void texture_map_lin_lin_sky_v(grs_bitmap *srcb, g3ds_tmap *t);
  143. extern void texture_map_hyp_lin_v(grs_bitmap *srcb, g3ds_tmap *t);
  144.  
  145. extern void ntexture_map_lighted_linear(grs_bitmap *srcb, g3ds_tmap *t);
  146.  
  147. //    This is the gr_upoly-like interface to the texture mapper which uses texture-mapper compatible
  148. //    (ie, avoids cracking) edge/delta computation.
  149. void gr_upoly_tmap(int nverts, int *vert );
  150.  
  151. //This is like gr_upoly_tmap() but instead of drawing, it calls the specified
  152. //function with ylr values
  153. void gr_upoly_tmap_ylr(int nverts, int *vert, void *ylr_func() );
  154.  
  155. extern int Transparency_on,per2_flag;
  156.  
  157. //    Set to !0 to enable Sim City 2000 (or Eric's Drive Through, or Eric's Game) specific code.
  158. extern    int    SC2000;
  159.  
  160. #endif
  161.  
  162.