| 1 |
/* Copyright (c) 1998 Silicon Graphics, Inc. */
|
| 2 |
|
| 3 |
/* SCCSid "$SunId$ SGI" */
|
| 4 |
|
| 5 |
/*
|
| 6 |
* Sample data structures for holodeck display drivers.
|
| 7 |
*/
|
| 8 |
#include "color.h"
|
| 9 |
#include "tonemap.h"
|
| 10 |
#include "rhdriver.h"
|
| 11 |
|
| 12 |
#ifndef int2
|
| 13 |
#define int2 short
|
| 14 |
#endif
|
| 15 |
#ifndef int4
|
| 16 |
#define int4 int
|
| 17 |
#endif
|
| 18 |
|
| 19 |
#ifndef INVALID
|
| 20 |
#define INVALID -1
|
| 21 |
#endif
|
| 22 |
|
| 23 |
typedef struct samp {
|
| 24 |
float (*wp)[3]; /* world intersection point array */
|
| 25 |
int4 *wd; /* world direction array */
|
| 26 |
#ifndef HP_VERSION
|
| 27 |
TMbright *brt; /* encoded brightness array */
|
| 28 |
#endif
|
| 29 |
BYTE (*chr)[3]; /* encoded chrominance array */
|
| 30 |
BYTE (*rgb)[3]; /* tone-mapped color array */
|
| 31 |
int max_samp; /* maximum number of samples */
|
| 32 |
int max_base_pt; /* maximum number of aux points */
|
| 33 |
int next_base_pt; /* next auxilliary point to add */
|
| 34 |
int replace_samp; /* next sample to free */
|
| 35 |
int num_samp; /* current number of samples */
|
| 36 |
int tone_map; /* pointer to next value(s)t tonemap*/
|
| 37 |
int free_samp; /* Available sample */
|
| 38 |
char *base; /* base of allocated memory */
|
| 39 |
} SAMP;
|
| 40 |
|
| 41 |
/* Sample field access macros */
|
| 42 |
#define S_W_PT(s) ((s)->wp)
|
| 43 |
#define S_W_DIR(s) ((s)->wd)
|
| 44 |
#define S_BRT(s) ((s)->brt)
|
| 45 |
#define S_CHR(s) ((s)->chr)
|
| 46 |
#define S_RGB(s) ((s)->rgb)
|
| 47 |
#define S_MAX_SAMP(s) ((s)->max_samp)
|
| 48 |
#define S_MAX_BASE_PT(s) ((s)->max_base_pt)
|
| 49 |
#define S_NEXT_BASE_PT(s) ((s)->next_base_pt)
|
| 50 |
#define S_REPLACE_SAMP(s) ((s)->replace_samp)
|
| 51 |
#define S_NUM_SAMP(s) ((s)->num_samp)
|
| 52 |
#define S_TONE_MAP(s) ((s)->tone_map)
|
| 53 |
#define S_FREE_SAMP(s) ((s)->free_samp)
|
| 54 |
#define S_BASE(s) ((s)->base)
|
| 55 |
|
| 56 |
#define S_MAX_POINTS(s) ((s)->max_base_pt)
|
| 57 |
#define S_NTH_W_PT(s,n) (S_W_PT(s)[(n)])
|
| 58 |
#define S_NTH_W_DIR(s,n) (S_W_DIR(s)[(n)])
|
| 59 |
#define S_NTH_RGB(s,n) (S_RGB(s)[(n)])
|
| 60 |
#define S_NTH_CHR(s,n) (S_CHR(s)[(n)])
|
| 61 |
#ifndef HP_VERSION
|
| 62 |
#define S_NTH_BRT(s,n) (S_BRT(s)[(n)])
|
| 63 |
#endif
|
| 64 |
/* Sample Flag macros */
|
| 65 |
#define S_IS_FLAG(s) IS_FLAG(samp_flag,s)
|
| 66 |
#define S_SET_FLAG(s) SET_FLAG(samp_flag,s)
|
| 67 |
#define S_CLR_FLAG(s) CLR_FLAG(samp_flag,s)
|
| 68 |
|
| 69 |
#define sUnalloc_samp(s,sid) (S_FREE_SAMP(s) = sid)
|
| 70 |
#define sClear_base_points(s) (S_NEXT_BASE_PT(s) = S_MAX_SAMP(s))
|
| 71 |
#define sClear(s) sInit(s)
|
| 72 |
/* Max allowed angle of sample dir from current view */
|
| 73 |
#define MAXANG 20
|
| 74 |
#define MAXDIFF2 ( MAXANG*MAXANG * (PI*PI/180./180.))
|
| 75 |
|
| 76 |
extern SAMP rsL;
|
| 77 |
extern double sDepthEps; /* epsilon to compare depths (z fraction) */
|
| 78 |
extern int4 encodedir(); /* Encodes FVECT direction */
|
| 79 |
extern void decodedir(); /* Decodes dir-> FVECT */
|
| 80 |
extern double fdir2diff(), dir2diff(); /* Compare dir and FVECT */
|
| 81 |
extern int4 *samp_flag; /* Per/sample flags s */
|
| 82 |
|
| 83 |
/* These values are set by the driver, and used in the OGL call for glFrustum*/
|
| 84 |
extern double dev_zmin,dev_zmax;
|
| 85 |
|
| 86 |
extern SAMP *sAlloc();
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|