Files
TeslaRel410/sda4/DPL3/EXAMPLES/STARTDPL.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

203 lines
4.6 KiB
C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dpltypes.h>
#include <dpl.h>
int x_size=832,
y_size=512;
float near_clip=4.0f, far_clip=2000.0f;
/*{{{ static char *find_dpl_arg ( char *dpl_arg, char *find_arg )*/
static char *find_dpl_arg ( char *dpl_arg, char *find_arg )
{
char *check=dpl_arg, *ret=NULL;
int len=strlen(find_arg);
while (*check) {
/* printf ("checking %s with %s, %d chars\n", find_arg, check, len ); */
if (strncmp (check, find_arg, len) == 0) {
/* found it ? */
/* printf ("preliminary match, on %s\n", check ); */
while ((*check) != dpl_arg_sep) {
if ((*check) == 0x0) return NULL;
/* printf ("skipping %c\n", *check ); */
check++;
}
check++;
if ((*check) == 0x0) return NULL;
else {
/* printf ("match, returning %s!\n", check ); */
return check;
}
}
else check++;
}
return NULL;
}
/*}}} */
/*{{{ int screen_resolution ( dpl_argv )*/
int screen_resolution ( char *dpl_argv )
{
char *video=find_dpl_arg ( dpl_argv, "video" );
if (video == NULL) return 0;
if (strncmp ( video, "ntsc", 4 ) == 0) {
x_size=704;
y_size=480;
return 1;
}
if (strncmp ( video, "vga", 3 ) == 0) {
x_size=640;
y_size=480;
return 1;
}
if (strncmp ( video, "hires", 5 ) == 0) {
x_size=1024;
y_size=768;
return 1;
}
if (strncmp ( video, "svga", 4 ) == 0) {
x_size=832;
y_size=512;
return 1;
}
if (strncmp ( video, "nucolor", 7 ) == 0) {
x_size=640;
y_size=480;
return 1;
}
if (strncmp ( video, "kaiser", 6 ) == 0) {
x_size=640;
y_size=480;
return 1;
}
else {
printf ("Unknown video format %s\n", video );
x_size=640;
y_size=480;
return 0;
}
}
/*}}} */
/*{{{ dpl_ZONE *initialize_eyes ( char *dpl_args, int stereo,*/
dpl_ZONE *initialize_eyes ( int stereo,
dpl_VIEW **lye,
dpl_VIEW **rye,
float fog_near )
{
dpl_ZONE *z;
dpl_VIEW *eye;
float fog_far;
if (fog_near > far_clip)
fog_far=fog_near+256;
else
fog_far=far_clip;
printf ("initialize eyes\n" );
z=dpl_NewZone();
printf ("create 1st view\n" );
*lye = dpl_NewView();
if ((*lye) == NULL) {
printf ("NULL eye\n" );
return NULL;
}
eye=*lye;
dpl_SetZoneEnable ( z, 1 );
dpl_AddZoneToScene ( z );
dpl_SetViewClipPlanes ( eye, near_clip, far_clip );
dpl_SetViewBackGround ( eye, 0.4f, 0.6f, 0.9f );
dpl_SetViewFog ( eye, 0, 0.5f, 0.5f, 0.6f, fog_near, fog_far );
dpl_SetViewProjection ( eye, x_size, y_size,
-1.0f, -1.0f, 1.0f, 1.0f,
1.9f );
dpl_AddViewToScene ( eye );
if (stereo == 0) {
*rye=NULL;
}
else {
printf ("create 2nd view\n" );
*rye = dpl_NewView();
if ((*rye) == NULL) {
printf ("NULL rye\n" );
return NULL;
}
eye=*rye;
dpl_SetViewClipPlanes ( eye, near_clip, far_clip );
dpl_SetViewBackGround ( eye, 0.4f, 0.6f, 0.9f );
dpl_SetViewFog ( eye, 0, 0.5f, 0.5f, 0.6f, fog_near, fog_far );
dpl_SetViewProjection ( eye, x_size, y_size,
-1.0f, -1.0f, 1.0f, 1.0f,
1.9f );
dpl_AddViewToScene ( eye );
}
return z;
}
/*}}} */
/*{{{ dpl_ZONE *initialize_all ( char *dpl_args,*/
dpl_ZONE *initialize_all ( char *dpl_args,
int stereo,
dpl_VIEW **lye,
dpl_VIEW **rye,
float fog_near )
{
dpl_ZONE *z;
dpl_PATHITEM *gpathitem, *tpathitem;
dpl_EXTNITEM *gextnitem, *textnitem;
dpl_FILEPATH *gpath, *tpath;
dpl_Init ( dpl_args );
gpath =dpl_NewFilePath();
gpathitem=dpl_NewPathItem();
gextnitem=dpl_NewExtnItem();
tpath =dpl_NewFilePath();
tpathitem=dpl_NewPathItem();
textnitem=dpl_NewExtnItem();
dpl_SetPathItemPath ( gpathitem, "..\\geometry" );
dpl_SetExtnItemExtn ( gextnitem, "b2z" );
dpl_SetPathItemPath ( tpathitem, "..\\texture" );
dpl_SetExtnItemExtn ( textnitem, "svt" );
dpl_AddPathToFilepath ( gpath, gpathitem );
dpl_AddExtToFilepath ( gpath, gextnitem );
dpl_AddPathToFilepath ( tpath, tpathitem );
dpl_AddExtToFilepath ( tpath, textnitem );
dpl_SetGeometryFilePath ( gpath );
dpl_SetTextureFilePath ( tpath );
z = initialize_eyes ( stereo, lye, rye, fog_near );
return z;
}
/*}}} */