Files
CydandClaude Fable 5 afc3fd839e Vendor dpl3-revive: the Division/DPL3 renderer, now ours
Bring the graphics-dev collaborator's dpl3-revive into the repo as first-class
project code (they've handed it off; it's ours now). This is the proven
Division renderer that our in-process rt_draw has been trying to be.

What's here:
- parser/  B2Z/V2Z/SVT/SCN/SPL/BGF/BMF/BSL decoders (pure Python).
- spec/    reverse-engineered format + the definitive VelociRender wire
           protocol (from the original DIVISION source, matches our live
           VPX node/action tables exactly).
- source-ref/  read-only copies of the original DIVISION C (BIZREAD.C,
           DPLTYPES.H, DPL.H) that define the formats.
- patha/   the "virtual VelociRender board": vrboard.py (24-action protocol
           server), vrview.py (numpy software rasterizer, the reference),
           vrview_gl.py (moderngl GPU backend, 832x512@60Hz), plus the
           run/replay/regress tooling and evidence renders. Drives FLYK/BLADE/
           Star Trek demos AND our btl4opt/rpl4opt game binaries.
- viewer/  WebGL archive generators (.py); prebuilt HTML/data regeneratable.
- samples/ small test models/textures.
- bt*.raw.bin  real BTL4OPT arena wire captures (kept for offline renderer
           testing/regression against OUR game).

.gitignore keeps the multi-hundred-MB demo capture dumps + debug logs +
regeneratable viewer bundles out of history (they stay on disk).

Phase 0 of the integration is validated: their board decodes our bt8 capture
with zero errors (3748 nodes, 507 instances, 4 mechs) and renders our arena
(terrain/dome/sky, correct Division DAC gamma). Plan + status in memory;
integration continues in emulator/RENDERER-COLLAB.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 22:06:25 -05:00

635 lines
14 KiB
C++

#ifndef dpl_h
#define dpl_h
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : dpl.h
Project : dpl interface
Author : PJA
Date : 18/6/94
Function: Introduces all the datatypes and functions
used by the dpl interface
History : Rev 1.0, 18 / 06 / 1994
**************************** */
#include "dpltypes.h"
/*{{{ DPL API ====> list management*/
extern void
dpl_AddZoneToScene ( dpl_ZONE *z );
extern void
dpl_AddViewToScene ( dpl_VIEW *v );
extern void
dpl_AddZoneToView ( dpl_VIEW *v, dpl_ZONE *z );
extern void
dpl_AddLightToLmodel ( dpl_LMODEL *lm, dpl_LIGHT *l );
extern void
dpl_AddLodToObject ( dpl_OBJECT *o, dpl_LOD *lod );
extern void
dpl_AddGeogroupToLod ( dpl_LOD *l, dpl_GEOGROUP *gg );
extern void
dpl_AddGeometryToGeogroup ( dpl_GEOGROUP *gg, dpl_GEOMETRY *g );
extern void
dpl_AddPathToFilepath ( dpl_FILEPATH *fp, dpl_PATHITEM *pi );
extern void
dpl_AddExtToFilepath ( dpl_FILEPATH *fp, dpl_EXTNITEM *ei );
extern void
dpl_RemoveZoneFromScene ( dpl_ZONE *z );
extern void
dpl_RemoveViewFromScene ( dpl_VIEW *v );
extern void
dpl_RemoveZoneFromView ( dpl_VIEW *v, dpl_ZONE *z );
extern void
dpl_RemoveLightFromLmodel ( dpl_LMODEL *lm, dpl_LIGHT *l );
extern void
dpl_RemoveLodFromObject ( dpl_OBJECT *o, dpl_LOD *lod );
extern void
dpl_RemoveGeogroupFromLod ( dpl_LOD *l, dpl_GEOGROUP *gg );
extern void
dpl_RemoveGeometryFromGeogroup ( dpl_GEOGROUP *gg, dpl_GEOMETRY *g );
extern void
dpl_RemovePathFromFilepath ( dpl_FILEPATH *fp, dpl_PATHITEM *pi );
extern void
dpl_RemoveExtFromFilepath ( dpl_FILEPATH *fp, dpl_EXTNITEM *ei );
/*}}} */
/*{{{ DPL API ====> tree management*/
extern void
dpl_NestDCS ( dpl_DCS *parent, dpl_DCS *child );
extern void
dpl_LinkDCS ( dpl_DCS *bro, dpl_DCS *sis );
extern void
dpl_PruneDCS ( dpl_DCS *node );
/*}}} */
/*{{{ DPL API ====> SCENE functions*/
extern void
dpl_DrawScene ( int32 double_buffered );
extern int32
dpl_DrawSceneComplete ( void );
extern void
dpl_WaitSceneComplete ( void );
extern dpl_ZONE *
dpl_GetSceneFirstZone ( void );
extern dpl_ZONE *
dpl_GetSceneNextZone ( void );
/*}}} */
/*{{{ DPL API ====> ZONE functions*/
extern dpl_ZONE *
dpl_NewZone ( void );
extern void
dpl_DeleteZone ( dpl_ZONE *z );
extern dpl_DCS *
dpl_GetZoneRootDcs ( dpl_ZONE *z );
extern void
dpl_SetZoneRootDcs ( dpl_ZONE *z, dpl_DCS *h );
extern dpl_LMODEL *
dpl_GetZoneLmodel ( dpl_ZONE *z );
extern void
dpl_SetZoneLmodel ( dpl_ZONE *z, dpl_LMODEL *lm );
extern int32
dpl_GetZoneEnable ( dpl_ZONE *z );
extern void
dpl_SetZoneEnable ( dpl_ZONE *z, int32 i );
/*}}} */
/*{{{ DPL API ====> DCS functions*/
extern dpl_DCS *
dpl_NewDcs ( void );
extern void
dpl_DeleteDcs ( dpl_DCS *h );
extern void
dpl_GetDcsLinkage ( dpl_DCS *node, dpl_DCS **parent, dpl_DCS **child, dpl_DCS **sibling );
extern void
dpl_SetDcsNode ( dpl_DCS *hnode, dpl_node *cnode );
#define dpl_SetDcsLight(a,b) dpl_SetDcsNode(a,&(b)->dplnode)
#define dpl_SetDcsInstance(a,b) dpl_SetDcsNode(a,&(b)->dplnode)
extern dpl_node *
dpl_GetDcsNode ( dpl_DCS *hnode );
extern dpl_type
dpl_GetDcsNodeType ( dpl_DCS *hnode );
extern void
dpl_SetDcsMatrix ( dpl_DCS *hnode, dpl_MATRIX *m );
extern void
dpl_GetDcsMatrix ( dpl_DCS *hnode, dpl_MATRIX m ) ;
extern void
dpl_SetDcsNodeEnable ( dpl_DCS *hnode, int32 enable );
extern void
dpl_SetDcsSubtreeEnable ( dpl_DCS *hnode, int32 enable );
extern int32
dpl_GetDcsNodeEnable ( dpl_DCS *hnode );
extern int32
dpl_GetDcsSubtreeEnable ( dpl_DCS *hnode );
/*}}} */
/*{{{ DPL API ====> INSTANCE functions*/
extern dpl_INSTANCE *
dpl_NewInstance ( void );
extern void
dpl_DeleteInstance ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceObject ( dpl_INSTANCE *i, dpl_OBJECT *o );
extern dpl_OBJECT *
dpl_GetInstanceObject ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceFrontMaterial ( dpl_INSTANCE * i, dpl_MATERIAL *m );
extern dpl_MATERIAL *
dpl_GetInstanceFrontMaterial ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceBackMaterial ( dpl_INSTANCE *i, dpl_MATERIAL *m );
extern dpl_MATERIAL *
dpl_GetInstanceBackMaterial ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceFrontTexture ( dpl_INSTANCE *i, dpl_TEXTURE *t );
extern dpl_TEXTURE *
dpl_GetInstanceFrontTexture ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceBackTexture ( dpl_INSTANCE *i, dpl_TEXTURE *t );
extern dpl_TEXTURE *
dpl_GetInstanceBackTexture ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceForceLOD ( dpl_INSTANCE *i, dpl_LOD *l );
extern dpl_LOD *
dpl_GetInstanceForceLOD ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceBillboard ( dpl_INSTANCE *i, int32 b );
extern int32
dpl_GetInstanceBillboard ( dpl_INSTANCE *i );
extern void
dpl_SetInstanceIntersect ( dpl_INSTANCE *i, dpl_isect_mode m );
extern dpl_isect_mode
dpl_GetInstanceIntersect ( dpl_INSTANCE *i );
/*}}} */
/*{{{ DPL API ====> LIGHT functions*/
extern dpl_LMODEL *
dpl_NewLmodel ( void );
extern void
dpl_DeleteLmodel ( dpl_LMODEL *lm );
extern dpl_LIGHT *
dpl_GetLmodelFirstLight ( dpl_LMODEL *lm );
extern dpl_LIGHT *
dpl_GetLmodelNextLight ( dpl_LMODEL *lm );
extern dpl_LIGHT *
dpl_NewLight ( void );
extern void
dpl_DeleteLight ( dpl_LIGHT *l );
extern void
dpl_SetLightType ( dpl_LIGHT *l, dpl_light_type t );
extern dpl_light_type
dpl_GetLightType ( dpl_LIGHT *l );
extern void
dpl_SetLightColor ( dpl_LIGHT *l, float32 r, float32 g, float32 b );
extern void
dpl_GetLightColor ( dpl_LIGHT *l, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetLightRadii ( dpl_LIGHT *l, float32 r0, float32 r1 );
extern void
dpl_GetLightRadii ( dpl_LIGHT *l, float32 *r0,float32 *r1 );
extern void
dpl_SetLightUmbra ( dpl_LIGHT *l, float32 th1, float32 th2 );
extern void
dpl_GetLightUmbra ( dpl_LIGHT *l, float32 *th1, float32 *th2 );
/*}}} */
/*{{{ DPL API ====> VIEW functions*/
extern dpl_VIEW *
dpl_NewView ( void );
extern void
dpl_DeleteView ( dpl_VIEW *v );
extern void
dpl_SetViewMatrix ( dpl_VIEW *v, dpl_MATRIX m );
extern void
dpl_GetViewMatrix ( dpl_VIEW *v, dpl_MATRIX m );
extern void
dpl_SetViewClipPlanes ( dpl_VIEW *v, float32 hither, float32 yon );
extern void
dpl_GetViewClipPlanes ( dpl_VIEW *v, float32 *hither, float32 *yon );
extern void
dpl_SetViewBackGround ( dpl_VIEW *v, float32 r, float32 g, float32 b );
extern void
dpl_GetViewBackGround ( dpl_VIEW *v, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetViewFog ( dpl_VIEW *v, int32 enable,
float32 r, float32 g, float32 b,
float32 neer, float32 phar );
extern void
dpl_GetViewFog ( dpl_VIEW *v, int32 *enable,
float32 *r, float32 *g, float32 *b,
float32 *neer, float32 *phar );
extern void
dpl_SetViewProjection ( dpl_VIEW *v,
float32 x_size, float32 y_size,
float32 x0, float32 y0,
float32 x1, float32 y1,
float32 zeye );
extern void
dpl_GetViewProjection ( dpl_VIEW *v,
float32 *x_size, float32 *y_size,
float32 *x0, float32 *y0,
float32 *x1, float32 *y1,
float32 *zeye );
/*}}} */
/*{{{ DPL API ====> MATERIAL functions*/
extern dpl_MATERIAL *
dpl_NewMaterial ( void );
extern void
dpl_DeleteMaterial ( dpl_MATERIAL *m );
extern void
dpl_SetMaterialAmbient ( dpl_MATERIAL *m, float32 r, float32 g, float32 b );
extern void
dpl_GetMaterialAmbient ( dpl_MATERIAL *m, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetMaterialEmissive ( dpl_MATERIAL *m, float32 r, float32 g, float32 b );
extern void
dpl_GetMaterialEmissive ( dpl_MATERIAL *m, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetMaterialDiffuse ( dpl_MATERIAL *m, float32 r, float32 g, float32 b );
extern void
dpl_GetMaterialDiffuse ( dpl_MATERIAL *m, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetMaterialSpecular ( dpl_MATERIAL *m, float32 r, float32 g, float32 b, float32 shininess );
extern void
dpl_GetMaterialSpecular ( dpl_MATERIAL *m, float32 *r, float32 *g, float32 *b, float32 *shininess );
extern void
dpl_SetMaterialOpacity ( dpl_MATERIAL *m, float32 r, float32 g, float32 b );
extern void
dpl_GetMaterialOpacity ( dpl_MATERIAL *m, float32 *r, float32 *g, float32 *b );
extern void
dpl_SetMaterialTexture ( dpl_MATERIAL *m, dpl_TEXTURE *t );
extern dpl_TEXTURE *
dpl_GetMaterialTexture ( dpl_MATERIAL *m );
/*}}} */
/*{{{ DPL API ====> TEXTURE functions*/
extern dpl_TEXMAP *
dpl_NewTexMap ( void );
extern void
dpl_DeleteTexMap ( dpl_TEXMAP *tm );
extern void
dpl_SetTexMapEdgeSize ( dpl_TEXMAP *tm, int32 u, int32 v );
extern void
dpl_GetTexMapEdgeSize ( dpl_TEXMAP *tm, int32 *u, int32 *v );
extern void
dpl_SetTexMapTexelSize ( dpl_TEXMAP *tm, int32 bytes_per_pixel );
extern int32
dpl_GetTexMapTexelSize ( dpl_TEXMAP *tm );
extern void
dpl_SetTexMapTexels ( dpl_TEXMAP *tm,
int32 *texels,
int32 u_size,
int32 v_size,
int32 mode );
extern dpl_TEXTURE *
dpl_NewTexture ( void );
extern void
dpl_DeleteTexture ( dpl_TEXTURE *t );
extern void
dpl_SetTextureMode ( dpl_TEXTURE *t, int32 m );
extern int32
dpl_GetTextureMode ( dpl_TEXTURE *t );
extern int32
dpl_LoadTexmap ( dpl_TEXMAP *t, char *fname );
/*}}} */
/*{{{ DPL API ====> RAMP functions*/
extern dpl_RAMP *
dpl_NewRamp ( void );
extern void
dpl_DeleteRamp ( dpl_RAMP *m );
extern void
dpl_SetRampColors ( dpl_RAMP *m,
float r0, float g0, float b0,
float r1, float g1, float b1 );
extern void
dpl_GetRampColors ( dpl_RAMP *m, float *r0, float *g0, float *b0,
float *r1, float *g1, float *b1 );
/*}}} */
/*{{{ DPL API ====> FILEPATH CONTROL functions*/
extern dpl_FILEPATH *
dpl_NewFilePath ( void );
extern dpl_PATHITEM *
dpl_NewPathItem ( void );
extern dpl_EXTNITEM *
dpl_NewExtnItem ( void );
extern void
dpl_DeleteFilePath ( dpl_FILEPATH *fp );
extern void
dpl_DeletePathItem ( dpl_PATHITEM *fp );
extern void
dpl_DeleteExtnItem ( dpl_PATHITEM *fp );
extern void
dpl_SetPathItemPath ( dpl_PATHITEM *i, char *s );
extern char *
dpl_GetPathItemPath ( dpl_PATHITEM *p );
extern void
dpl_SetExtnItemExtn ( dpl_EXTNITEM *p, char *s );
extern char *
dpl_GetExtnItemExtn ( dpl_EXTNITEM *p );
extern void
dpl_SetExtnItemLoadFunc ( dpl_EXTNITEM *p, load_function l );
extern load_function
dpl_GetExtnItemLoadFunc ( dpl_EXTNITEM *p );
extern void
dpl_SetGeometryFilePath ( dpl_FILEPATH *fp );
extern dpl_FILEPATH *
dpl_GetGeometryFilePath ( void );
extern void
dpl_SetTextureFilePath ( dpl_FILEPATH *fp );
extern dpl_FILEPATH *
dpl_GetTextureFilePath ( void );
extern char *
dpl_FindFile ( dpl_FILEPATH *fp, char *root_name, load_function *ext_func );
extern char *
dpl_FindGeometryFile ( char *root_name, load_function *ext_func );
extern char *
dpl_FindTextureFile ( char *root_name, load_function *ext_func );
/*}}} */
/*{{{ DPL API ====> GEOMETRY functions*/
extern dpl_OBJECT *
dpl_NewObject ( void );
extern dpl_LOD *
dpl_NewLod ( void );
extern dpl_GEOGROUP *
dpl_NewGeogroup ( void );
extern dpl_GEOMETRY *
dpl_NewGeometry ( void );
extern dpl_LOD *
dpl_GetObjectFirstLod ( dpl_OBJECT *o );
extern dpl_LOD *
dpl_GetObjectNextLod ( dpl_OBJECT *o );
extern void
dpl_DeleteObject ( dpl_OBJECT *o );
extern void
dpl_DeleteLod ( dpl_LOD *o );
extern void
dpl_DeleteGeogroup ( dpl_GEOGROUP *o );
extern void
dpl_DeleteGeometry ( dpl_GEOMETRY *o );
extern dpl_geo_type
dpl_GetGeometryGeotype ( dpl_GEOMETRY *g );
extern void
dpl_SetGeometryGeotype ( dpl_GEOMETRY *g, dpl_geo_type gt );
extern int32
dpl_SetGeometryVertices ( dpl_GEOMETRY *g,
dpl_VERTEX_LIST *v,
dpl_CONNECTION_LIST *con );
extern int32
dpl_GetGeometryNumVertices ( dpl_GEOMETRY *g );
extern dpl_VERTEX *
dpl_GetGeometryVertex ( dpl_GEOMETRY *g, int vertex_index );
extern int32
dpl_GetGeometryNumConnections ( dpl_GEOMETRY *g );
extern dpl_CONNECTION *
dpl_GetGeometryConnection ( dpl_GEOMETRY *g, int vertex_index );
extern dpl_VERTEX_LIST *
dpl_NewVertices ( int n_vertices );
extern dpl_CONNECTION_LIST *
dpl_NewConnections ( int n_connections );
extern void
dpl_BoundLod ( dpl_LOD *lod );
extern void
dpl_BoundGeogroup ( dpl_GEOGROUP *gg );
extern int32
dpl_LoadObject ( dpl_OBJECT *o, char *fname );
extern void
dpl_MorphObject ( dpl_OBJECT *morphed,
dpl_OBJECT *a,
dpl_OBJECT *b, float32 alpha );
/*}}} */
/*{{{ DPL API ====> NAMETABLE ACCESS functions*/
extern dpl_NAME *
dpl_NewName ( void );
extern void
dpl_DeleteName ( dpl_NAME *n );
extern void
dpl_SetNameString ( dpl_NAME *n, char * s );
extern void
dpl_SetNameNode ( dpl_NAME *n, dpl_node *dn );
extern void
dpl_AddNameToNametable ( dpl_NAME *n );
extern void
dpl_RemoveNameFromNametable ( dpl_NAME *n );
extern void
dpl_NameNode ( dpl_node *n, char *s );
extern dpl_node *
dpl_FindNamedNode ( char *str );
extern dpl_node *
dpl_FindNamedTypedNode ( dpl_type t, char *str );
extern void
dpl_ClearNameTable ( void );
extern char *
dpl_TypeToString ( dpl_type t );
/*}}} */
/*{{{ DPL API ====> GENERAL CONTROL functions*/
extern void
dpl_SetWarningLevel ( int32 w );
extern int32
dpl_GetWarningLevel ( void );
extern int32
dpl_Init ( char *dpl_arg );
extern void
dpl_Exit ( int32 exit_code );
extern void
dpl_SetCacheMode ( dpl_cache_mode m );
extern dpl_cache_mode
dpl_GetCacheMode ();
extern dpl_STATISTICS
dpl_Statistics ( void );
extern dpl_VERSION
dpl_Version ( void );
extern char *
dpl_Status ( void );
extern void
dpl_ReadFrameStore ( int32 *pixels, int32 x, int32 y, int32 n_pixels );
extern dpl_INSTANCE *
dpl_SectVector ( dpl_POINT sect,
float32 x0, float32 y0, float32 z0,
float32 x1, float32 y1, float32 z1 );
extern dpl_INSTANCE *
dpl_SectPixel ( dpl_POINT sect, float32 x, float32 y );
/*}}} */
#define dpl_Flush(n) (((dpl_node *)(n))->flush)((dpl_node *)(n))
#define dpl_Hide(n) (((dpl_node *)(n))->hide)((dpl_node *)(n))
#define dpl_Unhide(n) (((dpl_node *)(n))->unhide)((dpl_node *)(n))
#endif