home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * just to initialize some stuff
- */
-
- /*
- * (c) 1988 by George Kyriazis
- */
-
- #include <stdio.h>
- #include "ray.h"
- #include <hypdefs.h>
- #include <hyper.h>
- #include <hypio.h>
- #include <devlib.h>
- #include <devextern.h>
- #include <msgserve.h>
- #include "pxm.h"
-
- #define HOST
- #include "msg.h"
-
- extern send_data();
-
- struct dsp_vector { Ulong x, y, z; };
-
- initialize()
- {
- /* for the moment just initialize the statistics */
- raycount = rayline = 0;
- shadowcount = shadowline = 0;
- reflectcount = reflectline = 0;
- refractcount = refractline = 0;
- intersectcount = intersectline = 0;
- objtestcount = objtestline = 0;
-
- pixel_initialize();
- }
-
- null()
- {
- printf("NULL CALLED!!!!\n\n");
- }
-
- msg_done()
- {
- exit(0);
- }
-
-
- static send_noo(opcode, dsp, node)
- int opcode;
- DrawDsp *dsp;
- int node;
- {
- /* first get the noo buffer */
- pixel_nos[node] = HypDrawGetPir(dsp);
- pixel_nosq[node] = HypDrawGetPir(dsp);
-
- pixel_bgflag[node] = HypDrawGetPir(dsp);
- /* then get the status buffer */
- pixel_status[node] = HypDrawGetPir(dsp);
- }
-
- static msg_print(opcode, dsp, node)
- int opcode;
- DrawDsp *dsp;
- int node;
- {
- int tt;
-
- tt = (int) HypDrawGetPir(dsp);
- printf("%d\n", tt);
- }
-
- static msg_res(opcode, dsp, node)
- int opcode;
- DrawDsp *dsp;
- int node;
- {
- Ushort xxx, yyy, zzz;
- Ushort t1, t2;
- Ushort afov, aeye, aeyedir, aup;
- Ushort afoc, alens;
- Ushort tr = tries;
- short xresdsp = xres;
- int zero = 0;
- Ulong temp;
- struct dsp_vector dtemp;
-
- xxx = HypDrawGetPir(dsp);
- yyy = HypDrawGetPir(dsp);
- t1 = HypDrawGetPir(dsp);
- t2 = HypDrawGetPir(dsp);
- afov = HypDrawGetPir(dsp);
- aeye = HypDrawGetPir(dsp);
- aeyedir = HypDrawGetPir(dsp);
- aup = HypDrawGetPir(dsp);
- afoc = HypDrawGetPir(dsp);
- alens = HypDrawGetPir(dsp);
-
- SHORT_SWAP(xresdsp);
- SHORT_SWAP(tr);
- HypDrawWrite( DEVsystem->draw_dsp[node], xxx,
- &xresdsp, sizeof(short) );
- HypDrawWrite( DEVsystem->draw_dsp[node], yyy,
- &tr, sizeof(short) );
- temp = C_FtoDsp(time1); temp = Swapl(temp);
- HypDrawWrite( DEVsystem->draw_dsp[node], t1,
- &temp, sizeof(Ulong) );
- temp = C_FtoDsp(time2); temp = Swapl(temp);
- HypDrawWrite( DEVsystem->draw_dsp[node], t2,
- &temp, sizeof(Ulong) );
- temp = C_FtoDsp(fov); temp = Swapl(temp);
- HypDrawWrite( DEVsystem->draw_dsp[node], afov,
- &temp, sizeof(Ulong) );
- dtemp.x = C_FtoDsp(eye.x); dtemp.x = Swapl(dtemp.x);
- dtemp.y = C_FtoDsp(eye.y); dtemp.y = Swapl(dtemp.y);
- dtemp.z = C_FtoDsp(eye.z); dtemp.z = Swapl(dtemp.z);
- HypDrawWrite( DEVsystem->draw_dsp[node], aeye,
- &dtemp, sizeof(struct dsp_vector) );
- dtemp.x = C_FtoDsp(eye_dir.x); dtemp.x = Swapl(dtemp.x);
- dtemp.y = C_FtoDsp(eye_dir.y); dtemp.y = Swapl(dtemp.y);
- dtemp.z = C_FtoDsp(eye_dir.z); dtemp.z = Swapl(dtemp.z);
- HypDrawWrite( DEVsystem->draw_dsp[node], aeyedir,
- &dtemp, sizeof(struct dsp_vector) );
- dtemp.x = C_FtoDsp(up.x); dtemp.x = Swapl(dtemp.x);
- dtemp.y = C_FtoDsp(up.y); dtemp.y = Swapl(dtemp.y);
- dtemp.z = C_FtoDsp(up.z); dtemp.z = Swapl(dtemp.z);
- HypDrawWrite( DEVsystem->draw_dsp[node], aup,
- &dtemp, sizeof(struct dsp_vector) );
- temp = C_FtoDsp(foc); temp = Swapl(temp);
- HypDrawWrite( DEVsystem->draw_dsp[node], afoc,
- &temp, sizeof(Ulong) );
- temp = C_FtoDsp(lens); temp = Swapl(temp);
- HypDrawWrite( DEVsystem->draw_dsp[node], alens,
- &temp, sizeof(Ulong) );
- HypDrawWrite( DEVsystem->draw_dsp[node], pixel_status[node],
- &zero, sizeof(int) );
- }
-
- pixel_initialize()
- {
- if( DEVinit() != DEVERR_OK ) {
- fprintf(stderr, "Error during DEVinit\n");
- exit(1);
- }
-
- DEVmsg_init();
- DEVenable_print(DEV_TRUE);
-
- if( DEVuser_msg_enable( MSG_NOO, null, send_noo) != 0 ) {
- fprintf(stderr, "DEVuser_msg_enable failed\n");
- exit(1);
- }
- if( DEVuser_msg_enable( MSG_READY, null, send_data) != 0 ) {
- fprintf(stderr, "DEVuser_msg_enable failed\n");
- exit(1);
- }
- if( DEVuser_msg_enable( MSG_DONE, null, msg_done) != 0 ) {
- fprintf(stderr, "DEVuser_msg_enable failed\n");
- exit(1);
- }
- if( DEVuser_msg_enable( MSG_PRINT, null, msg_print) != 0 ) {
- fprintf(stderr, "DEVuser_msg_enable failed\n");
- exit(1);
- }
- if( DEVuser_msg_enable( MSG_RES, null, msg_res) != 0 ) {
- fprintf(stderr, "DEVuser_msg_enable failed\n");
- exit(1);
- }
-
- DEVpoll_nodes(DEV_NONE, DEV_NONE,
- 0, (DEVsystem->draw_nodes) - 1,
- 2, 1);
- }
-