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>
This commit is contained in:
@@ -0,0 +1,372 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <dpl.h>
|
||||
#include <bizread.h>
|
||||
#include <math.h>
|
||||
#include <matrix.h>
|
||||
|
||||
/*{{{ static dpl_node * find ( char *s, int expect )*/
|
||||
static dpl_node * find ( char *s, int expect )
|
||||
{
|
||||
dpl_node *node;
|
||||
|
||||
if (node=dpl_FindNamedNode ( s )) {
|
||||
|
||||
if (expect == 0) {
|
||||
printf ("Unexpectedly found %s, 0x%x type 0x%x\n", s, node, node->type_check );
|
||||
}
|
||||
return node;
|
||||
}
|
||||
else {
|
||||
if (expect)
|
||||
printf ("Unexpectedly couldnt find %s\n", s );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*}}} */
|
||||
|
||||
/*{{{ void dpl_test_1 ( void )*/
|
||||
void dpl_test_1 ( void )
|
||||
{
|
||||
dpl_ZONE *z;
|
||||
dpl_DCS *root;
|
||||
dpl_DCS *dcs1;
|
||||
dpl_DCS *chile;
|
||||
dpl_DCS *bro;
|
||||
|
||||
int i;
|
||||
dpl_LMODEL *lm;
|
||||
dpl_LIGHT *amb;
|
||||
dpl_LIGHT *direct;
|
||||
dpl_VIEW *eye;
|
||||
dpl_VERTEX_LIST *vl;
|
||||
dpl_INSTANCE *ins;
|
||||
dpl_OBJECT *obj;
|
||||
dpl_LOD *lod;
|
||||
dpl_MATRIX m;
|
||||
dpl_MATERIAL *frig, *firstpatch;
|
||||
float32 cx, cy, cz;
|
||||
|
||||
z=dpl_NewZone();
|
||||
|
||||
root = dpl_NewDcs();
|
||||
dcs1 = dpl_NewDcs();
|
||||
chile = dpl_NewDcs();
|
||||
bro = dpl_NewDcs();
|
||||
|
||||
dpl_NestDcs ( root, dcs1 );
|
||||
dpl_NestDcs ( dcs1, chile );
|
||||
dpl_LinkDcs ( chile, bro );
|
||||
|
||||
eye = dpl_NewView();
|
||||
|
||||
dpl_SetViewClipPlanes ( eye, 30.0f, 10000.0f );
|
||||
dpl_SetViewBackGround ( eye, 0.4f, 0.6f, 0.9f );
|
||||
dpl_SetViewFog ( eye, 1, 0.5f, 0.5f, 0.6f, 5000.0f, 10000.0f );
|
||||
dpl_SetViewProjection ( eye, 832.0f, 512.0f,
|
||||
-1.0f, -1.0f, 1.0f, 1.0f,
|
||||
2.0f );
|
||||
|
||||
dpl_IdMatrix ( m );
|
||||
dpl_Rotate ( m, 180.0f, dpl_Y );
|
||||
dpl_Translate ( m, 0.0f, 0.0f, -250.0f );
|
||||
dpl_SetViewMatrix ( eye, m );
|
||||
|
||||
lm = dpl_NewLmodel();
|
||||
|
||||
amb = dpl_NewLight();
|
||||
direct= dpl_NewLight();
|
||||
|
||||
dpl_SetLightType ( amb, dpl_light_type_ambient );
|
||||
dpl_SetLightColor ( amb, 0.2f, 0.3f, 0.5f );
|
||||
|
||||
dpl_SetLightType ( direct, dpl_light_type_directional );
|
||||
dpl_SetLightColor ( direct, 0.8f, 0.8f, 0.6f );
|
||||
dpl_SetDcsLight ( root, direct );
|
||||
|
||||
dpl_SetZoneLmodel ( z, lm );
|
||||
dpl_SetZoneRootDcs ( z, root );
|
||||
|
||||
dpl_AddLightToLmodel ( lm, amb );
|
||||
dpl_AddLightToLmodel ( lm, direct );
|
||||
|
||||
dpl_AddViewToScene ( eye );
|
||||
dpl_AddZoneToScene ( z );
|
||||
dpl_SetZoneEnable ( z, 1 );
|
||||
|
||||
ins=dpl_NewInstance ();
|
||||
/*
|
||||
obj=b2zread("globo.b2z" );
|
||||
obj=b2zread("grouper.b2z");
|
||||
obj=b2zread("terr46.b2z" );
|
||||
*/
|
||||
obj=b2zread("little.b2z" );
|
||||
|
||||
lod=dpl_GetObjectFirstLod ( obj );
|
||||
|
||||
cx=(lod->bounds[0][0]+lod->bounds[1][0]) * 0.5f;
|
||||
cy=(lod->bounds[0][1]+lod->bounds[1][1]) * 0.5f;
|
||||
cz=(lod->bounds[0][2]+lod->bounds[1][2]) * 0.5f;
|
||||
|
||||
dpl_SetDcsInstance ( chile, ins);
|
||||
dpl_SetInstanceObject ( ins, obj );
|
||||
|
||||
/* first apply a scale to parent node */
|
||||
dpl_Scale ( dcs1->matrix, 9.0f, 9.0f, 9.0f );
|
||||
dpl_Flush ( dcs1 );
|
||||
|
||||
frig =dpl_NewMaterial();
|
||||
firstpatch=((dpl_GEOGROUP *) (lod->geogroup_list.head->item))->f_material;
|
||||
|
||||
frig->texture=firstpatch->texture;
|
||||
memcpy ( frig->emissive, firstpatch->emissive, 16*sizeof(float));
|
||||
frig->ramp=firstpatch->ramp;
|
||||
|
||||
dpl_Flush(frig);
|
||||
|
||||
dpl_SetInstanceFrontMaterial ( ins, frig );
|
||||
dpl_SetInstanceBackMaterial ( ins, frig );
|
||||
/*
|
||||
*/
|
||||
{
|
||||
float alpha=0.0f;
|
||||
int angle=0, alphacycle=0;
|
||||
|
||||
while (1) {
|
||||
dpl_MATRIX m;
|
||||
angle++;
|
||||
|
||||
if (alphacycle < 200) {
|
||||
alpha=1.0f;
|
||||
}
|
||||
else {
|
||||
if (alphacycle > 300) {
|
||||
alphacycle=0;
|
||||
alpha=1.0f;
|
||||
}
|
||||
else if (alphacycle > 264) {
|
||||
alpha=0.0f;
|
||||
}
|
||||
else {
|
||||
alpha=1.0f - (((float) (alphacycle-200)) / 64.0f);
|
||||
if (alpha < 0.0f)
|
||||
alpha=0.0f;
|
||||
else if (alpha > 1.0f)
|
||||
alpha=1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
dpl_SetMaterialOpacity ( frig, alpha, alpha, alpha );
|
||||
|
||||
alphacycle++;
|
||||
|
||||
dpl_IdMatrix ( m );
|
||||
dpl_Translate ( m, -cx, -cy, -cz );
|
||||
dpl_Rotate ( m, angle*2.0f, dpl_Y );
|
||||
dpl_Rotate ( m, angle*1.37f, dpl_X );
|
||||
dpl_Rotate ( m, angle*0.739f, dpl_Z );
|
||||
dpl_SetDcsMatrix ( chile, m );
|
||||
|
||||
dpl_DrawScene ( 1 );
|
||||
/* printf ("draw scene frame %d\n", angle ); */
|
||||
}
|
||||
}
|
||||
|
||||
dpl_RemoveViewFromScene ( eye );
|
||||
dpl_RemoveZoneFromScene ( z );
|
||||
|
||||
dpl_RemoveLightFromLmodel ( lm, amb );
|
||||
dpl_RemoveLightFromLmodel ( lm, direct );
|
||||
|
||||
dpl_DeleteLight ( amb );
|
||||
dpl_DeleteLight ( direct );
|
||||
|
||||
dpl_SetZoneLmodel ( z, NULL );
|
||||
dpl_DeleteLmodel ( lm );
|
||||
|
||||
dpl_PruneDcs ( bro );
|
||||
dpl_PruneDcs ( chile );
|
||||
dpl_PruneDcs ( dcs1 );
|
||||
|
||||
dpl_SetZoneRootDcs ( z, NULL );
|
||||
|
||||
dpl_DeleteDcs ( bro );
|
||||
dpl_DeleteDcs ( chile );
|
||||
dpl_DeleteDcs ( dcs1 );
|
||||
|
||||
dpl_DeleteView ( eye );
|
||||
|
||||
dpl_DeleteZone ( z );
|
||||
|
||||
printf ( dpl_Status() );
|
||||
}
|
||||
/*}}} */
|
||||
/*{{{ void dpl_test_2 ( void )*/
|
||||
void dpl_test_2 ( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
return;
|
||||
|
||||
for (i=0; i<2; i++ ) {
|
||||
dpl_ZONE *z;
|
||||
dpl_DCS *root;
|
||||
dpl_DCS *dcs1;
|
||||
dpl_DCS *chile;
|
||||
dpl_DCS *bro;
|
||||
|
||||
dpl_LMODEL *lm;
|
||||
dpl_LIGHT *amb;
|
||||
dpl_LIGHT *direct;
|
||||
|
||||
z=dpl_NewZone();
|
||||
|
||||
root = dpl_NewDcs();
|
||||
dcs1 = dpl_NewDcs();
|
||||
chile = dpl_NewDcs();
|
||||
bro = dpl_NewDcs();
|
||||
|
||||
dpl_NestDcs ( root, dcs1 );
|
||||
dpl_NestDcs ( dcs1, chile );
|
||||
dpl_LinkDcs ( chile, bro );
|
||||
|
||||
lm = dpl_NewLmodel();
|
||||
|
||||
amb = dpl_NewLight();
|
||||
direct= dpl_NewLight();
|
||||
|
||||
dpl_SetLightType ( amb, dpl_light_type_ambient );
|
||||
dpl_SetLightColor ( amb, 0.2f, 0.3f, 0.5f );
|
||||
|
||||
dpl_SetLightType ( direct, dpl_light_type_directional );
|
||||
dpl_SetLightColor ( direct, 0.8f, 0.8f, 0.6f );
|
||||
|
||||
dpl_SetZoneLmodel ( z, lm );
|
||||
dpl_SetZoneRootDcs ( z, root );
|
||||
|
||||
dpl_AddLightToLmodel ( lm, amb );
|
||||
dpl_AddLightToLmodel ( lm, direct );
|
||||
|
||||
dpl_NameNode ( &z->dplnode, "zone" );
|
||||
dpl_NameNode ( &lm->dplnode, "lighting model" );
|
||||
dpl_NameNode ( &amb->dplnode, "ambient" );
|
||||
dpl_NameNode ( &direct->dplnode, "direct light" );
|
||||
dpl_NameNode ( &root->dplnode, "root" );
|
||||
dpl_NameNode ( &dcs1->dplnode, "dcs1" );
|
||||
dpl_NameNode ( &chile->dplnode, "chile" );
|
||||
dpl_NameNode ( &bro->dplnode, "bro" );
|
||||
|
||||
find ( "lighting model", 1 );
|
||||
find ( "direct light", 1 );
|
||||
find ( "zone", 1 );
|
||||
find ( "root", 1 );
|
||||
find ( "dcs1", 1 );
|
||||
find ( "chile", 1 );
|
||||
find ( "bro", 1 );
|
||||
find ( "lighting module", 0 );
|
||||
find ( "roots", 0 );
|
||||
find ( "chile voodoo", 0 );
|
||||
find ( "bros", 0 );
|
||||
|
||||
dpl_ClearNameTable();
|
||||
|
||||
find ( "zone", 0 );
|
||||
find ( "lighting model", 0 );
|
||||
find ( "lighting module", 0 );
|
||||
find ( "direct light", 0 );
|
||||
find ( "root", 0 );
|
||||
find ( "roots", 0 );
|
||||
find ( "dcs1", 0 );
|
||||
find ( "chile", 0 );
|
||||
find ( "chile voodoo", 0 );
|
||||
find ( "bro", 0 );
|
||||
find ( "bros", 0 );
|
||||
|
||||
dpl_SetZoneRootDcs ( z, NULL );
|
||||
dpl_SetZoneLmodel ( z, NULL );
|
||||
|
||||
dpl_RemoveLightFromLmodel ( lm, amb );
|
||||
dpl_RemoveLightFromLmodel ( lm, direct );
|
||||
|
||||
dpl_DeleteLmodel ( lm );
|
||||
|
||||
dpl_DeleteLight ( amb );
|
||||
dpl_DeleteLight ( direct );
|
||||
|
||||
dpl_PruneDcs ( bro );
|
||||
dpl_PruneDcs ( chile );
|
||||
dpl_PruneDcs ( dcs1 );
|
||||
|
||||
dpl_DeleteDcs ( bro );
|
||||
dpl_DeleteDcs ( chile );
|
||||
dpl_DeleteDcs ( dcs1 );
|
||||
dpl_DeleteDcs ( root );
|
||||
|
||||
dpl_DeleteZone ( z );
|
||||
|
||||
printf ( dpl_Status() );
|
||||
|
||||
}
|
||||
}
|
||||
/*}}} */
|
||||
/*{{{ void dpl_test_3 ( void )*/
|
||||
void dpl_test_3 ( void )
|
||||
{
|
||||
dpl_OBJECT *o;
|
||||
dpl_ZONE *z;
|
||||
clock_t then, now;
|
||||
|
||||
return;
|
||||
z=dpl_NewZone();
|
||||
|
||||
then=clock();
|
||||
|
||||
/*
|
||||
o=b2zread("ball.b2z");
|
||||
o=b2zread("ballo.b2z");
|
||||
o=b2zread("glob.b2z");
|
||||
o=b2zread("glob.b2z");
|
||||
o=b2zread("glob.b2z");
|
||||
*/
|
||||
|
||||
now=clock();
|
||||
|
||||
printf ("Done, read 3 globs (1.23 MBytes) in %f secs\n",
|
||||
(float) (now-then) / 100.0f) ;
|
||||
|
||||
}
|
||||
/*}}} */
|
||||
/*{{{ void dpl_test_4 ( void )*/
|
||||
void dpl_test_4 ( void )
|
||||
{
|
||||
}
|
||||
/*}}} */
|
||||
|
||||
|
||||
/*{{{ int main ( int argc, char **argv )*/
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
printf ("test is go\n" );
|
||||
|
||||
dpl_SetWarningLevel(0);
|
||||
dpl_Init ( argv[1] );
|
||||
|
||||
printf ("dpl_test_1\n" );
|
||||
dpl_test_1();
|
||||
return 0;
|
||||
|
||||
printf ("dpl_test_2\n" );
|
||||
dpl_test_2();
|
||||
|
||||
printf ("dpl_test_3\n" );
|
||||
dpl_test_3();
|
||||
|
||||
|
||||
printf ("dpl_test_4\n" );
|
||||
dpl_test_4();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*}}} */
|
||||
Reference in New Issue
Block a user