00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 static char *id="@(#) $Id: shinit.c,v 1.2 2006/08/17 19:28:17 mhender Exp $";
00018
00019 #include <shInternal.h>
00020
00028 void shinit(int *r,int *g,int *b)
00029 {
00030 int i,j;
00031 int full=255;
00032 int zero=0;
00033 float am;
00034 float ad;
00035 float as;
00036 int ae;
00037 float dist,alpha,beta,xmin,xmax;
00038 float ftwo=2.;
00039 int one=1;
00040 int two=2;
00041 float xp,yp,zp;
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 dist=10.;
00059 alpha=0.;
00060 beta=0.;
00061 xmin=0.;
00062 xmax=1.;
00063 shview(&dist,&alpha,&beta,&xmin,&xmax,&xmin,&xmax,&xmin,&xmax);
00064
00065 shnlit(&two);
00066 xp=.3;
00067 yp=.3;
00068 zp=.5;
00069 shlit(&one,&xp,&yp,&zp,&full,&full,&full);
00070 xp=.7;
00071 yp=.3;
00072 zp=-1.;
00073 shlit(&two,&xp,&yp,&zp,&full,&full,&full);
00074
00075 shnpln(&zero);
00076 shmask(&zero);
00077
00078 shRedBackground=*r;
00079 shGreenBackground=*g;
00080 shBlueBackground=*b;
00081
00082 shtric(&full,&full,&full);
00083 shlinc(&full,&full,&full);
00084 shpntc(&full,&full,&full);
00085
00086
00087 am=.3;
00088 ad=.9;
00089 as=.3;
00090 ae=5;
00091 shsrfp(&am,&ad,&as,&ae);
00092
00093 shRedBuffer=(unsigned char*)malloc(shIMax*shJMax*sizeof(unsigned char));
00094 if(shRedBuffer==(unsigned char*)NULL)
00095 {
00096 printf("Out of memory in shinit, allocating %d, line %d in file %s\n",shIMax*shJMax*sizeof(unsigned char),__LINE__,__FILE__);fflush(stdout);
00097 abort();
00098 }
00099 shGreenBuffer=(unsigned char*)malloc(shIMax*shJMax*sizeof(unsigned char));
00100 if(shGreenBuffer==(unsigned char*)NULL)
00101 {
00102 printf("Out of memory in shinit, allocating %d, line %d in file %s\n",shIMax*shJMax*sizeof(unsigned char),__LINE__,__FILE__);fflush(stdout);
00103 abort();
00104 }
00105 shBlueBuffer=(unsigned char*)malloc(shIMax*shJMax*sizeof(unsigned char));
00106 if(shBlueBuffer==(unsigned char*)NULL)
00107 {
00108 printf("Out of memory in shinit, allocating %d, line %d in file %s\n",shIMax*shJMax*sizeof(unsigned char),__LINE__,__FILE__);fflush(stdout);
00109 abort();
00110 }
00111 shZBuffer=(float*)malloc(shIMax*shJMax*sizeof(float));
00112 if(shZBuffer==(float*)NULL)
00113 {
00114 printf("Out of memory in shinit, allocating %d, line %d in file %s\n",shIMax*shJMax*sizeof(float),__LINE__,__FILE__);fflush(stdout);
00115 abort();
00116 }
00117
00118
00119 for(j=0;j<shJMax;j++)
00120 for(i=0;i<shIMax;i++)shsetp(&i,&j,r,g,b,&ftwo);
00121
00122
00123
00124
00125 sh_frame=0;
00126 return;
00127 }
00128
00131
00132
00133 #ifdef SHINITIALIZEHERE
00134 int sh_nlit=0;
00135 int sh_mlit=0;
00136 int *sh_rs=(int*)NULL;
00137 int *sh_gs=(int*)NULL;
00138 int *sh_bs=(int*)NULL;
00139 int *sh_type=(int*)NULL;
00140 double *sh_lit;
00141 #endif
00142
00143
00144
00145 unsigned char *shRedBuffer=(unsigned char*)NULL;
00146 unsigned char *shGreenBuffer=(unsigned char*)NULL;
00147 unsigned char *shBlueBuffer=(unsigned char*)NULL;
00148 float *shZBuffer=(float*)NULL;
00149 int shMax=480;
00150 int shIMax=480;
00151 int shJMax=480;
00152
00153
00154
00155 int shRedBackground=0;
00156 int shGreenBackground=0;
00157 int shBlueBackground=0;
00158
00159
00160
00161 #ifdef SHINITIALIZEHERE
00162 int sh_rl=255;
00163 int sh_gl=255;
00164 int sh_bl=255;
00165 #endif
00166
00167
00168
00169 #ifdef SHINITIALIZEHERE
00170 int shMask=0;
00171 #endif
00172
00173
00174
00175 int sh_frame=0;
00176
00177
00178
00179 #ifdef SHINITIALIZEHERE
00180 int sh_rd[4]={255,255,255,255};
00181 int sh_gd[4]={255,255,255,255};
00182 int sh_bd[4]={255,255,255,255};
00183 int sh_ram[4]={255,255,255,255};
00184 int sh_gam[4]={255,255,255,255};
00185 int sh_bam[4]={255,255,255,255};
00186
00187
00188
00189 int sh_rp=255;
00190 int sh_gp=255;
00191 int sh_bp=255;
00192 #endif
00193
00194
00195
00196 float sh_x0=0.;
00197 float sh_y0=0.;
00198 float sh_z0=0.;
00199
00200
00201
00202 float sh_am=.3;
00203 float sh_ad=.9;
00204 float sh_as=.3;
00205 int sh_nd=5;
00206
00207
00208
00209 int sh_nplns=0;
00210 int sh_mplns=0;
00211 float *sh_plno;
00212 float *sh_plnn;
00213 int *sh_ipln=(int*)NULL;
00214 int *sh_oper=(int*)NULL;
00215
00216
00217
00218 int sh_cFont=0;
00219 int shadow_idx=0;
00220 int shadow_idy=0;
00221
00222 int sh_kFonts=0;
00223 int *sh_kfont=(int*)NULL;
00224
00225 int sh_nFonts=0;
00226 int sh_mFonts=0;
00227 int *sh_dir=(int*)NULL;
00228
00229 int *sh_fmag=(int*)NULL;
00230 char **sh_fontnm=(char**)NULL;
00231
00232 int sh_lenimg=0;
00233 int sh_nimg=0;
00234 char *sh_image=(char*)NULL;
00235
00236
00237
00238 float shv_eye[3]={1.,1.,1.};
00239 float shv_d=10.;
00240 float shv_l=100.;
00241 float shv_n11=1.;
00242 float shv_n12=0.;
00243 float shv_n13=0.;
00244 float shv_n21=0.;
00245 float shv_n22=1.;
00246 float shv_n23=0.;
00247 float shv_n31=0.;
00248 float shv_n32=0.;
00249 float shv_n33=1.;
00250 float shv_x0=0.;
00251 float shv_y0=0.;
00252 float shv_z0=0.;
00253 float shv_pcale=1.;
00254 float shv_soff=0.;
00255 float shv_toff=0.;
00256 float shv_dscl=1.;
00257 float shv_doff=0.;
00258