Files
TeslaRel410/sda4/DPL3/VRENDER/PXPL5SUP/SHADING.C
T
CydandClaude Fable 5 db7745fcd0 sda4: commit the Glaze developer hard-drive dump
Un-ignored: the dev drive is the ground truth the restoration and
emulator work constantly reference (DPL3/LIBDPL + VRENDER i860 renderer
source, BT/RP live+dev game trees, VGL_LABS pod boot, scene/audio
content). Kept in-repo for the pod-owner community.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 19:41:15 -05:00

116 lines
2.7 KiB
C++

/*{{{ about this code*/
/*
This is the shading function of the EMC's in C
it is really so I can get a handle on how much work is needed
in the back-end for end of frame and end of texture
The shading function is
pixel_colour = (fog_colour * fog_fade) +
((1 - fog_fade) *
((instrinsic_colour * diffuse_shading) * texture_colour) +
(specular_colour * light_colour));
*/
/*}}} */
#include <stdio.h>
#include <stdlib.h>
#include "igctypes.h"
#include "pxlmem.h"
#include "igcops.h"
/*{{{ texture memory !*/
int *texture;
/*}}} */
/*{{{ void test_access ( pixel_memory *t )*/
void test_access ( pixel_memory *t )
{
printf ("Starting - t empty\n" );
write_pixmem_bit ( t, 0, 1 );
printf ( "bit 0 now %d should be 1\n", read_pixmem_bit ( t, 0 ));
write_pixmem_bit ( t, 0, 0 );
printf ( "bit 0 now %d should be 0\n", read_pixmem_bit ( t, 0 ));
write_pixmem_bit ( t, 10, 1 );
printf ( "bit 10 now %d should be 1\n", read_pixmem_bit ( t, 10 ));
printf ( "and bit 0 now %d\n", read_pixmem_bit ( t, 0 ));
printf ( "about to write 7 sig bits of -11 into bit 29\n" );
write_pixmem_word ( t, 29, 7, -11 );
printf ( "and read back %d\n", read_pixmem_word ( t, 29, 7, 1 ));
printf ( "about to write 13 sig bits of -196 into bit 79\n" );
write_pixmem_word ( t, 79, 13, -196 );
printf ( "and read back %d\n", read_pixmem_word ( t, 79, 13, 1 ));
}
/*}}} */
/*{{{ pixel_tile *create_pixmem()*/
pixel_tile *create_pixmem()
{
int i;
pixel_tile *tile;
tile=(pixel_tile *) malloc ( sizeof ( pixel_tile ));
printf ("Creating pixel memory\n" );
for (i=0; i<64*128; i++ ) {
pixel_memory *pixel;
pixel=(pixel_memory *) malloc ( sizeof ( pixel_memory ));
if (pixel)
tile->array[i]=pixel;
else {
printf ("NULL Pixel in malloc at i=%d\n", i );
exit (666);
}
}
printf ("Created pixel memory\n" );
return tile;
}
/*}}} */
/*{{{ int *create_texture()*/
int *create_texture()
{
int *tex;
tex=(int *) malloc ( 512 * 512 * sizeof (int));
if (tex)
printf ("Created texture memory\n" );
else {
printf ("Failed to malloc texture RAM\n");
exit (666);
}
return tex;
}
/*}}} */
int main ( int argc, char **argv )
{
int i, j, k, p=0;
printf ("Off we go\n" );
pixtile=create_pixmem();
texture=create_texture();
printf ("Now the big one - clearing 64x128x208 a BIT AT A TIME!\n");
for (i=0; i<128; i++ ) {
for (j=0; j<64; j++ ) {
for (k=0; k<208; k++ ) {
write_pixmem_bit ( t->array[p], k, 0 );
}
p++;
}
}
printf ("DONE !!!\n");
}