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:
Cyd
2026-07-04 19:41:15 -05:00
co-authored by Claude Fable 5
parent 504aef88d4
commit db7745fcd0
19993 changed files with 1983033 additions and 0 deletions
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
path C:\WATCOM\bin;C:\WATCOM\binb;C:\WATCOM\binw;C:\ZORTECH\BIN;S:\BIN;C:\DOS;S:\BIN\ICTOOLS\ITOOLS;S:\BIN\BRIEF;T:\USR\BILL\BIN;
set include=C:\WATCOM\h;C:\WATCOM\h\win
set watcom=C:\WATCOM\.
+11
View File
@@ -0,0 +1,11 @@
rem SET SOUND=C:\SB16
rem SET BLASTER=A220 I5 D1 H5 P330 T6
rem SET MIDI=SYNTH:1 MAP:E MODE:0
rem C:\SB16\DIAGNOSE /S
rem C:\SB16\AWEUTIL /S
rem C:\SB16\SB16SET /P /Q
set path=c:\;c:.;c:\watcom\bin;c:\watcom\binb;c:\bin;c:\d7314a\tools
set watcom=c:\watcom
call setf
ndosed
ncc /fastkey
+2
View File
@@ -0,0 +1,2 @@
del netq
xcopy *.* t:\usr\phil\dpl3
Binary file not shown.
Binary file not shown.
Binary file not shown.
+72
View File
@@ -0,0 +1,72 @@
/*
* PROJECT: DVS
* SUBSYSTEM: VL
* MODULE: basictypes.def
*
* File: $RCSfile: basictypes.def,v $
* Revision: $Revision: 0.4 $
* Date: $Date: 1993/09/24 11:29:01 $
* Author: $Author: jon $
* RCS Ident: $Id: basictypes.def,v 0.4 1993/09/24 11:29:01 jon Exp $
*
* FUNCTION:
* This module is used to hold the parameterised definitions of the basic
* types used throughout the system for all the machines supported. When
* porting to a new architecture all type stuff should be modified in
* here. There should be no machine dependant code anywhere else!
*
* each of the basic type int8 uint8 etc, etc is defined in terms of
* standard ansi 'C' types here, and given a enum name for conveniance.
*
* The format is DEF_TYPE ( <enum name>, <type name>, <ansi 'C' equiv> )
*
* $Log: basictypes.def,v $
Revision 0.4 1993/09/24 11:29:01 jon
Release 2.0.4
Revision 1.1 93/07/12 08:12:21 john
Initial revision
# Revision 1.6 1993/03/19 15:24:22 john
# added definition for system V release 4.2
#
# Revision 1.5 1992/09/28 17:19:58 mark
# Added definitions for IRIS Indigo
#
# Revision 1.4 1992/09/15 13:47:54 jeff
# now use _SYSV386 not SYSV386
#
# Revision 1.3 1992/09/15 13:10:32 jeff
# added defs for SYSV386 targets.
#
# Revision 1.2 1992/09/14 13:18:53 jeff
# progress, progreess....
#
# Revision 1.1 1992/07/27 12:24:20 jeff
# Initial revision
#
*
* Copyright (c) 1992 Division Ltd.
*
* All Rights Reserved.
*
* This Document may not, in whole or in part, be copied,
* photocopied, reproduced, translated, or reduced to any
* electronic medium or machine readable form without prior
* written consent from Division Ltd.
*/
DEF_TYPE( INT8, int8, signed char )
DEF_TYPE( UINT8, uint8, unsigned char )
DEF_TYPE( INT16, int16, signed short )
DEF_TYPE( UINT16, uint16, unsigned short )
DEF_TYPE( INT32, int32, signed int )
DEF_TYPE( UINT32, uint32, unsigned int )
DEF_TYPE( FLOAT32, float32, float)
DEF_TYPE( FLOAT64, float64, double)
/*
* Note we may need to put ifdefs back in here for some machines IE 64Bit processors ?
*/

+83
View File
@@ -0,0 +1,83 @@
/*
* PROJECT: DVS
* SUBSYSTEM: vl
* MODULE: basictypes.h
*
* File: $RCSfile: basictypes.h,v $
* Revision: $Revision: 1.1 $
* Date: $Date: 1993/07/12 08:12:20 $
* Author: $Author: john $
* RCS Ident: $Id: basictypes.h,v 1.1 1993/07/12 08:12:20 john Exp $
*
* FUNCTION:
*
* This file contains the lowest level definitions needed by
* the vl library.
*
* $Log: basictypes.h,v $
* Revision 1.1 1993/07/12 08:12:20 john
* Initial revision
*
* Revision 1.3 1992/08/19 11:50:24 jeff
* got rid of temporary bodge definition of agentlist now i've got the real thing.
*
* Revision 1.2 1992/07/27 13:30:38 jon
* Temporary fix. AgentList is uint32 not void type.
*
* Revision 1.1 1992/07/27 12:24:20 jeff
* Initial revision
*
*
* Copyright (c) 1992 Division Ltd.
*
* All Rights Reserved.
*
* This Document may not, in whole or in part, be copied,
* photocopied, reproduced, translated, or reduced to any
* electronic medium or machine readable form without prior
* written consent from Division Ltd.
*/
#ifndef _BASIC_TYPES_H
#define _BASIC_TYPES_H
/*
* mangle the basictypes.def file to get machine specific low level
* definitions for all our basic types.
*/
#define DEF_TYPE(a,b,c) typedef c b;
#include "basictyp.def"
#undef DEF_TYPE
/*
* generate an enum list of all the symbolic values for the types.
*/
#define DEF_TYPE(a,b,c) a,
typedef enum BasicType {
#include "basictyp.def"
LAST_TYPE
} BasicType;
#undef DEF_TYPE
#define BASIC_TYPE_CNT ((int)LAST_TYPE)
typedef char *String;
/*
* A structure to define the names etc of the basic types for internal
* use.
*/
typedef struct TypeSpec{
int8 endian16[3];
int8 endian32[5];
struct {
String name;
uint32 size;
uint32 alignment;
}Sizes[BASIC_TYPE_CNT];
} *TypeSpec;
extern void GenBasicTypes(TypeSpec spec);
#endif /* _BASIC_TYPES_H */
+1950
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
#ifndef bizread_h
#define bizread_h
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : bizread.h
Project : dpl interface
Author : PJA
Date : 18/6/94
Function: declares b2zread
History : Rev 1.0, 18 / 06 / 1994
**************************** */
#include "dpltypes.h"
extern dpl_OBJECT *b2zread ( char *f );
#endif
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
@echo off
set __opath=%path%
set path=C:\WATCOM\bin;C:\WATCOM\binb
set __oinc=%include%
set include=C:\WATCOM\h
set watcom=C:\WATCOM\.
wcl386 /l=dos4g /bt=dos C:\WATCOM\src\calendar
dos4gw calendar
set include=%__oinc%
set __oinc=
set path=%__opath%
set __opath=
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
SHELL=C:\COMMAND.COM /P /E:1536
rem DEVICE=C:\SB16\DRV\CSP.SYS /UNIT=0 /BLASTER=A:220
rem DEVICE=C:\SB16\DRV\CTSB16.SYS /UNIT=0 /BLASTER=A:220 I:5 D:1 H:5
rem DEVICE=C:\SB16\DRV\CTMMSYS.SYS
DEVICE=C:\BANSI.SYS
FILES=40
Binary file not shown.
+3827
View File
File diff suppressed because it is too large Load Diff
+634
View File
@@ -0,0 +1,634 @@
#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
BIN
View File
Binary file not shown.
+501
View File
@@ -0,0 +1,501 @@
#ifndef dpltyp_h
#define dpltyp_h
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : dpltypes.h
Project : dpl interface
Author : PJA
Date : 18/6/94
Function: Introduces all the datatypes
History : Rev 1.0, 18 / 06 / 1994
1.1, 22 / 06 / 1994 fixed unimplementable lists by
introducing dpl_superlist
1.2, 27 / 06 / 1994 dislocated heirarchy from instances
and dropped back to matrix-only DCS
**************************** */
#include "basictyp.h"
typedef enum dpl_type {
dpl_type_error,
dpl_type_scene,
dpl_type_zone,
dpl_type_view,
dpl_type_instance,
dpl_type_dcs,
dpl_type_lmodel,
dpl_type_light,
dpl_type_object,
dpl_type_lod,
dpl_type_geogroup,
dpl_type_geometry,
dpl_type_material,
dpl_type_texmap,
dpl_type_texture,
dpl_type_ramp,
dpl_type_filepath,
dpl_type_pathitem,
dpl_type_extnitem,
dpl_type_nameitem
} dpl_type;
typedef enum dpl_light_type {
dpl_light_type_error,
dpl_light_type_disable,
dpl_light_type_ambient,
dpl_light_type_directional,
dpl_light_type_point,
dpl_light_type_conical
} dpl_light_type;
typedef enum dpl_cache_mode {
dpl_cache_mode_error,
dpl_cache_mode_write_back,
dpl_cache_mode_write_thru
} dpl_cache_mode;
typedef enum dpl_geo_type {
dpl_g_type_error,
dpl_g_type_empty,
dpl_g_type_tristrip,
dpl_g_type_polystrip,
dpl_g_type_pmesh,
dpl_g_type_spheres,
dpl_g_type_string,
dpl_g_type_lines,
dpl_g_type_polyline
} dpl_geo_type;
typedef enum dpl_isect_mode {
dpl_isect_mode_error,
dpl_isect_mode_none,
dpl_isect_mode_obj,
dpl_isect_mode_geogroup,
dpl_isect_mode_geometry
} dpl_isect_mode;
/* forward declare everything - it gets circular down there */
#define dpl_arg_sep '~'
#define dcs_node_enable 0x1
#define dcs_subtree_enable 0x2
#define dpl_draw_faceted 0x00
#define dpl_draw_smooth 0x01
#define dpl_draw_colored 0x02
#define dpl_draw_luminance 0x04
#define dpl_draw_textured 0x08
#define dpl_draw_3dtextured 0x10
#define dpl_draw_front 0x200
#define dpl_draw_back 0x400
#define dpl_X 0
#define dpl_Y 1
#define dpl_Z 2
#define dpl_W 3
#ifdef MS_DOS
#define dpl_path_separator '\\'
#else
#define dpl_path_separator '/'
#endif
/*
NOTE in rpc implementations, the rather large overhead
of the dpl_node dplnode is never passed over to the
remote renderer, its just in the host space for management
*/
typedef int32 (*node_function)( struct s_dplnode *);
typedef struct s_dplnode {
void *app_specific;
int32 hidden;
node_function ghost_create;
node_function ghost_delete;
node_function flush;
node_function hide;
node_function unhide;
int32 ref_count;
void *remote;
dpl_type type_check;
} dpl_node;
typedef dpl_node* (*node_create_function)( void );
typedef struct s_dplremote_node {
void *remote;
dpl_type type_check;
} dpl_remote_node;
#ifdef REMOTE
#define dpl_node dpl_remote_node
#endif
typedef int32 (*load_function)( dpl_node *, char * );
typedef struct s_dpllist {
dpl_node *item;
dpl_type type_check;
struct s_dpllist *next;
struct s_dpllist *prev;
} dpl_list;
/*
the dpl_superlist is used as the head node for
dpl_lists
*/
typedef struct s_dplsuperlist {
dpl_node *dplnode;
dpl_list *last_accessed;
dpl_list *head;
dpl_list *tail;
} dpl_superlist;
typedef struct s_dplscene {
dpl_node dplnode;
dpl_superlist zone_list;
dpl_superlist view_list;
} dpl_SCENE;
/* MATRICES are embedded in VIEWs and in HNODEs */
typedef float32 dpl_POINT [4];
typedef float32 dpl_MATRIX[4][4];
/* ****************************
the HNODE is a heirarchy node, a general binary
tree contruction node. It contains links up, down and
along the tree, plus a local data pointer, the dpl_node*
the dpl_node* in here may be NULL, in which case
the HNODE is operating as an articulation point,
it may be a dpl_INSTANCE, or it may be a dpl_LIGHT.
any other node type in an HNODE is illegal, and
strictly enforceable
The renderer's cull phase must traverse the whole tree,
in order that lights embedded in the tree have their location /
direction cosine correctly set. We may still cull the rendering
of sub-trees by clearing the sub-tree enable bit of the HNODE.
*/
typedef struct s_dpldcs {
dpl_node dplnode;
dpl_node *node;
dpl_MATRIX matrix;
int32 enable;
int32 identity; /* a traversal optimization */
struct s_dpldcs *parent;
struct s_dpldcs *sibling;
struct s_dpldcs *child;
} dpl_DCS;
typedef struct s_dplview {
dpl_node dplnode;
dpl_MATRIX matrix;
int32 enable;
float32 x0, y0, x1, y1, zeye;
float32 x_size, y_size;
float32 hither_clip;
float32 yon_clip;
float32 back_color[3];
int32 fog_enable;
float32 fog[5]; /* near, phar, r, g, b */
dpl_superlist zone_list;
} dpl_VIEW;
typedef struct s_dpllmodel {
dpl_node dplnode;
dpl_superlist light_list;
} dpl_LMODEL;
typedef struct s_dpllight {
dpl_node dplnode;
dpl_DCS *dcs;
int32 light_type;
float32 color [3];
float32 radius [2]; /* for radial lights */
float32 umbra [2]; /* for conical lights */
#ifdef REMOTE
float32 position[3];
#endif
} dpl_LIGHT;
typedef struct s_dplzone {
dpl_node dplnode;
dpl_DCS *root;
dpl_LMODEL *lmodel;
int32 enable;
} dpl_ZONE;
typedef struct s_dpltexture {
dpl_node dplnode;
struct s_dpltexmap *texmap;
int32 minify;
int32 magnify;
int32 alpha;
int32 wrap_u;
int32 wrap_v;
int32 detail;
float32 u0;
float32 v0;
float32 du;
float32 dv;
float32 animate_time;
int32 animate_behaviour;
} dpl_TEXTURE;
typedef struct s_dpltexmap {
dpl_node dplnode;
int32 *texels;
int32 u_size;
int32 v_size;
int32 bits_per_texel;
#if REMOTE
int32 hwareSize;
int32 hwareOffs;
int32 bilinear;
#endif
} dpl_TEXMAP;
typedef struct s_dplramp {
dpl_node dplnode;
float32 color0[3];
float32 color1[3];
} dpl_RAMP;
typedef struct s_dplmtl {
dpl_node dplnode;
struct s_dpltexture *texture;
float32 emissive [3];
float32 ambient [3];
float32 diffuse [3];
float32 opacity [3];
float32 specular [4];
dpl_RAMP *ramp;
} dpl_MATERIAL;
typedef struct s_dplinstance {
dpl_node dplnode;
dpl_DCS *dcs;
int32 billboard;
dpl_isect_mode intersectmode;
struct s_dplobject *object;
struct s_dpllod *forcelod;
struct s_dplmtl *f_material;
struct s_dplmtl *b_material;
struct s_dpltexture *f_texture;
struct s_dpltexture *b_texture;
#if REMOTE
int32 frame_count;
int32 last_LOD_index;
#endif
} dpl_INSTANCE;
typedef struct s_dplobject {
dpl_node dplnode;
dpl_superlist lod_list;
} dpl_OBJECT;
typedef struct s_dpllod {
dpl_node dplnode;
float32 bounds[2][4];
dpl_OBJECT *parent;
dpl_superlist geogroup_list;
float32 switch_in;
float32 switch_out;
} dpl_LOD;
typedef struct s_dplgeogroup {
dpl_node dplnode;
float32 bounds[2][4];
dpl_LOD *parent;
int32 draw_mode;
dpl_superlist geometry_list;
dpl_MATERIAL *f_material;
dpl_MATERIAL *b_material;
} dpl_GEOGROUP;
/* NBB these geometry primitives are NOT supersets of dpl_node */
typedef struct s_vert {
dpl_POINT position; /* x, y, z, w */
dpl_POINT normcol; /* r, g, b alpha */
float32 texcoords [3];
struct s_vert *next;
} dpl_HOST_VERTEX;
typedef struct s_rvert {
dpl_POINT position; /* 0 */
dpl_POINT normcol; /* 16 */
float32 texcoords [3]; /* 32 */
struct s_rvert *next; /* 44 */
dpl_POINT xform_posn; /* 48 */
float32 rendered_color[3]; /* 64 */
int32 touched; /* 76 */
} dpl_REMOTE_VERTEX;
typedef struct s_rconn {
struct s_rconn *next;
int32 n_verts;
int32 indices[6]; /* allow up to hexagons, make structure 8 words long */
} dpl_HOST_CONNECTION;
typedef struct s_conn {
struct s_conn *next; /* 0 */
int32 n_verts; /* 4 */
dpl_REMOTE_VERTEX* indices[6]; /* 8 */
dpl_POINT planeEqn; /* 32 */
float32 rendered_color[3]; /* 48 */
int32 touched; /* 60 */
} dpl_REMOTE_CONNECTION;
#define DPL_VERTICES_PER_BLOCK 8
#define DPL_CONNECTIONS_PER_BLOCK 8
typedef struct s_vert_list {
struct s_vert_list *next;
int32 n_vertices;
dpl_HOST_VERTEX vertices[DPL_VERTICES_PER_BLOCK];
} dpl_HOST_VERTEX_LIST;
typedef struct s_conn_list {
struct s_conn_list *next;
int32 n_connections;
dpl_HOST_CONNECTION connections[DPL_CONNECTIONS_PER_BLOCK];
} dpl_HOST_CONNECTION_LIST;
typedef struct s_rvert_list {
struct s_rvert_list *next;
int32 n_vertices;
dpl_REMOTE_VERTEX vertices[DPL_VERTICES_PER_BLOCK];
} dpl_REMOTE_VERTEX_LIST;
typedef struct s_rconn_list {
struct s_rconn_list *next;
int32 n_connections;
dpl_REMOTE_CONNECTION connections[DPL_CONNECTIONS_PER_BLOCK];
} dpl_REMOTE_CONNECTION_LIST;
#if REMOTE
#define dpl_VERTEX dpl_REMOTE_VERTEX
#define dpl_VERTEX_LIST dpl_REMOTE_VERTEX_LIST
#define dpl_CONNECTION dpl_REMOTE_CONNECTION
#define dpl_CONNECTION_LIST dpl_REMOTE_CONNECTION_LIST
#else
#define dpl_VERTEX dpl_HOST_VERTEX
#define dpl_VERTEX_LIST dpl_HOST_VERTEX_LIST
#define dpl_CONNECTION dpl_HOST_CONNECTION
#define dpl_CONNECTION_LIST dpl_HOST_CONNECTION_LIST
#endif
typedef struct s_dplgeometry {
dpl_node dplnode;
dpl_geo_type geometry_type;
dpl_GEOGROUP *parent;
dpl_CONNECTION_LIST *connections;
dpl_VERTEX_LIST *vertices;
#if REMOTE
int32 variable_alpha;
#endif
} dpl_GEOMETRY;
typedef struct s_dplnameitem {
dpl_node dplnode;
char *name;
dpl_node *item;
} dpl_NAME;
typedef struct s_dplpathitem {
dpl_node dplnode;
char *path;
} dpl_PATHITEM;
typedef struct s_dplextnitem {
dpl_node dplnode;
char *extn;
load_function load_ext;
} dpl_EXTNITEM;
typedef struct s_dpl_filepath {
dpl_node dplnode;
dpl_superlist path_list;
dpl_superlist extn_list;
} dpl_FILEPATH;
/* ******************************************
BEWARE ! ! ! ! !
FOR REASONS OF STORAGE AND APPLICATIONS EFFICIENCY, THE FOLLOWING
DATA TYPES ARE N O T SUPERSETS OF DPL_NODE
BE CAREFUL DEALING WITH VERTICES
*/
/* typedefs for tracing performance */
typedef struct s_dpl_statistics {
float32 polys_in_last_frame;
float32 last_edit_time;
float32 last_cull_time;
float32 last_frame_time;
float32 last_frame_time_sb;
float32 polys_per_second;
float32 polys_per_second_sb;
} dpl_STATISTICS;
typedef struct s_dpl_version {
int32 host;
int32 major_version;
int32 minor_version;
int32 firmware_major_version;
int32 firmware_minor_version;
char detailed[256];
} dpl_VERSION;
typedef void (*vfptr)();
#endif
+1561
View File
File diff suppressed because it is too large Load Diff
+96
View File
@@ -0,0 +1,96 @@
#ifndef dpl_host_h
#define dpl_host_h
#include "dpltypes.h"
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : dpl_host.h
Project : dpl interface
host / dependent section
Author : PJA
Date : 22/06/94
Function: Introduces the host-specific functions
this is in effect the definition of the
porting layer for DPL
History : Rev 1.0, 23 / 06 / 1994
The renderer must supply entrypoints to manipulate
dpl-style lists and trees, and support must be provided
for the hide, unhide and flush methods of the dpl classes.
**************************** */
extern int32 dpl_WarningLevel;
extern char *__lastop;
extern void
ghost_dpl_init( char *dpl_arg );
extern void
ghost_dpl_bind_functions ( dpl_node * );
extern void
ghost_dpl_add_list_item ( dpl_superlist *head, dpl_node *node );
extern void
ghost_dpl_remove_list_item ( dpl_superlist *head, dpl_node *node );
extern void
ghost_dpl_nest_dcs ( dpl_DCS *parent, dpl_DCS *node );
extern void
ghost_dpl_prune_dcs ( dpl_DCS *parent, dpl_DCS *child );
extern void
ghost_dpl_link_dcs ( dpl_DCS *bro, dpl_DCS *sis );
void
ghost_dpl_morph_object ( dpl_OBJECT *morphed,
dpl_OBJECT *a,
dpl_OBJECT *b,
float32 alpha );
extern void
ghost_dpl_draw_scene ( int32 dubblebuffrd );
extern int32
ghost_dpl_draw_scene_complete ( void );
extern void
ghost_dpl_wait_draw_scene_complete ( void );
extern void
ghost_dpl_version ( dpl_VERSION *v );
extern void
ghost_dpl_statistics ( dpl_STATISTICS *s );
extern int32
ghost_dpl_set_texmap_texels ( dpl_TEXMAP *tm,
int32 *texels,
int32 u_size,
int32 v_size,
int32 mode );
extern int32
ghost_dpl_set_geometry_vertices ( dpl_GEOMETRY *gg,
dpl_VERTEX_LIST *vl,
dpl_CONNECTION_LIST *cl,
int32 vertices,
int32 connections );
extern void
ghost_dpl_readpixels ( int32 *pixels, int32 x, int32 y, int32 n_pixels );
extern dpl_INSTANCE *
ghost_dpl_sectvector ( dpl_POINT sect,
float32 x0, float32 y0, float32 z0,
float32 x1, float32 y1, float32 z1 );
extern dpl_INSTANCE *
ghost_dpl_sectpixel ( dpl_POINT sect, float32 x, float32 y );
#endif
Binary file not shown.
+259
View File
@@ -0,0 +1,259 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <dpl.h>
#include <dpl_host.h>
/*{{{ banner*/
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : dpl_load.c
Project : dpl interface object loading support
host / platform independent section
Author : PJA
Date : 22/06/94
Function: Implements the host section of the dpl
b2z object loader
History : Rev 1.1, 22 / 06 / 1994
**************************** */
/*}}} */
/*{{{ load_b2z ( char *full_name )*/
int32
load_b2z ( dpl_node *head_node, char *full_name )
{
extern dpl_OBJECT *
b2zread ( dpl_OBJECT *param_object, char *f );
return (b2zread ((dpl_OBJECT *) head_node, full_name ) != NULL);
}
/*}}} */
/*{{{ load_svt ( char *full_name )*/
static char *worst_case_texels=NULL;
int32
load_svt ( dpl_node *head_node, char *full_name )
{
#if 0
/*{{{ static int parse_texture ( int32 length )*/
static int parse_texture ( int32 length )
{
/*
always create a new texture, but try to chain it to an
existing texmap
*/
dpl_TEXTURE *real_tex;
int32 bilinear, bytes=0, hdr, len;
int8 scope=0, minify=0, magnify=0, wrap_u=0, wrap_v=0, alpha=0, mode;
char c, *name_p=texture_name;
*name_p=0x0;
while (b2z_ok && (bytes < length)) {
bytes+=b2z_block(&hdr, &len );
if (b2z_ok == 0) return 0;
switch ( hdr ) {
/*{{{ name*/
case 0x2008 :
trprintf ( "TEXTURE NAME\n" );
name_p=texture_name;
while (c=get_char())
*name_p++=c;
trprintf ("texture %s\n", texture_name );
break;
/*}}} */
/*{{{ scope*/
case 0x200a :
trprintf ( "SCOPE\n" );
scope=get_int8();
trprintf ( "SCOPE = 0x%x\n", scope );
break;
/*}}} */
/*{{{ file name*/
case 0x0011 :
case 0x4011 :
case 0x8011 :
trprintf ( "TEXTURE FILE NAME\n" );
name_p=texmap_name;
while (c=get_char())
*name_p++=c;
trprintf ("map name %s\n", texmap_name );
break;
/*}}} */
/*{{{ minify*/
case 0x0012 :
trprintf ( "MINIFY\n" );
minify=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
break;
/*}}} */
/*{{{ magnify*/
case 0x0013 :
trprintf ( "MAGNIFY\n" );
magnify=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
break;
/*}}} */
/*{{{ alpha*/
case 0x0014 :
trprintf ( "ALPHA\n" );
alpha=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
break;
/*}}} */
/*{{{ wrap u*/
case 0x0015 :
trprintf ( "WRAP_U\n" );
wrap_u=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
break;
/*}}} */
/*{{{ wrap v*/
case 0x0016 :
trprintf ( "WRAP_V\n" );
wrap_v=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
break;
/*}}} */
/*{{{ detail*/
case 0x0017 :
trprintf ( "DETAIL\n" );
mode=get_int8();
trprintf ( "MODE = 0x%x\n", mode );
skip_block(len-1);
break;
/*}}} */
default :
printf ( "Unexpected header 0x%x in texture, bytes=%d length=%d\n",
hdr, bytes, length );
skip_block(len);
break;
}
bytes+=len;
}
texmap = (dpl_TEXMAP *) dpl_FindNamedTypedNode ( dpl_type_texmap,
texmap_name );
if (texmap == NULL) {
/*{{{ load up the texture map*/
/* first try to load the texture */
if ((magnify == 1) || (magnify == 0))
bilinear=0;
else
bilinear=1;
texmap = dpl_NewTexMap ();
dpl_NameNode ( (dpl_node *) texmap, texmap_name );
texmap->bits_per_texel=32; /* sorry about this hack */
if (load_svt((dpl_node *) texmap, texmap_name)) {
int *map_texels=texmap->texels;
/* this is HORRIBLE - i will fix it later....... */
texmap->texels=NULL;
trprintf ("went load_svt, have u_size %d v_size %d\n",
texmap->u_size, texmap->v_size );
dpl_SetTexmapTexels ( texmap,
map_texels,
texmap->u_size,
texmap->v_size,
bilinear );
/* and the call to SetTexMapTexels has flushed the node */
/* HACK TO SAVE MEMORY */
free(texmap->texels);
texmap->texels=NULL;
}
/*}}} */
}
real_tex = (dpl_TEXTURE *) look_up ( dpl_type_texture,
texture_name,
(node_create_function) dpl_NewTexture );
real_tex->minify = minify;
real_tex->magnify = magnify;
real_tex->alpha = alpha;
real_tex->wrap_u = wrap_u;
real_tex->wrap_v = wrap_v;
real_tex->texmap = texmap;
dpl_Flush(real_tex);
return 1;
}
/*}}} */
#endif
dpl_TEXMAP *map=(dpl_TEXMAP *) head_node;
FILE *fp=fopen(full_name, "rb" );
long l_edge, texels;
int32 edge;
if (fp==NULL) {
printf ("failed to open file %s\n", full_name );
return 0;
}
else {
fseek ( fp, 0L, SEEK_END );
l_edge=ftell(fp);
fseek ( fp, 0L, SEEK_SET );
edge=128;
if (l_edge == 16384L) edge=64;
else if (l_edge == 65536L) edge=128;
else if (l_edge == 262144L) edge=256;
else {
printf("Bad texture file size 0x%lx\n",l_edge);
fclose(fp);
return 0;
}
}
texels=l_edge;
if (worst_case_texels == NULL) {
worst_case_texels=malloc(256*256*sizeof(int));
}
map->texels=worst_case_texels;
if (map->texels) {
char *texelp=(char *) map->texels;
while (texels) {
int i;
fread ( texelp, 1, 8192, fp );
texels-=8192;
texelp+=8192;
}
fclose(fp);
map->u_size=edge;
map->v_size=edge;
return 1;
}
else {
printf ("Failed to malloc space for texels in map %s\n", full_name );
fclose (fp);
return 0;
}
}
/*}}} */
+1
View File
@@ -0,0 +1 @@
dpl_load.c(232): Warning! W113: Pointer type mismatch
+38
View File
@@ -0,0 +1,38 @@
#ifndef dpl_load_h
#define dpl_load_h
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "dpl.h"
#include "dpl_host.h"
/*{{{ banner*/
/* **************************************************
Copyright DIVISION Limited (c) 1994
All rights reserved
File : dpl_load.c
Project : dpl interface object loading support
host / platform independent section
Author : PJA
Date : 22/06/94
Function: Implements the host section of the dpl
b2z object loader
History : Rev 1.1, 22 / 06 / 1994
**************************** */
/*}}} */
extern int32
load_b2z ( dpl_node *node, char *fname );
extern int32
load_svt ( dpl_node *node, char *fname );
#endif
Binary file not shown.
View File
+1245
View File
File diff suppressed because it is too large Load Diff
+72
View File
@@ -0,0 +1,72 @@
/*
* PROJECT: DVS
* SUBSYSTEM: VL
* MODULE: basictypes.def
*
* File: $RCSfile: basictypes.def,v $
* Revision: $Revision: 0.4 $
* Date: $Date: 1993/09/24 11:29:01 $
* Author: $Author: jon $
* RCS Ident: $Id: basictypes.def,v 0.4 1993/09/24 11:29:01 jon Exp $
*
* FUNCTION:
* This module is used to hold the parameterised definitions of the basic
* types used throughout the system for all the machines supported. When
* porting to a new architecture all type stuff should be modified in
* here. There should be no machine dependant code anywhere else!
*
* each of the basic type int8 uint8 etc, etc is defined in terms of
* standard ansi 'C' types here, and given a enum name for conveniance.
*
* The format is DEF_TYPE ( <enum name>, <type name>, <ansi 'C' equiv> )
*
* $Log: basictypes.def,v $
Revision 0.4 1993/09/24 11:29:01 jon
Release 2.0.4
Revision 1.1 93/07/12 08:12:21 john
Initial revision
# Revision 1.6 1993/03/19 15:24:22 john
# added definition for system V release 4.2
#
# Revision 1.5 1992/09/28 17:19:58 mark
# Added definitions for IRIS Indigo
#
# Revision 1.4 1992/09/15 13:47:54 jeff
# now use _SYSV386 not SYSV386
#
# Revision 1.3 1992/09/15 13:10:32 jeff
# added defs for SYSV386 targets.
#
# Revision 1.2 1992/09/14 13:18:53 jeff
# progress, progreess....
#
# Revision 1.1 1992/07/27 12:24:20 jeff
# Initial revision
#
*
* Copyright (c) 1992 Division Ltd.
*
* All Rights Reserved.
*
* This Document may not, in whole or in part, be copied,
* photocopied, reproduced, translated, or reduced to any
* electronic medium or machine readable form without prior
* written consent from Division Ltd.
*/
DEF_TYPE( INT8, int8, signed char )
DEF_TYPE( UINT8, uint8, unsigned char )
DEF_TYPE( INT16, int16, signed short )
DEF_TYPE( UINT16, uint16, unsigned short )
DEF_TYPE( INT32, int32, signed int )
DEF_TYPE( UINT32, uint32, unsigned int )
DEF_TYPE( FLOAT32, float32, float)
DEF_TYPE( FLOAT64, float64, double)
/*
* Note we may need to put ifdefs back in here for some machines IE 64Bit processors ?
*/

+241
View File
@@ -0,0 +1,241 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include <conio.h>
#include "dpltypes.h"
#include "dpl.h"
#include "matrix.h"
#include "spline.h"
/*{{{ static float atan2deg ( float dz, float dx )*/
static float _atan2deg ( float dz, float dx )
{
float angle;
if ((dx*dx) < 0.0001f) {
angle=(dz>0) ? 90.0f : -90.0f;
return angle;
}
else {
return (180.0f / 3.1415926535f) * atan2 ( dz, dx );
}
}
/*}}} */
/*{{{ static void xformpoint ( POINT q, POINT p, MATRIX m )*/
static void _xformpoint ( dpl_POINT q, dpl_POINT p, dpl_MATRIX m )
{
dpl_POINT r;
int i;
for (i=0; i<4; i++ ) {
r[i]=(p[0]*m[0][i])+
(p[1]*m[1][i])+
(p[2]*m[2][i])+
(p[3]*m[3][i]);
}
memcpy ( q, r, sizeof(dpl_POINT));
}
/*}}} */
/*{{{ void look_at ( VIEW *v, float *from, float *at, float z_spin )*/
void look_at ( dpl_VIEW *v, float *from, float *at, float z_spin )
{
/* construct a view from 2 points */
float dx, dy, dz;
float px, py, pz;
float thetax, thetay, thetaz;
float yaw, roll;
dpl_MATRIX m;
dpl_POINT p, q;
/* put 'at' at origin, construct a vector from 'from' */
px=from[0]; py=from[1]; pz=from[2];
dx=at[0]-px;
dy=at[1]-py;
dz=at[2]-pz;
thetaz=0.0f;
thetay=0.0f;
thetax=0.0f;
p[0]=dx;
p[1]=dy;
p[2]=dz;
p[3]=1;
yaw=-_atan2deg ( dz, dx );
dpl_IdMatrix ( m );
dpl_Rotate ( m, -yaw, dpl_Y );
_xformpoint ( q, p, m );
roll=_atan2deg(q[1], q[0] );
/* project onto x-z plane, assuming camera is initially looking down -z */
dpl_IdMatrix ( v->matrix );
/* apply angles to matrix */
dpl_Rotate ( v->matrix, z_spin, dpl_Z );
dpl_Rotate ( v->matrix, roll, dpl_X );
dpl_Rotate ( v->matrix, yaw-90.0f, dpl_Y );
dpl_Translate( v->matrix, px, py, pz );
dpl_Flush ( v );
}
/*}}} */
static int camera_inited=0;
static float camera_t=0.0f;
static cntl_point *camerahead=NULL;
/*{{{ void camera_move ( VIEW *eye,*/
void camera_move ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt )
{
cntl_point *p=camerahead;
float t=camera_t;
float px, py, pz, rx, ry, rz;
dpl_POINT evalp;
if (camera_inited == 0) {
camera_inited=1;
p=init_splines(spline_file);
t=0;
}
px=eval(p->x_pos_cubic, t );
py=eval(p->y_pos_cubic, t );
pz=eval(p->z_pos_cubic, t );
rx=eval(p->x_rot_cubic, t );
ry=eval(p->y_rot_cubic, t );
rz=eval(p->z_rot_cubic, t );
camerahead=walk_spline ( p, &t, dt );
camera_t=t;
/* we have wobbled the spline according to the file - now build the
view matrix */
/*
eye->matrix[3][0]=px+look_at_point[0];
eye->matrix[3][1]=py+look_at_point[1];
eye->matrix[3][2]=pz+look_at_point[2];
look_at ( eye, &eye->matrix[3][0], look_at_point, rz );
*/
dpl_IdMatrix ( eye->matrix );
dpl_Rotate ( eye->matrix, rz, dpl_Z );
dpl_Rotate ( eye->matrix, rx, dpl_X );
dpl_Rotate ( eye->matrix, ry, dpl_Y );
dpl_Translate ( eye->matrix, px, py, pz );
printf ("camera at %f %f %f\n",
px, py, pz );
dpl_Flush(eye);
}
/*}}} */
/*{{{ void camera_move_kbd ( VIEW *eye,*/
static float yaw=0.0f, pitch=0.0f, roll=0.0f,
velocity=0.0f,
px=0.0f, py=0.0f, pz=0.0f,
pitch_velocity = 0.0f,
yaw_velocity = 0.0f,
roll_velocity = 0.0f,
dspin=0.3f, dspeed=0.3f;
void camera_move_kbd ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt )
{
dpl_POINT vel0, vel1;
/* compute roll, pitch, yaw from keyboard input */
if (kbhit()) {
int ch;
ch=getch();
switch (ch) {
case '7' : /* roll left */
roll_velocity += dspin;
break;
case '9': /* roll right */
roll_velocity -= dspin;
break;
case '4' : /* swing left weeet chariot */
yaw_velocity+=dspin;
break;
case '6' : /* right */
yaw_velocity-=dspin;
break;
case '2' : /* upp */
pitch_velocity+=dspin;
break;
case '8' : /* downnn */
pitch_velocity-=dspin;
break;
case '5' : /* go faster */
velocity+=dspeed;
break;
case '0' : /* decelerate */
velocity-=dspeed;
break;
case '*' :
pitch_velocity = 0.0;
roll_velocity = 0.0;
yaw_velocity = 0.0;
break;
case '-':
pitch = 0.0;
yaw = 0.0;
roll = 0.0;
break;
case ' ' : /* set speed to 0 */
velocity=0.0f;
pitch_velocity = 0.0f;
yaw_velocity = 0.0f;
roll_velocity = 0.0f;
break;
}
}
vel0[0]=0;
vel0[1]=0;
vel0[2]=-velocity;
dpl_IdMatrix ( eye->matrix );
roll += roll_velocity;
pitch += pitch_velocity;
yaw += yaw_velocity;
dpl_Rotate ( eye->matrix, roll, dpl_Z );
dpl_Rotate ( eye->matrix, pitch, dpl_X );
dpl_Rotate ( eye->matrix, yaw, dpl_Y );
_xformpoint ( vel1, vel0, eye->matrix );
px+=vel1[0];
py+=vel1[1];
pz+=vel1[2];
dpl_Translate ( eye->matrix, px, py, pz );
dpl_Flush(eye);
}
/*}}} */
+17
View File
@@ -0,0 +1,17 @@
#ifndef camera_h
#define camera_h
#include "dpltypes.h"
extern void camera_move ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt );
extern void camera_move_kbd ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt );
#endif
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
23
-134.2 73.1 0.0 0.0 0.0 0.0
-134.2 73.1 0.0 0.0 0.0 0.0
-134.2 73.1 0.0 0.0 0.0 0.0
-134.2 73.1 0.0 0.0 0.0 0.0
-134.2 73.1 0.0 0.0 0.0 0.0
-134.2 -13.1 0.0 0.0 0.0 0.0
-134.2 -23.1 0.0 0.0 0.0 0.0
-134.2 -23.1 0.0 0.0 0.0 0.0
-134.2 -23.1 0.0 0.0 0.0 0.0
-134.2 -23.1 0.0 0.0 0.0 0.0
-100.3 -2.4 109.1 5.0 4.0 5.0
-40.3 -12.4 89.1 5.0 4.0 5.0
109.1 -24.3 2.2 7.0 2.0 4.0
-0.6 73.3 -101.1 0.0 -3.0 0.0
-32.6 3.3 -81.1 0.0 -3.0 360.0
119.1 -24.3 -140.2 7.0 2.0 0.0
112.1 -20.3 -100.2 7.0 2.0 0.0
0.6 0.3 140.1 0.0 -3.0 0.0
30.6 53.3 30.1 0.0 -3.0 0.0
0.6 73.3 101.1 0.0 -3.0 0.0
32.6 3.3 91.1 0.0 -3.0 0.0
-119.1 -24.3 140.2 7.0 2.0 0.0
-112.1 -20.3 100.2 7.0 2.0 0.0

File diff suppressed because it is too large Load Diff
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
tanks 20 floor.v2z zilch
+34
View File
@@ -0,0 +1,34 @@
32
0 0 0 0 0 0
2000 0 0 0 0 0
4000 0 0 0 0 0
6000 0 0 0 0 0
8000 0 20 0 90 0
8000 0 40 0 90 0
8000 0 60 0 90 0
8000 0 80 0 90 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 360 0
0 0 0 0 360 0
0 0 0 0 360 0
0 0 0 0 360 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 270 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 180 0
0 0 0 0 90 0
0 0 0 0 90 0
0 0 0 0 90 0
0 0 0 0 90 0

+11
View File
@@ -0,0 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
int main ( int argc, char **argv )
{
float t;
sscanf ( argv[1], "%f", &t );
printf ( "0x%x\n", *(int *) &t );
}
+1
View File
@@ -0,0 +1 @@
float.c(11): Warning! W107: Missing return value for function 'main'
Binary file not shown.
Binary file not shown.
+504
View File
@@ -0,0 +1,504 @@
/*
FILE : testpp5.c
PROJECT : pxpl5 renderer test
Author : Phil Atkin
(C) Division Ltd 1993.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "dpl.h"
#include "matrix.h"
#include "startup.h"
#include "spline.h"
#include "camera.h"
char *progname;
static char *dpl_arg;
/* a few static dpltypes */
static dpl_ZONE *zone=NULL;
static dpl_LMODEL *lmodel=NULL;
static dpl_LIGHT *direct=NULL;
static dpl_LIGHT *ambient=NULL;
static dpl_VIEW *eye, *rye;
/*{{{ void eyeStuff ( VIEW *view )*/
void eyeStuff ( dpl_VIEW *view, int left )
{
float scale=1.0;
dpl_IdMatrix(view->matrix);
dpl_Translate (view->matrix, scale*1.275, 0, 0 );
dpl_Rotate (view->matrix, 180, dpl_Y );
dpl_Translate (view->matrix, 0, 0, -48 );
dpl_Flush (view);
}
/*}}} */
/*{{{ char *makeVizName ( char *name )*/
char vizStr [256];
char *makeVizName ( char *name )
{
char *root;
if ((root=getenv("VIZPATH")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makeTexName ( char *name )*/
char texStr [256];
char *makeTexName ( char *name )
{
char *root;
if ((root=getenv("TEXTURE")) == NULL)
return(name);
else {
strcpy ( texStr, root );
strcat ( texStr, name );
return ( texStr );
}
}
/*}}} */
/*{{{ char *makedplName ( char *name )*/
char *makedplName ( char *dplstr, char *name )
{
char *root;
if ((root=getenv("DVIEWBIN")) == NULL)
return(name);
else {
strcpy ( dplstr, root );
strcat ( dplstr, name );
return ( dplstr );
}
}
/*}}} */
/*{{{ int env2hex ()*/
int env2hex ( char *env_str, int default_v )
{
char *s;
int v;
if (s = getenv(env_str)) {
if (sscanf(s, "%x", &v) == 1) {
return v;
}
}
printf ("Defaulting on %s to 0x%x\n", env_str, default_v );
return default_v;
}
/*}}} */
/*{{{ cheesy scene file support*/
/*{{{ about the cheesy file format*/
/*
this is a DEAD quick and dirty 'get-your-geometry-executing' thing,
which loads up a scene, and constantly executes it, allowing the
user to wander round by keyboard flight.
it only took 30 minutes to write so is not supported.
cheesy scene format is
FOG z0 z1 r g b
BACKGND r g b
AMBIENT r g b
LIGHT r g b dx dy dz
STATIC name scale px py pz rx ry rz
DYNAMIC name scale splinefile t0 dt
*/
/*}}} */
/*{{{ cheesy structure*/
typedef struct s_cheesy {
dpl_DCS *dcs;
cntl_point *p;
float scale;
float t, dt;
struct s_cheesy *next;
} cheesy_scene;
cheesy_scene *camembert=NULL;
/*}}} */
/*{{{ static cheesy_scene *load_cheesy_scene ( char *s )*/
static cheesy_scene *load_cheesy_scene ( char *s )
{
cheesy_scene *cheesy_head=NULL;
FILE *fp=fopen(s, "rt" );
int read;
dpl_DCS *zone_root;
dpl_DCS *geom_root,
*geom_tail=NULL;
dpl_DCS *light_root,
*light_tail=NULL;
char *str=malloc(256);
if (fp==NULL) {
printf ("couldnt open scene file\n" );
exit(666);
}
zone_root =dpl_NewDcs();
light_root=dpl_NewDcs();
geom_root =dpl_NewDcs();
light_tail=light_root;
geom_tail =geom_root;
lmodel=dpl_NewLmodel ();
dpl_SetZoneRootDcs ( zone, zone_root );
dpl_SetZoneLmodel ( zone, lmodel );
dpl_LinkDcs ( zone_root, light_root );
dpl_NestDcs ( zone_root, geom_root );
read=fscanf( fp, "%s ", str );
while (read == 1) {
float neer, phar, r, g, b;
if (strncmp ( str, "FOG", 3) == 0) {
/*{{{ */
read=fscanf( fp, "%f %f %f %f %f\n", &neer, &phar, &r, &g, &b );
printf ("fog %f, %f %f, %f, %f\n", neer, phar, r, g, b );
dpl_SetViewFog ( eye, 1, r, g, b, neer, phar );
if (rye)
dpl_SetViewFog ( rye, 1, r, g, b, neer, phar );
/*}}} */
}
else if (strncmp ( str, "BACKGND", 7) == 0) {
/*{{{ */
read=fscanf( fp, "%f %f %f\n", &r, &g, &b );
printf ("set background %f, %f, %f\n", r, g, b );
dpl_SetViewBackGround ( eye, r, g, b );
if (rye) dpl_SetViewBackGround ( rye, r, g, b );
/*}}} */
}
else if (strncmp ( str, "STATIC", 5) == 0) {
/*{{{ */
dpl_DCS *d;
dpl_INSTANCE *i;
dpl_OBJECT *o;
read=fscanf( fp, "%s ", str );
printf ("create static object %s\n", str );
d=geom_tail;
o=dpl_NewObject();
if (o) {
float scale, tx, ty, tz, rx, ry, rz;
dpl_LoadObject ( o, str );
printf ("loaded object\n" );
read=fscanf( fp, "%f %f %f %f %f %f %f\n",
&scale, &tx, &ty, &tz, &rx, &ry, &rz );
printf ("translate %f %f %f\n", tx, ty, tz );
i=dpl_NewInstance();
dpl_SetInstanceObject ( i, o );
dpl_IdMatrix ( d->matrix );
dpl_Rotate ( d->matrix, rz, dpl_Z );
dpl_Rotate ( d->matrix, rx, dpl_X );
dpl_Rotate ( d->matrix, ry, dpl_Y );
dpl_Scale ( d->matrix, scale, scale, scale );
dpl_Translate ( d->matrix, tx, ty, tz );
d->identity=0;
dpl_SetDcsInstance ( d, i );
d=dpl_NewDcs ();
dpl_LinkDcs ( geom_tail, d );
geom_tail=d;
dpl_Hide(o);
}
else {
printf ("Failed to load object from file %s\n", str );
exit(666);
}
/*}}} */
}
else if (strncmp ( str, "DYNAMIC", 7) == 0) {
/*{{{ */
cheesy_scene *edam=malloc(sizeof(cheesy_scene));
dpl_DCS *d;
dpl_INSTANCE *i;
dpl_OBJECT *o;
read=fscanf( fp, "%s ", str );
printf ("create dynamic object %s\n", str );
o=dpl_NewObject();
if (o) {
float scale, t0, dt;
dpl_LoadObject ( o, str );
read=fscanf( fp, "%f %s %f %f\n",
&scale, str, &t0, &dt );
printf ("spline file %s\n", str );
i=dpl_NewInstance();
dpl_SetInstanceObject ( i, o );
d=geom_tail;
edam->p=init_splines ( str );
edam->scale = scale;
edam->t =t0;
edam->dt=dt;
edam->dcs=geom_tail;
edam->next=cheesy_head;
cheesy_head=edam;
dpl_SetDcsInstance ( d, i );
d=dpl_NewDcs ();
dpl_LinkDcs ( geom_tail, d );
geom_tail=d;
dpl_Hide(o);
}
else {
printf ("Failed to load object from file %s\n", str );
exit(666);
}
/*}}} */
}
else if (strncmp ( str, "AMBIENT", 6) == 0) {
/*{{{ */
dpl_LIGHT *light;
float r, g, b;
read=fscanf( fp, "%f %f %f\n", &r, &g, &b );
light=dpl_NewLight();
dpl_SetLightType ( light, dpl_light_type_ambient );
dpl_SetLightColor ( light, r, g, b );
dpl_AddLightToLmodel ( lmodel, light );
/*}}} */
}
else if (strncmp ( str, "LIGHT", 5) == 0) {
/*{{{ */
dpl_DCS *d;
dpl_LIGHT *light;
float r, g, b, x, y, z;
read=fscanf( fp, "%f %f %f %f %f %f\n", &r, &g, &b, &x, &y, &z );
d=light_tail;
light=dpl_NewLight();
dpl_SetLightType ( light, dpl_light_type_directional );
dpl_SetLightColor ( light, r, g, b );
dpl_AddLightToLmodel ( lmodel, light );
d=light_tail;
dpl_SetDcsLight ( d, light );
dpl_IdMatrix ( d->matrix );
dpl_Rotate ( d->matrix, z, dpl_Z );
dpl_Rotate ( d->matrix, x, dpl_X );
dpl_Rotate ( d->matrix, y, dpl_Y );
d->identity=0;
dpl_Flush(d);
d=dpl_NewDcs ();
dpl_LinkDcs ( light_tail, d );
light_tail=d;
/*}}} */
}
else {
printf ("Huh, dont understand %s\n", str );
exit(666);
}
read=fscanf( fp, "%s ", str );
}
fclose(fp);
printf ("hey, read the scene\n" );
fflush(stdout);
return cheesy_head;
}
/*}}} */
/*{{{ static execute ( cheesy_scene *s )*/
static execute ( cheesy_scene *s )
{
while (s) {
cntl_point *p=s->p;
if (p) {
dpl_DCS *d=s->dcs;
float t, px, py, pz, rx, ry, rz;
t=s->t;
px=eval(p->x_pos_cubic, t );
py=eval(p->y_pos_cubic, t );
pz=eval(p->z_pos_cubic, t );
rx=eval(p->x_rot_cubic, t );
ry=eval(p->y_rot_cubic, t );
rz=eval(p->z_rot_cubic, t );
p = walk_spline ( p, &s->t, s->dt );
s->p = p;
dpl_IdMatrix ( d->matrix );
dpl_Rotate ( d->matrix, rz, dpl_Z );
dpl_Rotate ( d->matrix, rx, dpl_X );
dpl_Rotate ( d->matrix, ry, dpl_Y );
dpl_Scale ( d->matrix, s->scale, s->scale, s->scale );
dpl_Translate ( d->matrix, px, py, pz );
dpl_Flush(d);
}
s=s->next;
}
}
/*}}} */
/*}}} */
/*{{{ int nain ( int argc, char *argv[])*/
int nain ( int argc, char *argv[])
{
dpl_node *sky;
zone=initialize_all ( dpl_arg,
0,
&eye, &rye, far_clip / 2.0f );
camembert=load_cheesy_scene ( argv[1] );
/*{{{ make sky move*/
if (sky=dpl_FindNamedTypedNode ( dpl_type_texture, "sky_tex")) {
dpl_TEXTURE *tex=(dpl_TEXTURE *) sky;
tex->u0=0;
tex->v0=0;
tex->dv=0.13f;
tex->du=0.0373f;
dpl_Flush(tex);
}
/*
*/
/*}}} */
/*{{{ make plant move*/
if (sky=dpl_FindNamedTypedNode ( dpl_type_texture, "plant")) {
dpl_TEXTURE *tex=(dpl_TEXTURE *) sky;
tex->u0=0;
tex->v0=0;
tex->dv=0.1;
tex->du=0.913f;
dpl_Flush(tex);
}
/*}}} */
/*{{{ make fish move*/
if (sky=dpl_FindNamedTypedNode ( dpl_type_texture, "plant4")) {
dpl_TEXTURE *tex=(dpl_TEXTURE *) sky;
tex->u0=0;
tex->v0=0;
tex->dv=0.6;
tex->du=0.0f;
dpl_Flush(tex);
}
/*}}} */
while (1) {
if (argc > 2)
camera_move ( eye, argv[2],
NULL, 0.0f, 0.0132f );
else
camera_move_kbd ( eye, "dontneed.one",
NULL, 1.0f, 0.0057f );
dpl_DrawScene (1);
execute ( camembert );
}
return 0;
}
/*}}} */
/*{{{ int main ( int argc, char *argv[] )*/
int main ( int argc, char *argv[] )
{
progname=argv[0];
if (argc < 2) {
printf ("usage %s: <scenefile>\n", argv[0] );
exit(666);
}
else {
dpl_arg=getenv("dplarg");
/* dpl_SetWarningLevel ( 100 ); */
if (dpl_arg) {
if (screen_resolution ( dpl_arg ) == 0) {
printf ("failed to understand video format\n");
exit(666);
}
}
else {
printf ("failed to getenv dplarg\n");
exit(666);
}
near_clip=6.0;
far_clip =12000.0f;
nain ( argc, argv );
}
return 0;
}
/*}}} */
Binary file not shown.
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
goto total.c (Editing* C)
goto fold.stp (Editing* Default)
command "fold.cmd"
foldmark "Occam" "--" ""
foldmark "C" "/*" "*/"
foldmark "Pascal" "(*" "*)"
foldmark "Iterm" "#" ""
foldmark "Latex" "%%" ""
foldmark "Asm" ";" ""
foldmark "As860" "\\" ""
foldmark "C++" "//" ""
#{{{ 0 Macro key to type "--" at the beginning of a line
209 45 45 202
#}}}
#{{{ 1 Macro key to say Hello World
72 101 108 108 111 32 87 111 114 108 100
#}}}
#{{{ 3 Macro key to duplicate a fold marker
221 212 211 222 209 246 249 202 211 209 205
#}}}
#{{{ 8 Macro key to search
224
#}}}
#{{{ 9 Macro key to replace
225
#}}}
+11
View File
@@ -0,0 +1,11 @@
FOG 2000.0 12000.0 0.2 0.3 0.5
BACKGND 0.4 0.6 0.8
AMBIENT 0.4 0.4 0.6
LIGHT 0.99 0.99 0.99 60 0 0
STATIC ocean 20.0 0 -190 0 0 0 0
STATIC plant1 30.0 -500 -190 -600 0 -35 90
STATIC plant2 32.0 0 -190 -500 0 70 90
STATIC plant3 31.0 600 -190 -500 0 20 90
STATIC plant4 27.0 -500 -190 0 0 0 90
+18
View File
@@ -0,0 +1,18 @@
16
0.0 -4.0 0.0 0.01 -3.0 0.0
0.0 -4.0 0.0 0.01 -3.0 0.0
3.0 0.6 0.0 1.8 0.0 0.0
4.0 0.9 0.0 1.6 0.0 0.0
4.3 1.5 0.0 1.9 2.0 3.0
3.9 1.00 -0.1 1.4 -3.0 0.0
4.6 0.29 -0.1 1.2 -3.0 0.0
5.0 0.4 -0.20 1.6 -3.0 0.0
6.5 0.72 0.2 1.82 -3.0 0.0
7.0 0.90 0.0 1.93 -3.0 0.0
8.0 0.75 0.0 2.17 -3.0 0.0
9.0 -0.37 0.1 2.6 -3.0 0.0
10.0 -0.7 0.1 2.9 -3.0 0.0
11.0 -1.5 0.1 3.3 -3.0 0.0
12.0 -4.8 0.1 4.5 -3.0 0.0
0.0 -4.0 0.0 0.01 -3.0 0.0

+18
View File
@@ -0,0 +1,18 @@
16
0.0 -4.0 0.0 0.01 -3.0 0.0
0.0 -1.6 0.2 0.8 0.0 0.0
1.0 6.9 0.0 1.1 0.0 0.0
1.3 19.5 0.1 1.9 2.0 3.0
2.9 16.40 -0.1 2.2 -3.0 0.0
6.8 14.9 -0.1 2.3 -3.0 0.0
14.3 16.0 -0.20 2.1 -3.0 0.0
12.8 14.9 0.2 2.4 -3.0 0.0
11.3 14.0 0.0 2.2 -3.0 0.0
12.8 15.1 0.0 2.047 -3.0 0.0
14.3 16.0 0.1 2.3 -3.0 0.0
12.8 15.0 0.0 2.2 -3.0 0.0
11.0 13.7 -0.1 0.43 -3.0 0.0
10.0 -0.3 0.1 0.0 -3.0 0.0
0.0 -4.0 0.0 0.01 -3.0 0.0
0.0 -4.0 0.0 0.01 -3.0 0.0

+262
View File
@@ -0,0 +1,262 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include <conio.h>
#include "dpl.h"
#include "matrix.h"
#include "spline.h"
/*{{{ static float atan2deg ( float dz, float dx )*/
static float _atan2deg ( float dz, float dx )
{
float angle;
if ((dx*dx) < 0.0001f) {
angle=(dz>0) ? 90.0f : -90.0f;
return angle;
}
else {
return (180.0f / 3.1415926535f) * atan2 ( dz, dx );
}
}
/*}}} */
/*{{{ static void xformpoint ( POINT q, POINT p, MATRIX m )*/
static void _xformpoint ( dpl_POINT q, dpl_POINT p, dpl_MATRIX m )
{
dpl_POINT r;
int i;
for (i=0; i<4; i++ ) {
r[i]=(p[0]*m[0][i])+
(p[1]*m[1][i])+
(p[2]*m[2][i])+
(p[3]*m[3][i]);
}
memcpy ( q, r, sizeof(dpl_POINT));
}
/*}}} */
/*{{{ void look_at ( VIEW *v, float *from, float *at, float z_spin )*/
void look_at ( dpl_VIEW *v, float *from, float *at, float z_spin )
{
/* construct a view from 2 points */
float dx, dy, dz;
float px, py, pz;
float thetax, thetay, thetaz;
float yaw, roll;
dpl_MATRIX m;
dpl_POINT p, q;
/* put 'at' at origin, construct a vector from 'from' */
px=from[0]; py=from[1]; pz=from[2];
dx=at[0]-px;
dy=at[1]-py;
dz=at[2]-pz;
thetaz=0.0f;
thetay=0.0f;
thetax=0.0f;
p[0]=dx;
p[1]=dy;
p[2]=dz;
p[3]=1;
yaw=-_atan2deg ( dz, dx );
dpl_IdMatrix ( m );
dpl_Rotate ( m, -yaw, dpl_Y );
_xformpoint ( q, p, m );
roll=_atan2deg(q[1], q[0] );
/* project onto x-z plane, assuming camera is initially looking down -z */
dpl_IdMatrix ( v->matrix );
/* apply angles to matrix */
dpl_Rotate ( v->matrix, z_spin, dpl_Z );
dpl_Rotate ( v->matrix, roll, dpl_X );
dpl_Rotate ( v->matrix, yaw-90.0f, dpl_Y );
dpl_Translate( v->matrix, px, py, pz );
}
/*}}} */
static int camera_inited=0;
static float camera_t=0.0f;
static cntl_point *camerahead=NULL;
/*{{{ void camera_move ( VIEW *eye,*/
void camera_move ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt )
{
cntl_point *p=camerahead;
float t=camera_t;
float px, py, pz, rx, ry, rz;
dpl_POINT evalp;
if (camera_inited == 0) {
camera_inited=1;
p=init_splines(spline_file);
t=0;
}
px=eval(p->x_pos_cubic, t );
py=eval(p->y_pos_cubic, t );
pz=eval(p->z_pos_cubic, t );
rx=eval(p->x_rot_cubic, t );
ry=eval(p->y_rot_cubic, t );
rz=eval(p->z_rot_cubic, t );
camerahead=walk_spline ( p, &t, dt );
camera_t=t;
/* we have wobbled the spline according to the file - now build the
view matrix */
/*
eye->matrix[3][0]=px+look_at_point[0];
eye->matrix[3][1]=py+look_at_point[1];
eye->matrix[3][2]=pz+look_at_point[2];
look_at ( eye, &eye->matrix[3][0], look_at_point, rz );
*/
dpl_IdMatrix ( eye->matrix );
dpl_Rotate ( eye->matrix, rz, dpl_Z );
dpl_Rotate ( eye->matrix, rx, dpl_X );
dpl_Rotate ( eye->matrix, ry, dpl_Y );
dpl_Translate ( eye->matrix, px, py, pz );
dpl_Flush(eye);
}
/*}}} */
/*{{{ void camera_move_kbd ( VIEW *eye,*/
static float
yaw = 0.0f, pitch = 0.0f, roll = 0.0f,
x_velocity = 0.0f,
y_velocity = 0.0f,
z_velocity = 0.0f,
px = 0.0f, py = 5.0f, pz = 0.0f,
pitch_velocity = 0.0f,
yaw_velocity = 0.0f,
roll_velocity = 0.0f,
dspin = 0.3f, dspeed = 0.3f;
static int
enhanced_key = 0; //Flag: True if next char is enhanced key.
void camera_move_kbd ( dpl_VIEW *eye,
char *spline_file,
dpl_POINT look_at_point,
float scale_fac,
float dt )
{
dpl_POINT vel0, vel1;
/* compute roll, pitch, yaw from keyboard input */
if (kbhit()) {
int ch;
ch = getch();
if (enhanced_key) {
enhanced_key = 0; //False
switch (ch) {
case 'H': // 0,72 'H' up arrow
y_velocity+=dspeed;
break;
case 'P': // 0,80 'P' down arrow
y_velocity-=dspeed;
break;
case 'M': // 0,77 'M' left arrow
x_velocity+=dspeed;
break;
case 'K': // 0,75 'K' right arrow
x_velocity-=dspeed;
break;
}
}
else if (ch == 0) {
enhanced_key = -1; //True
}
else {
switch (ch) {
case '7' : /* roll left */
roll_velocity += dspin;
break;
case '9': /* roll right */
roll_velocity -= dspin;
break;
case '4' : /* swing left weeet chariot */
yaw_velocity+=dspin;
break;
case '6' : /* right */
yaw_velocity-=dspin;
break;
case '8' : /* upp */
pitch_velocity-=dspin;
break;
case '2' : /* downnn */
pitch_velocity+=dspin;
break;
case '5' : /* go faster */
z_velocity+=(dspeed+dspeed);
break;
case '0' : /* decelerate */
z_velocity-=(dspeed+dspeed);
break;
case '-':
pitch = 0.0;
yaw = 0.0;
roll = 0.0;
break;
case ' ' : /* set speed to 0 */
x_velocity=0.0f;
y_velocity=0.0f;
z_velocity=0.0f;
// v--fall through--v //
case '*' :
pitch_velocity = 0.0f;
yaw_velocity = 0.0f;
roll_velocity = 0.0f;
break;
}
}
}
vel0[0]=x_velocity;
vel0[1]=y_velocity;
vel0[2]=-z_velocity;
dpl_IdMatrix ( eye->matrix );
roll += roll_velocity;
pitch += pitch_velocity;
yaw += yaw_velocity;
dpl_Rotate ( eye->matrix, roll, dpl_Z );
dpl_Rotate ( eye->matrix, pitch, dpl_X );
dpl_Rotate ( eye->matrix, yaw, dpl_Y );
_xformpoint ( vel1, vel0, eye->matrix );
px+=vel1[0];
py+=vel1[1];
pz+=vel1[2];
dpl_Translate ( eye->matrix, px, py, pz );
dpl_Flush ( eye );
}
/*}}} */
Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
# ##############################################################
#
# makefile for WATCOM C to generate PC-interface dView example
#
#
BIN=$(WATCOM)\bin
DVINC=..\libdpl
DVLIB=..\libdpl
CFLAGS= -zp4 -ei -7 -dDVIEW=1 -DMS_DOS=1 -i=$(WATCOM)\h;$(DVINC)
.c.obj:
$(BIN)\wcc386 $(CFLAGS) $<
.obj.exe:
$(BIN)b\wcl386 -l=386 $*.obj startdpl.obj kamera.obj spline.obj $(DVLIB)\libdpl.lib
O=.obj
testf15.exe: testf15.obj testf15.c startdpl.obj spline.obj $(DVLIB)\libdpl.lib
spin.exe: spin.obj spin.c spline.obj startdpl.obj $(DVLIB)\libdpl.lib
tanks.exe: tanks.obj tanks.c camera.obj spline.obj startdpl.obj $(DVLIB)\libdpl.lib
tankfog.exe: tankfog.obj tankfog.c camera.obj spline.obj startdpl.obj $(DVLIB)\libdpl.lib
flyk.exe: flyk.obj flyk.c kamera.obj spline.obj startdpl.obj $(DVLIB)\libdpl.lib
test.exe: test.obj test.c $(DVLIB)\libdpl.lib
glomm.exe: glomm.obj glomm.c
$(BIN)b\wcl386 -l=386 $*.obj
+48
View File
@@ -0,0 +1,48 @@
# ##############################################################
#
# makefile for WATCOM C to generate dpl interface
#
#
BIN=$(WATCOM)\bin
CFLAGS= -we -ox -ei -7 -DMS_DOS -i=$(WATCOM)\h;.
.c.obj:
$(BIN)\wcc386 $(CFLAGS) $<
.asm.obj:
386asm -80386P -COMPAT M1 $*.asm
test.obj : test.c dpl.h dpltypes.h
dpl.obj : dpl.c dpl.h dpl_host.h dpltypes.h vr_comms.h
dpl_host.obj : dpl_host.c dpl.h dpl_host.h dpltypes.h vr_comms.h
dpl_load.obj : dpl_load.c dpl.h dpl_host.h dpltypes.h vr_comms.h
vr_comms.obj : vr_comms.c vr_comms.h dpl.h dpl_host.h dpltypes.h
bizread.obj : bizread.c bizread.h dpl_host.h dpltypes.h
matrix.obj : matrix.c matrix.h dpl_host.h dpltypes.h
linkio.obj : linkio.c linkio.h
libdpl.lib: dpl.obj dpl_host.obj dpl_load.obj vr_comms.obj linkio.obj outfast.obj bizread.obj matrix.obj
$(BIN)b\wlib libdpl.lib -+dpl.obj -+dpl_host.obj -+dpl_load.obj -+vr_comms.obj -+linkio.obj -+outfast.obj -+bizread.obj -+matrix.obj
copy libdpl.lib libdpl
copy dpl.h libdpl
copy dpltypes.h libdpl
copy basictyp.h libdpl
test.exe : test.c test.obj libdpl.lib
$(BIN)b\wcl386 -l=386 $*.obj libdpl.lib
testla.exe : testla.c testla.obj vr_comms.c vr_comms.obj dpl_load.obj dpl_host.c dpl_host.obj dpl.c dpl.obj linkio.c linkio.obj outfast.obj
$(BIN)b\wcl386 -l=386 $*.obj dpl_load.obj dpl_host.obj vr_comms.obj dpl.obj linkio.obj outfast.obj
testrand.exe : testrand.c testrand.obj
$(BIN)b\wcl386 -l=386 $*.obj
+26
View File
@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
static int my_malloced=0;
char *my_malloc ( int n )
{
char *c=malloc(n);
if (c) {
my_malloced+=n;
printf ( "malloced %d bytes, total %d\n", n, my_malloced );
}
else {
printf ( "malloced FAILED on %d bytes, total %d\n", n, my_malloced );
}
return c;
}
void my_free ( char *c )
{
free(c);
printf ("free 0x%x\n", c );
}
+61
View File
@@ -0,0 +1,61 @@
Volume in drive U is VOL2
Volume Serial Number is 0900-7C68
Directory of U:\DEMOS\VR\MAZE\SAMPLE16
COLOUR PST 47632 07-24-92 7:19a
FILE PST 72320 07-24-92 7:21a
TWEET PST 52922 03-20-92 10:53p
STOP PST 60000 03-20-92 10:53p
LIGHT PST 40228 03-20-92 10:53p
RESIZE PST 80212 03-20-92 10:53p
FILER PST 62050 03-20-92 10:52p
POP PST 21170 10-31-91 3:43p
WINDOW PST 246962 03-20-92 10:51p
DIRECT PST 63356 03-20-92 10:52p
QUACK PST 37928 03-20-92 10:53p
DOOR PST 133334 03-20-92 10:52p
TOM1 PST 60000 03-20-92 10:51p
PAINT PST 42336 07-24-92 7:18a
GLOBE PST 60416 03-20-92 10:52p
BREATH PST 205504 07-25-92 3:32p
WALK PST 45872 07-24-92 9:23a
WHOOSH PST 52922 03-20-92 10:52p
START PST 88202 03-20-92 10:52p
SURF PST 470992 06-05-92 4:46p
CLANG PST 88202 03-20-92 10:51p
ZZTOP PST 352800 04-25-93 1:36p
RUNNING PST 44102 03-20-92 10:51p
BUFFER PST 66624 03-20-92 10:53p
GUN PST 66668 03-20-92 10:51p
JAWS2 PST 207264 07-25-92 4:32p
TOM2 PST 80000 03-20-92 10:51p
PICK PST 35280 07-11-92 6:16p
BLUEDRM PST 666800 07-23-92 11:33a
BIGRUSH PST 492160 07-23-92 11:41a
BLUES PST 696784 07-23-92 11:54a
TROT PST 74960 07-26-92 3:24p
TRIUMPH PST 335152 07-23-92 12:11p
PICK2 PST 35280 07-24-92 8:34a
BUMPH PST 335152 07-23-92 3:00p
BIGUMPH PST 1229504 07-23-92 3:01p
PING PST 62624 07-23-92 6:30p
PING2 PST 89968 07-23-92 6:34p
FLY PST 51152 07-24-92 7:17a
WORLD PST 97024 07-24-92 7:20a
SCALE PST 70560 07-24-92 7:20a
TRASH PST 51152 07-24-92 7:22a
GALLOP PST 86448 07-26-92 3:25p
SPLASH PST 229328 07-23-92 12:18p
DROP PST 26448 07-11-92 6:14p
SATCH PST 500080 04-25-93 12:58p
MOTOR PST 44096 08-26-92 1:50p
JET PST 17632 08-26-92 1:47p
BEETH6 PST 692368 04-25-93 1:41p
ADD BAT 29 10-29-92 12:03a
RENAULT PST 554784 04-25-93 1:48p
HORN1 PST 70560 04-25-93 1:54p
HORN2 PST 211680 04-25-93 1:55p
HORN3 PST 52912 04-25-93 1:56p
54 file(s) 9659935 bytes
495288320 bytes free
+79
View File
@@ -0,0 +1,79 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*{{{ void copy_image ( int *dest, int *src, in x0, int y0 )*/
void copy_image ( int *dest, int *src, int x0, int y0 )
{
int i, s_index, d_index, j;
d_index=(y0*256)+x0;
s_index=15;
for (j=0; j<64; j++ ) {
for (i=0; i<32; i++) {
int t;
t=src[s_index+i];
if (t==0) {
dest[d_index+i]=0x0;
}
else {
dest[d_index+i]=t | 256;
}
}
d_index+=256;
s_index+=64;
}
}
/*}}} */
/*{{{ int main ( int argc, char **argv )*/
int main ( int argc, char **argv )
{
FILE *s, *d;
char fname[256];
int *dest=malloc(256*256*sizeof(int));
int *src =malloc(64*64*sizeof(int));
int i, j, fix=1, index;
for (j=0; j<4; j++ ) {
for (i=0; i<8; i++) {
int ii, jj;
int *srcp=src;
sprintf ( fname, "t:/usr/phil/f%d.tga", fix );
fix++;
printf ("read file %s\n", fname );
s=fopen( fname, "rb" );
fread ( src, 1, 18, s ); /* throw away tga header */
for (ii=0; ii<64; ii++ ) { /* read tga as 24-bit pixels */
for (jj=0; jj<64; jj++ ) {
char *csrcp=(char *) srcp;
*srcp=0;
fread ( csrcp+1, 1, 1, s );
fread ( csrcp+2, 1, 1, s );
fread ( csrcp+3, 1, 1, s );
srcp++;
}
}
fclose (s);
index=(j*256*64)+(i*32);
printf ("extracting central portion\n" );
copy_image(dest, src, i*32, j*64 );
}
}
strcpy ( fname, "t:/usr/phil/allovem.svt" );
d=fopen( fname, "wb" );
fwrite ( dest, 1, 256*256*4, d );
fclose (d);
}
/*}}} */
+1
View File
@@ -0,0 +1 @@
testf15 400 0
+34
View File
@@ -0,0 +1,34 @@
32
-0.2 0.1 0.0 0.0 0.0 0.0
0.3 -1.4 0.1 2.0 4.0 2.0
0.2 -1.4 0.1 2.0 2.0 3.0
0.3 -1.4 0.1 2.0 4.0 5.0
0.2 0.3 1.7 3.0 2.0 3.0
0.1 0.4 0.1 4.0 2.0 4.0
-0.0 -0.1 -0.6 1.0 -3.0 0.0
-0.0 -0.4 -0.1 1.0 -3.0 1.0
-0.0 -0.3 -0.1 1.0 -3.0 0.0
0.3 1.0 0.1 3.0 -1.0 -5.0
0.1 1.31 1.8 -1.0 3.0 2.0
0.1 1.41 -1.2 -1.0 3.0 4.0
0.3 0.01 1.5 0.0 3.0 0.0
0.0 0.01 0.2 0.0 0.0 360.0
0.1 0.41 -0.2 1.0 0.0 360.0
0.2 -0.21 -0.3 0.0 0.0 360.0
0.1 -0.2 0.25 2.0 2.0 361.0
-0.0 -0.3 -0.4 0.0 -3.0 359.0
0.3 0.2 0.1 2.0 -1.0 360.0
-0.2 0.01 0.2 0.0 0.0 360.0
0.0 0.01 0.2 0.0 0.0 0.0
0.4 0.31 0.0 2.0 0.0 0.0
-0.2 1.8 0.1 2.0 0.0 0.0
0.3 1.8 0.3 1.0 2.0 5.0
-0.2 1.8 0.0 2.0 0.0 0.0
-0.2 1.6 0.0 2.0 0.0 0.0
0.2 1.7 0.2 2.0 0.0 0.0
-0.2 1.8 0.0 2.0 0.0 0.0
0.3 1.6 0.3 1.0 2.0 5.0
0.3 -0.4 0.3 1.0 2.0 0.0

Binary file not shown.
Binary file not shown.
+117
View File
@@ -0,0 +1,117 @@
DIV-VIZ2
HEADER
(
VERSION=2:01;
DATE=28:2:94;
TIME=17:55
)
{
}
TEXTURE(NAME=plant)
{
MAP {"funknoiz.svt"}
MINIFY {POINT_SAMPLED}
MAGNIFY {BILINEAR}
}// End of texture
MATERIAL(NAME=robert)
{
TEXTURE {plant}
AMBIENT {0.39, 0.99, 0.19}
DIFFUSE {0.39, 0.99, 0.19}
}// End of material
OBJECT
(
)
{
PATCH
(
F_MATERIAL=robert;
B_MATERIAL=robert;
VERTEX=RGB 2D_TEXTURE ;
)
{
TRISTRIP {
{-7.35181e-008, -3.02097, -320, 0.31453, 0.262108, 0.131054, 0, 0, 0}
{-6.30152e-008, -2.58939, -318, 0.224363, 0.186969, 0.093484, 1, 0, 0.499975}
{-2, -2.44554, -320, 0.334181, 0.278484, 0.139242, 0, 0.499975, 0}
{-2, -2.02296, -318, 0.277538, 0.231282, 0.115641, 1, 0.499975, 0.499975}
{-4, -2.01396, -320, 0.446312, 0.371927, 0.185963, 0, 0.99995, 0}
{-4, -1.73526, -318, 0.368861, 0.307384, 0.153692, 1, 0.99995, 0.499975}
{-6, -2.31069, -320, 0.312218, 0.260181, 0.130091, -1, 1.49993, 0}
{-6, -1.72626, -318, 0.334181, 0.278484, 0.139242, 1, 1.49993, 0.499975}
{-8, -1.87011, -320, 0.298346, 0.248621, 0.124311, -0.4, 1.9999, 0}
{-8, -1.01598, -318, 0.498331, 0.415276, 0.207638, 1, 1.9999, 0.499975}
{-10, -1.59141, -320, 0.349209, 0.291007, 0.145504, 0, 2.49988, 0}
{-10, -1.00698, -318, 0.500643, 0.417203, 0.208601, 1, 2.49988, 0.499975}
{-12, -1.43856, -320, 0.315686, 0.263072, 0.131536, 0, 2.99985, 0}
{-12, -0.5844, -318, 0.664794, 0.553995, 0.276997, 1, 2.99985, 0.499975}
{-14, -1.29468, -320, 0.520295, 0.433579, 0.21679, -1.1, 3.49983, 0}
{-14, -1.01598, -318, 0.683289, 0.569407, 0.284704, 1, 3.49983, 0.499975}
{-16, -2.16681, -320, 0.478679, 0.3989, 0.19945, -0.4, 3.9998, 0}
{-16, -2.15784, -318, 0.42666, 0.35555, 0.177775, 1, 3.9998, 0.499975}
}
TRISTRIP {
{-6.30152e-008, -2.58939, -318, 0.224363, 0.186969, 0.093484, 1, 0, 0.499975}
{-3.5227e-008, -1.44753, -316, 0.294878, 0.245731, 0.122866, 1, 0, 0.99995}
{-2, -2.02296, -318, 0.277538, 0.231282, 0.115641, 1, 0.499975, 0.499975}
{-2, -1.01598, -316, 0.388512, 0.32376, 0.16188, 1, 0.499975, 0.99995}
{-4, -1.73526, -318, 0.368861, 0.307384, 0.153692, 1, 0.99995, 0.499975}
{-4, -1.15983, -316, 0.46134, 0.38445, 0.192225, 1, 0.99995, 0.99995}
{-6, -1.72626, -318, 0.334181, 0.278484, 0.139242, 1, 1.49993, 0.499975}
{-6, -1.58241, -316, 0.409321, 0.3411, 0.17055, 1, 1.49993, 0.99995}
{-8, -1.01598, -318, 0.498331, 0.415276, 0.207638, 1, 1.9999, 0.499975}
{-8, -1.44753, -316, 0.535323, 0.446102, 0.223051, 1, 1.9999, 0.99995}
{-10, -1.00698, -318, 0.500643, 0.417203, 0.208601, 1, 2.49988, 0.499975}
{-10, -1.87011, -316, 0.519139, 0.432616, 0.216308, 1, 2.49988, 0.99995}
{-12, -0.5844, -318, 0.664794, 0.553995, 0.276997, 1, 2.99985, 0.499975}
{-12, -1.87011, -316, 0.537634, 0.448029, 0.224014, 1, 2.99985, 0.99995}
{-14, -1.01598, -318, 0.683289, 0.569407, 0.284704, 1, 3.49983, 0.499975}
{-14, -1.73526, -316, 0.609306, 0.507755, 0.253878, 1, 3.49983, 0.99995}
{-16, -2.15784, -318, 0.42666, 0.35555, 0.177775, 1, 3.9998, 0.499975}
{-16, -2.15784, -316, 0.444, 0.37, 0.185, 1, 3.9998, 0.99995}
}
TRISTRIP {
{-3.5227e-008, -1.44753, -316, 0.294878, 0.245731, 0.122866, 1, 0, 0.99995}
{-1.75043e-008, -0.71928, -314, 0.315686, 0.263072, 0.131536, 1, 0, 1.49993}
{-2, -1.01598, -316, 0.388512, 0.32376, 0.16188, 1, 0.499975, 0.99995}
{-2, -0.44055, -314, 0.498331, 0.415276, 0.207638, 1, 0.499975, 1.49993}
{-4, -1.15983, -316, 0.46134, 0.38445, 0.192225, 1, 0.99995, 0.99995}
{-4, -0.8721, -314, 0.553819, 0.461516, 0.230758, 1, 0.99995, 1.49993}
{-6, -1.58241, -316, 0.409321, 0.3411, 0.17055, 1, 1.49993, 0.99995}
{-6, -1.44753, -314, 0.516827, 0.430689, 0.215345, 1, 1.49993, 1.49993}
{-8, -1.44753, -316, 0.535323, 0.446102, 0.223051, 1, 1.9999, 0.99995}
{-8, -1.73526, -314, 0.553819, 0.461516, 0.230758, 1, 1.9999, 1.49993}
{-10, -1.87011, -316, 0.519139, 0.432616, 0.216308, 1, 2.49988, 0.99995}
{-10, -2.45454, -314, 0.497176, 0.414313, 0.207156, 1, 2.49988, 1.49993}
{-12, -1.87011, -316, 0.537634, 0.448029, 0.224014, 1, 2.99985, 0.99995}
{-12, -2.73324, -314, 0.482148, 0.40179, 0.200895, 1, 2.99985, 1.49993}
{-14, -1.73526, -316, 0.609306, 0.507755, 0.253878, 1, 3.49983, 0.99995}
{-14, -2.59839, -314, 0.47868, 0.3989, 0.19945, 1, 3.49983, 1.49993}
{-16, -2.15784, -316, 0.444, 0.37, 0.185, 1, 3.9998, 0.99995}
{-16, -2.44554, -314, 0.463652, 0.386376, 0.193188, 1, 3.9998, 1.49993}
}
TRISTRIP {
{-1.75043e-008, -0.71928, -314, 0.315686, 0.263072, 0.131536, 1, 0, 1.49993}
{0, 0, -312, 0.494399, 0.414543, 0.205575, 0, 0, 1.9999}
{-2, -0.44055, -314, 0.498331, 0.415276, 0.207638, 0.6, 0.499975, 1.49993}
{-2, -0.43155, -312, 0.536479, 0.447066, 0.223533, 0, 0.499975, 1.9999}
{-4, -0.8721, -314, 0.553819, 0.461516, 0.230758, 1, 0.99995, 1.49993}
{-4, -1.15083, -312, 0.537635, 0.448029, 0.224014, -0.4, 0.99995, 1.9999}
{-6, -1.44753, -314, 0.516827, 0.430689, 0.215345, 1, 1.49993, 1.49993}
{-6, -1.72626, -312, 0.482148, 0.40179, 0.200895, 0, 1.49993, 1.9999}
{-8, -1.73526, -314, 0.553819, 0.461516, 0.230758, 0.5, 1.9999, 1.49993}
{-8, -1.87011, -312, 0.517983, 0.431652, 0.215826, 0.3, 1.9999, 1.9999}
{-10, -2.45454, -314, 0.497176, 0.414313, 0.207156, 1, 2.49988, 1.49993}
{-10, -2.58939, -312, 0.482147, 0.40179, 0.200895, -0.4, 2.49988, 1.9999}
{-12, -2.73324, -314, 0.482148, 0.40179, 0.200895, 0.2, 2.99985, 1.49993}
{-12, -3.16482, -312, 0.407009, 0.339174, 0.169587, 0, 2.99985, 1.9999}
{-14, -2.59839, -314, 0.47868, 0.3989, 0.19945, 1, 3.49983, 1.49993}
{-14, -3.02097, -312, 0.499487, 0.416239, 0.20812, -0.5, 3.49983, 1.9999}
{-16, -2.44554, -314, 0.463652, 0.386376, 0.193188, 1, 3.9998, 1.49993}
{-16, -3.02097, -312, 0.390825, 0.325687, 0.162844, -1, 3.9998, 1.9999}
}
}// End of patch
}// End of object
View File
+5
View File
@@ -0,0 +1,5 @@
FOG 900.0 12000.0 0.1 0.3 0.2
BACKGND 0.4 0.6 0.8
AMBIENT 0.3 0.6 0.4
LIGHT 0.99 0.82 0.99 30 50 40
STATIC ocean 20.0 0 -190 0 0 0 0
+7
View File
@@ -0,0 +1,7 @@
set dos4g=quiet
set LEFTMAGIC=0x3281
set RIGHTMAGIC=0x3281
set vizpath=..\geometry\
set dviewbin=..\dvwrgbin\
set texture=..\texture\
set transputer=200
+7
View File
@@ -0,0 +1,7 @@
set dos4g=quiet
set LEFTMAGIC=0x3291
set RIGHTMAGIC=0x3291
set vizpath=..\geometry\
set dviewbin=..\dvwrgbin\
set texture=..\texture\
set transputer=200
+7
View File
@@ -0,0 +1,7 @@
set dos4g=quiet
set LEFTMAGIC=0x3209
set RIGHTMAGIC=0x3209
set vizpath=..\geometry\
set dviewbin=..\dvwrgbin\
set texture=..\texture\
set transputer=200
+7
View File
@@ -0,0 +1,7 @@
set dos4g=quiet
set LEFTMAGIC=0x32c1
set RIGHTMAGIC=0x32c1
set vizpath=..\geometry\
set dviewbin=..\dvwrgbin\
set texture=..\texture\
set transputer=200
+18
View File
@@ -0,0 +1,18 @@
FOG 2000.0 12000.0 0.2 0.3 0.5
BACKGND 0.4 0.6 0.8
AMBIENT 0.3 0.6 0.4
LIGHT 0.99 0.82 0.99 60 0 0
STATIC ocean 20.0 0 -190 0 0 0 0
STATIC butter 10.0 -485.0 410.0 -434.0 0 20 0
STATIC golden 10.0 -510.0 420.0 -440.0 0 -70 0
STATIC grouper 10.0 -518.0 400.0 -425.0 0 -10 0
STATIC angel 10.0 -480.0 410.0 -430.0 0 -30 0
STATIC butter 10.0 -460.0 350.0 -434.0 0 -10 0
STATIC golden 10.0 -463.0 361.0 -440.0 0 -15 0
STATIC grouper 10.0 -449.0 370.0 -432.0 0 -20 0
STATIC angel 10.0 -453.0 354.0 -430.0 0 -31 0
STATIC shark 8.0 0 230.0 -200.0 0 0 0
STATIC shark 8.0 280.0 330.0 0 0 20 0
STATIC shark 8.0 -480.0 410.0 -450.0 0 -40 0
STATIC flant 42.0 0 -190 500 0 15 90
+10
View File
@@ -0,0 +1,10 @@
8
0 0.0 200.0 0.0 270.0 0.0
100 0.0 100.0 0.0 180.0 0.0
0 0.0 0.0 0.0 90.0 0.0
-100 0.0 -100.0 0.0 0.0 0.0
0 0.0 -200.0 0.0 90.0 0.0
100 0.0 -100.0 0.0 180.0 0.0
0 0.0 0.0 0.0 270.0 0.0
-100 0.0 100.0 0.0 360.0 0.0
+1
View File
@@ -0,0 +1 @@
flyk sharks.scn
+28
View File
@@ -0,0 +1,28 @@
FOG 2000.0 12000.0 0.2 0.3 0.5
BACKGND 0.4 0.6 0.8
AMBIENT 0.3 0.6 0.4
LIGHT 0.99 0.82 0.99 60 0 0
STATIC ocean 20.0 0 -190 0 0 0 0
STATIC butter 10.0 -485.0 410.0 -434.0 0 20 0
STATIC golden 10.0 -510.0 420.0 -440.0 0 -70 0
STATIC grouper 10.0 -518.0 400.0 -425.0 0 -10 0
STATIC angel 10.0 -480.0 410.0 -430.0 0 -30 0
STATIC butter 10.0 -460.0 350.0 -434.0 0 -10 0
STATIC golden 10.0 -463.0 361.0 -440.0 0 -15 0
STATIC grouper 10.0 -449.0 370.0 -432.0 0 -20 0
STATIC angel 10.0 -453.0 354.0 -430.0 0 -31 0
STATIC shark 8.0 0 230.0 -200.0 0 0 0
STATIC shark 8.0 280.0 330.0 0 0 20 0
STATIC shark 8.0 -480.0 410.0 -450.0 0 -40 0
STATIC plant 30.0 -500 -190 -600 0 -35 90
STATIC plant 32.0 0 -190 -500 0 70 90
STATIC plant 31.0 600 -190 -500 0 20 90
STATIC plant 27.0 -500 -190 0 0 0 90
STATIC plant 33.0 0 -190 0 0 -30 90
STATIC plant 35.0 500 -190 0 0 90 90
STATIC plant 32.0 -500 -190 500 0 0 90
STATIC plant 42.0 0 -190 600 0 15 90
STATIC plant 49.0 600 -190 500 0 80 90
+10
View File
@@ -0,0 +1,10 @@
8
0 0.0 400.0 0.0 0.0 0
200 0.0 200.0 0.0 0.0 0
0 0.0 0.0 0.0 0.0 0
-200 0.0 -200.0 0.0 0.0 0
0 0.0 -400.0 0.0 0.0 0
200 0.0 -200.0 0.0 0.0 0
0 0.0 0.0 0.0 0.0 0
-200 0.0 200.0 0.0 0.0 0
Binary file not shown.
+274
View File
@@ -0,0 +1,274 @@
/*
FILE : testpp5.c
PROJECT : pxpl5 renderer test
Author : Phil Atkin
(C) Division Ltd 1993.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "dpl5.h"
#include "boot.h"
#include "startup.h"
char *progname;
int860 link_A, link_B;
extern int860 __acks_per_frame;
extern int magicLeftVal,
magicRightVal;
/*{{{ void eyeStuff ( VIEW *view )*/
void eyeStuff ( VIEW *view, int left )
{
float scale=1.0;
PAZidMatrix(view->f);
PAZidMatrix(view->b);
if (left) scale *= -1.0f;
PAZtranslatePair (view->f, view->b, scale*1.275, 0, 0 );
PAZrotatePair (view->f, view->b, 180, PAZ_Y );
PAZtranslatePair (view->f, view->b, 0, 0, -48 );
if (left == (-1)) view->shift_x=0.0;
else if (left) view->shift_x=0.2147;
else view->shift_x=-0.2147;
/* view->shift_y = 0.0f; */
PAZwriteView ( view );
}
/*}}} */
/*{{{ void spinning_jenny ( INSTANCE *inst, VIEW *view, char *scale_str )*/
void spinning_jenny ( INSTANCE *inst, VIEW *eye, VIEW *rye, char *scale_str, int base, int times )
{
float theta, scale_fac=0.1;
int i;
float then, now;
if (rye == NULL)
eyeStuff ( eye, -1 );
else {
eyeStuff ( eye, 0 );
eyeStuff ( rye, 1 );
}
sscanf(scale_str, "%f", &scale_fac );
printf ("spinning jenny, scale factor %f\n", scale_fac );
for (i=base; i<times; i++) {
int nulls=0;
theta = (i+40)*0.43;
PAZidMatrix(inst->f);
PAZscale (inst->f, scale_fac, scale_fac, scale_fac, 1 );
PAZrotate (inst->f, theta*2.4, PAZ_X, 1 );
PAZrotate (inst->f, theta*1.3, PAZ_Z, 1 );
PAZrotate (inst->f, theta/2.5, PAZ_Y, 1 );
PAZwriteMatrix ( inst );
PAZrenderScene ();
}
}
/*}}} */
/*{{{ char *makeVizName ( char *name )*/
char vizStr [256];
char *makeVizName ( char *name )
{
char *root;
if ((root=getenv("VIZPATH")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makeTexName ( char *name )*/
char texStr [256];
char *makeTexName ( char *name )
{
char *root;
if ((root=getenv("TEXTURE")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makedplName ( char *name )*/
char *makedplName ( char *dplstr, char *name )
{
char *root;
if ((root=getenv("DVIEWBIN")) == NULL)
return(name);
else {
strcpy ( dplstr, root );
strcat ( dplstr, name );
return ( dplstr );
}
}
/*}}} */
/*{{{ int env2hex ()*/
int env2hex ( char *env_str, int default_v )
{
char *s;
int v;
if (s = getenv(env_str)) {
if (sscanf(s, "%x", &v) == 1) {
return v;
}
}
printf ("Defaulting on %s to 0x%x\n", env_str, default_v );
return default_v;
}
/*}}} */
/*{{{ int nain ( int argc, char *argv[])*/
int nain ( int argc, char *argv[])
{
LIGHTSOURCE *bulb1, *bulb2, *bulb3, *bulb4, *bulb5, *bulb6;
INSTANCE *inst, *kiddy, *kiddy2;
OBJECT *obj;
SCENE *s;
VIEW *eye, *rye;
float t;
char *objname;
int i, made, ramp;
MATERIAL *mtl;
TEXTURE *tex;
s = initialize_all ( 0, -1, &eye, &rye );
printf ( "PAZcreateInstance\n" );
inst = PAZcreateInstance ();
printf ("returned 0x%x\n", inst );
obj=PAZcreateObject ( makeVizName(argv[2]), makeTexName );
inst->obj=obj;
PAZidMatrixPair ( inst->f, inst->b );
inst->enable=1;
PAZwriteInstance ( inst );
printf ( "PAZcreateMaterial\n" );
mtl=PAZcreateMaterial();
{
mtl->kd[0]=0.99;
mtl->kd[1]=0.99;
mtl->kd[2]=0.99;
mtl->ks =0.7;
mtl->power=7.3;
mtl->opacity=1.0f;
mtl->tex=tex;
mtl->ramp_entry=0;
strcpy ( mtl->texture_name, "default" );
strcpy ( mtl->material_name, "viz_0001" );
}
PAZwriteMaterial(mtl);
printf ("returned 0x%x\n", mtl );
/* create 3 light bulbs */
/*
*/
bulb1=PAZcreateLight ();
PAZinitLight ( bulb1, 0, 0.9, 0.2, 0.9, 1, 0, 0 );
PAZwriteLight ( bulb1 );
bulb3=PAZcreateLight ();
PAZinitLight ( bulb3, 0, 0.2, 0.9, 0.9, -1, 0, 0 );
PAZwriteLight ( bulb3 );
bulb2=PAZcreateLight ();
PAZinitLight ( bulb2, 2, 0.4, 0.4, 0.4, -0.577, 0.577, -0.577 );
PAZwriteLight ( bulb2 );
PAZsetBackGND ( 0.5, 0.3, 0.2 );
PAZfog ( 1, 200.0, 4000.0, 0.4f, 0.3f, 0.1f );
while (1) {
inst->f_material=mtl->name;
PAZwriteInstance ( inst );
spinning_jenny ( inst, eye, rye, argv[1], 0, 1000 );
inst->f_material=NULL;
PAZwriteInstance ( inst );
spinning_jenny ( inst, eye, rye, argv[1], 0, 1000 );
}
}
/*}}} */
/*{{{ int main ( int argc, char *argv[] )*/
int main ( int argc, char *argv[] )
{
link_A= 1;
link_B=-1;
progname=argv[0];
if (argc < 3) {
printf ("usage %s: <scale> <v2zfile>\n", argv[0] );
exit(666);
}
else {
char dplStr1 [256];
char dplStr2 [256];
magicLeftVal =env2hex("LEFTMAGIC", 0x3281);
magicRightVal=env2hex("RIGHTMAGIC", 0x3281);
if (magicLeftVal & 0x8) {
x_size=1024;
y_size=768;
}
else if (magicLeftVal & 0x10) {
x_size=640;
y_size=480;
}
else if (magicLeftVal & 0x20) {
x_size=832;
y_size=512;
}
start_dView ( makedplName ( dplStr1, "dv_skip.btl"),
NULL,
makedplName ( dplStr2, "pazpl5.mng"),
env2hex("TRANSPUTER", 0x200), 1, -1 );
nain ( argc, argv );
}
}
/*}}} */
+259
View File
@@ -0,0 +1,259 @@
/*{{{ on cubic splining the cheesey way*/
/*
spline path follower - reads in a set of control points
with x, y, z, rx, ry, rz
computes dx, dy, dz, drx, dry, drz per control point by cheesey
difference - dx(n) = 0.5 * (x(n+1) - x(n-1))
these differences are wrt t, the parametric, not time.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*}}} */
/*{{{ spline types*/
typedef struct s_cntl_point {
int knot_id; /* checking */
float pos[3];
float vel[3];
float ang[3];
float rot[3];
float x_pos_cubic[4];
float y_pos_cubic[4];
float z_pos_cubic[4];
float x_rot_cubic[4];
float y_rot_cubic[4];
float z_rot_cubic[4];
struct s_cntl_point *next;
struct s_cntl_point *prev;
} cntl_point;
/*}}} */
/*{{{ void solve_cubic ( float *coeffs, float v0, float v1, float d0, float d1 )*/
static void solve_cubic ( float *coeffs, float v0, float v1, float d0, float d1 )
{
/*
v = at^3 + bt^2 + ct + d
dv = 3at^2 + 2bt + c
d = v0
a+b+c+d = v1
c = d0
3a + 2b + c = d1
2b + 3a = d1 - d0
a + b = v1 - v0 - d0
3a + 2b - 2a - 2b = d1 - d0 - 2v1 + 2v0 + 2d0
a = d1 - d0 - 2v1 + 2v0 + 2d0
a = d1 + d0 - 2v1 + 2v0
b = v1 - v0 - d0 - a
*/
coeffs[3] = v0;
coeffs[2] = d0;
coeffs[0] = d1 + d0 - (2.0f*v1) + (2.0f*v0);
coeffs[1] = v1 - v0 - d0 - coeffs[0];
}
/*}}} */
/*{{{ static void solve_rot_cubic ( float *coeffs, float v0, float v1, float d0, float d1 )*/
static void solve_rot_cubic ( float *coeffs, float v0, float v1, float d0, float d1 )
{
/*
v = at^3 + bt^2 + ct + d
dv = 3at^2 + 2bt + c
d = v0
a+b+c+d = v1
c = d0
3a + 2b + c = d1
2b + 3a = d1 - d0
a + b = v1 - v0 - d0
3a + 2b - 2a - 2b = d1 - d0 - 2v1 + 2v0 + 2d0
a = d1 - d0 - 2v1 + 2v0 + 2d0
a = d1 + d0 - 2v1 + 2v0
b = v1 - v0 - d0 - a
*/
if (d0>360.0f) d0-=360.0f;
if (d1>360.0f) d1-=360.0f;
coeffs[3] = v0;
coeffs[2] = d0;
coeffs[0] = d1 + d0 - (2.0f*v1) + (2.0f*v0);
coeffs[1] = v1 - v0 - d0 - coeffs[0];
}
/*}}} */
/*{{{ void fill_knot ( cntl_point *knot )*/
static void fill_knot ( cntl_point *knot )
{
cntl_point *next=knot->next;
/*{{{ x*/
solve_cubic ( knot->x_pos_cubic,
knot->pos[0], next->pos[0],
knot->vel[0], next->vel[0] );
/*}}} */
/*{{{ y*/
solve_cubic ( knot->y_pos_cubic,
knot->pos[1], next->pos[1],
knot->vel[1], next->vel[1] );
/*}}} */
/*{{{ z pos*/
solve_cubic ( knot->z_pos_cubic,
knot->pos[2], next->pos[2],
knot->vel[2], next->vel[2] );
/*}}} */
/*{{{ x*/
solve_rot_cubic ( knot->x_rot_cubic,
knot->ang[0], next->ang[0],
knot->rot[0], next->rot[0] );
/*}}} */
/*{{{ y*/
solve_rot_cubic ( knot->y_rot_cubic,
knot->ang[1], next->ang[1],
knot->rot[1], next->rot[1] );
/*}}} */
/*{{{ z rot*/
solve_rot_cubic ( knot->z_rot_cubic,
knot->ang[2], next->ang[2],
knot->rot[2], next->rot[2] );
/*}}} */
}
/*}}} */
/*{{{ void knot_velocity ( cntl_point *prev, cntl_point *this, cntl_point *next )*/
static void knot_velocity ( cntl_point *prev, cntl_point *this, cntl_point *next )
{
int i;
for (i=0; i<3; i++ ) {
float v1, v2, delta;
this->vel[i] = (next->pos[i] - prev->pos[i]) / 2.0f;
v1=this->ang[i];
v2=next->ang[i];
delta=v2-v1;
while (delta>180) delta-=180;
while (delta<-180) delta+=180;
this->rot[i] =delta / 2.0f;
/*
if (v1<0) this->ang[i]+=360.0f;
else
*/
while (this->ang[i]>360.0f) this->ang[i]-=360.0f;
}
}
/*}}} */
/*{{{ float eval ( float *coeffs, float t )*/
float eval ( float *coeffs, float t )
{
/* return a*t^3 + b*t^2 + c*t + d */
return (coeffs[0]*t*t*t) + (coeffs[1]*t*t) + (coeffs[2]*t) + coeffs[3];
}
/*}}} */
/*{{{ cntl_point *walk_spline ( cntl_point *v, float *t, float dt )*/
cntl_point *walk_spline ( cntl_point *v, float *t, float dt )
{
float s=dt + (*t);
int fix=1;
while (fix) {
if (s < 0.0f) {
s+=1.0f;
v=v->prev;
}
else if (s > 1.0f) {
s-=1.0f;
v=v->next;
}
else fix=0;
}
*t=s;
return v;
}
/*}}} */
cntl_point *init_splines ( char *fname )
{
FILE *fp=fopen(fname, "rt");
if (fp==NULL) {
printf ("Failed to open spline file %s\n", fname );
return NULL;
}
else {
int n_pts, i;
cntl_point *knots, *prev=NULL;
/* read in cntl points */
fscanf ( fp, "%d\n", &n_pts );
printf ("%d cntl points\n", n_pts );
knots = (cntl_point *) malloc ( n_pts * sizeof (cntl_point));
printf ("malloced knots\n", n_pts );
for (i=0; i<n_pts; i++ ) {
int n_read=0;
n_read= fscanf ( fp, "%f %f %f",
&knots[i].pos[0],
&knots[i].pos[1],
&knots[i].pos[2] );
n_read+=fscanf ( fp, "%f %f %f\n",
&knots[i].ang[0],
&knots[i].ang[1],
&knots[i].ang[2] );
if (n_read == 6) {
knots[i].knot_id = i;
if (prev) {
prev->next=&knots[i];
knots[i].prev=prev;
}
prev=&knots[i];
}
else {
n_pts=i;
break;
}
}
printf ("closing spline file\n" );
fclose(fp);
knots[0].prev=&knots[n_pts-1];
knots[n_pts-1].next=&knots[0];
printf ("patched up %d knots\n", n_pts );
printf ("approximating velocities\n" );
/* approx velocities */
for (i=0; i<n_pts; i++ )
knot_velocity ( knots[i].prev, &knots[i], knots[i].next );
/* compute cubics */
printf ("computing cubics\n" );
for (i=0; i<n_pts; i++ )
fill_knot ( &knots[i] );
return &knots[0];
}
}
+21
View File
@@ -0,0 +1,21 @@
/*{{{ spline types*/
typedef struct s_cntl_point {
int knot_id; /* checking */
float pos[3];
float vel[3];
float ang[3];
float rot[3];
float x_pos_cubic[4];
float y_pos_cubic[4];
float z_pos_cubic[4];
float x_rot_cubic[4];
float y_rot_cubic[4];
float z_rot_cubic[4];
struct s_cntl_point *next;
struct s_cntl_point *prev;
} cntl_point;
extern float eval ( float *coeffs, float t );
extern cntl_point *walk_spline ( cntl_point *v, float *t, float dt );
extern cntl_point *init_splines ( char *fname );
/*}}} */
Binary file not shown.
+202
View File
@@ -0,0 +1,202 @@
#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;
}
/*}}} */
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
#ifdef startup_h
#else
#define startup_h
extern int x_size, y_size;
extern float near_clip, far_clip;
extern dpl_ZONE *initialize_eyes ( int stereo, dpl_VIEW **eye, dpl_VIEW **rye, float fog );
extern dpl_ZONE *initialize_all ( char *arg, int stereo, dpl_VIEW **eye, dpl_VIEW **rye, float fog );
#endif
+12
View File
@@ -0,0 +1,12 @@
[edit-]
screen=80 50
toggles=1 1 0 1 0 0
srch=
src=
rpl=
file=c:\dpl3\examples\sea.scn 1 1 1 1
[brief]
file=c:\dpl3\examples\sea.scn 1 1 1 1 1 47 78 1 c=0
[shared-]
pmark=c:\dpl3\examples\sea.scn 1 1

+472
View File
@@ -0,0 +1,472 @@
/*
FILE : testpp5.c
PROJECT : pxpl5 renderer test
Author : Phil Atkin
(C) Division Ltd 1993.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "dpl5.h"
#include "boot.h"
#include "startup.h"
#include "camera.h"
char *progname;
int860 link_A, link_B;
extern int860 __acks_per_frame;
extern int magicLeftVal,
magicRightVal;
/*{{{ reproducible random number support*/
/* as always, this is CASIO calculator output */
static float sfx_random_numbers[67] = { 0.990f, 0.196f, 0.030f, 0.452f,
0.165f, 0.663f, 0.737f, 0.774f,
0.996f, 0.269f, 0.676f, 0.786f,
0.123f, 0.474f, 0.755f, 0.919f,
0.873f, 0.603f, 0.628f, 0.045f,
0.089f, 0.509f, 0.413f, 0.416f,
0.304f, 0.011f, 0.083f, 0.110f,
0.177f, 0.602f, 0.810f, 0.181f,
0.723f, 0.394f, 0.035f, 0.873f,
0.678f, 0.331f, 0.407f, 0.499f,
0.132f, 0.210f, 0.081f, 0.550f,
0.344f, 0.894f, 0.469f, 0.307f,
0.641f, 0.936f, 0.779f, 0.833f,
0.373f, 0.915f, 0.972f, 0.887f,
0.019f, 0.613f, 0.540f, 0.898f,
0.755f, 0.689f, 0.076f, 0.173f,
0.870f, 0.825f, 0.364f };
static int sfx_random_ix = 0;
static int sfx_random_base = 0;
static float float_0to1 ()
{
sfx_random_ix++;
if (sfx_random_ix >= 67)
sfx_random_ix=0;
return sfx_random_numbers[sfx_random_ix];
}
/*}}} */
/*{{{ void eyeStuff ( VIEW *view )*/
void eyeStuff ( VIEW *view, int left )
{
float scale=1.0;
PAZidMatrix(view->f);
PAZidMatrix(view->b);
if (left) scale *= -1.0f;
PAZtranslatePair (view->f, view->b, scale*1.275, 0, 0 );
PAZrotatePair (view->f, view->b, 180, PAZ_Y );
PAZtranslatePair (view->f, view->b, 0, 0, -48 );
if (left == (-1)) view->shift_x=0.0;
else if (left) view->shift_x=0.2147;
else view->shift_x=-0.2147;
/* view->shift_y = 0.0f; */
PAZwriteView ( view );
}
/*}}} */
/*{{{ char *makeVizName ( char *name )*/
char vizStr [256];
char *makeVizName ( char *name )
{
char *root;
if ((root=getenv("VIZPATH")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makeTexName ( char *name )*/
char texStr [256];
char *makeTexName ( char *name )
{
char *root;
if ((root=getenv("TEXTURE")) == NULL)
return(name);
else {
strcpy ( texStr, root );
strcat ( texStr, name );
return ( texStr );
}
}
/*}}} */
/*{{{ char *makedplName ( char *name )*/
char *makedplName ( char *dplstr, char *name )
{
char *root;
if ((root=getenv("DVIEWBIN")) == NULL)
return(name);
else {
strcpy ( dplstr, root );
strcat ( dplstr, name );
return ( dplstr );
}
}
/*}}} */
/*{{{ static OBJECT *load_flames( char *fname )*/
static OBJECT *load_flames( char *fname )
{
OBJECT *flame;
FILE *fp=fopen(makeTexName(fname), "rb" );
int texels[32];
int total_texels=0, n_read;
if (fp) {
printf ("load flames\n" );
for (n_read = fread ( texels, 1, 32*4, fp );
n_read;
n_read = fread ( texels, 1, 32*4, fp )) {
PAZfxtexels ( texels, 32 );
total_texels+=32;
}
fclose(fp);
}
printf ( "%d texels read\n", total_texels );
flame=PAZcreateObject ( makeVizName("flame.v2z"), makeTexName );
return flame;
}
/*}}} */
/*{{{ int env2hex ()*/
int env2hex ( char *env_str, int default_v )
{
char *s;
int v;
if (s = getenv(env_str)) {
if (sscanf(s, "%x", &v) == 1) {
return v;
}
}
printf ("Defaulting on %s to 0x%x\n", env_str, default_v );
return default_v;
}
/*}}} */
/*{{{ int nain ( int argc, char *argv[])*/
int nain ( int argc, char *argv[])
{
/*{{{ local variables*/
LIGHTSOURCE *bulb1, *bulb2;
LIGHTSOURCE *fires[2];
INSTANCE *finst[2];
int fireage[2];
int polls=0;
INSTANCE *inst,
*tanks[16];
OBJECT *obj;
OBJECT *flame=NULL, *tank_obj=NULL;
MATERIAL *mtl=NULL;
MATERIAL *temp_mtl=NULL;
TEXTURE *tex=NULL;
TEXTURE *tank_tex=NULL;
SCENE *s;
VIEW *eye, *rye;
float scale_fac, t,
fogr, fogg, fogb;
char *objname;
int frames=0, made, ramp,
blowup =0,
blowup0=0,
blowup1=5;
int i, j;
/*}}} */
s = initialize_all ( 0, -1, &eye, &rye );
sscanf(argv[1], "%f", &scale_fac );
/*{{{ build flames geometry*/
flame=load_flames ( "allovem.svt" );
for (i=0; i<2; i++ ) {
finst[i]=PAZcreateInstance();
finst[i]->obj=flame;
PAZidMatrix ( finst[i]->f );
PAZtranslate ( finst[i]->f, 0, 0.5, 0, 1 );
PAZscale ( finst[i]->f, 80, 80, 80, 1 );
PAZtranslate ( finst[i]->f, 0, 0, -6000, 1 );
PAZinvert ( finst[i]->b, finst[i]->f );
finst[i]->billboard=1;
finst[i]->enable=0;
PAZwriteInstance ( finst[i] );
}
/*}}} */
tank_tex=PAZcreateTexture ( makeTexName ( "tank.svt" ), 0, "tank" );
/*{{{ create the tanks*/
for (i=0; i<4; i++ ) {
for (j=0; j<4; j++ ) {
tanks[blowup] = PAZcreateInstance ();
if (tank_obj==NULL)
tank_obj=PAZcreateObject ( makeVizName ("tank_dea.b2z"), makeTexName );
tanks[blowup]->obj=tank_obj;
PAZidMatrix ( tanks[blowup]->f );
PAZrotate ( tanks[blowup]->f, 36.0f * float_0to1(), 1, 1 );
PAZtranslate ( tanks[blowup]->f, (((float) i) - 1.5f)*530.0f, -40, (j-1)*530.0f, 1 );
PAZinvert ( tanks[blowup]->b, tanks[blowup]->f );
tanks[blowup]->enable=1;
temp_mtl=PAZcreateMaterial();
temp_mtl->kd[0]=0.99f;
temp_mtl->kd[1]=0.99f;
temp_mtl->kd[2]=0.99f;
temp_mtl->ks=0.0f;
temp_mtl->tex=NULL;
PAZwriteMaterial(temp_mtl);
tanks[blowup]->f_material=temp_mtl->name;
tanks[blowup]->f_texture =tank_tex->name;
PAZwriteInstance ( tanks[blowup] );
blowup++;
}
}
/*}}} */
/*{{{ create the floor*/
inst = PAZcreateInstance ();
obj=PAZcreateObject ( makeVizName(argv[2]), makeTexName );
inst->obj=obj;
PAZidMatrixPair ( inst->f, inst->b );
PAZscalePair ( inst->f, inst->b, scale_fac, scale_fac, scale_fac );
PAZtranslatePair ( inst->f, inst->b, 0, -40, 0 );
inst->enable=1;
PAZwriteInstance ( inst );
/*}}} */
/*{{{ create the lights*/
/* create 2 light bulbs, 1 of which ambient */
bulb2=PAZcreateLight ();
PAZinitLight ( bulb2, light_ambient, 0.2, 0.2, 0.3, -0.577, 0.577, -0.577 );
PAZwriteLight ( bulb2 );
bulb1=PAZcreateLight ();
PAZinitLight ( bulb1, light_directional, 0.65, 0.65, 0.43, 1, 1, -1 );
PAZwriteLight ( bulb1 );
/* create the flame light sources */
for (i=0; i<2; i++ ) {
fires[i]=PAZcreateLight ();
PAZinitLight ( fires[i], light_null, 0.99, 0.55, 0.2, -10000, -10000, -10000 );
fires[i]->min_rad=0.0f;
fires[i]->max_rad=0.01f;
PAZwriteLight ( fires[i] );
}
/*}}} */
fireage[0]=100;
fireage[1]=100;
PAZsetBackGND ( 0.2, 0.3, 0.6 );
blowup =0;
blowup0=0;
blowup1=5;
PAZfog ( 1, 7000.0f, 12000.0f, 0.1f, 0.2f, 0.3f );
PAZrenderScene();
while (1) {
frames++;
{
float ff=(float) frames;
ff/=200.0f;
fogr=0.2f+0.3f*(1.0+sin(1.14f*ff));
fogg=0.2f+0.3f*(1.0+sin(1.4f*ff));
fogb=0.2f+0.3f*(1.0+cos(1.734f*ff));
}
camera_move_kbd ( eye, "tankview.spl",
&inst->f[3][0], 1.0f, 0.0057f );
polls=0;
while (PAZpollAck() == 0) {
polls++;
if ((polls & 0xffff) == 0xffff)
printf ("Waited %d times\n", polls );
}
if (polls==0) printf ("Polls 0 frame %d\n", frames );
PAZfog ( 1, 7000.0f, 12000.0f, fogr, fogg, fogb );
PAZrenderScene();
if (frames == 100) {
/*{{{ fire off a new explosion*/
MATRIX m;
frames=0;
i=blowup;
blowup^=1;
PAZidMatrix (m);
if (i==0) {
m[3][0]=tanks[blowup0]->f[3][0];
m[3][1]=tanks[blowup0]->f[3][1];
m[3][2]=tanks[blowup0]->f[3][2];
blowup0++;
blowup0&=15;
}
else {
m[3][0]=tanks[blowup1]->f[3][0];
m[3][1]=tanks[blowup1]->f[3][1];
m[3][2]=tanks[blowup1]->f[3][2];
blowup1++;
blowup1&=15;
}
PAZsfx ( 1, 0.0f, m );
PAZidMatrix ( finst[i]->f );
PAZtranslate ( finst[i]->f, 0, 0.5, 0, 1 );
PAZscale ( finst[i]->f, 80, 80, 80, 1 );
PAZtranslate ( finst[i]->f, m[3][0], m[3][1], m[3][2], 1 );
finst[i]->enable=1;
PAZinvert ( finst[i]->b, finst[i]->f );
PAZwriteInstance ( finst[i] );
fires[i]->position[0]=m[3][0];
fires[i]->position[1]=180.0f + m[3][1];
fires[i]->position[2]=m[3][2];
fires[i]->positional=light_positional;
fires[i]->colour[0]=0.99f;
fires[i]->colour[1]=0.99f;
fires[i]->colour[2]=0.99f;
fires[i]->min_rad=480.0f;
fires[i]->max_rad=1200.0f;
PAZwriteLight ( fires[i] );
/*}}} */
}
else {
/*{{{ step current ones*/
for (i=0; i<2; i++ ) {
if (finst[i]->enable) {
fireage[i]++;
if (fireage[i] > 170) {
fireage[i]=0;
finst[i]->enable=0;
PAZwriteInstance ( finst[i] );
fires[i]->positional=light_null;
fires[i]->min_rad=0.0f;
fires[i]->max_rad=0.01f;
PAZwriteLight ( fires[i] );
}
else {
PAZtranslate ( finst[i]->f, 0, -0.7, 0, 1 );
PAZwriteMatrix ( finst[i] );
fires[i]->position[1]-=0.7f;
fires[i]->min_rad*=0.976;
fires[i]->max_rad*=0.976;
fires[i]->colour[1]*=0.984f;
fires[i]->colour[2]*=0.976f;
PAZwriteLight ( fires[i] );
}
}
}
/*}}} */
}
}
}
/*}}} */
/*{{{ int main ( int argc, char *argv[] )*/
int main ( int argc, char *argv[] )
{
link_A= 1;
link_B=-1;
progname=argv[0];
if (argc < 4) {
printf ("usage %s: <scale> <v2zfile> <texfile>\n", argv[0] );
exit(666);
}
else {
char dplStr1 [256];
char dplStr2 [256];
magicLeftVal =env2hex("LEFTMAGIC", 0x3281);
magicRightVal=env2hex("RIGHTMAGIC", 0x3281);
size_from_magic ( magicLeftVal );
near_clip=12.8;
far_clip =12000.0f;
start_dView ( makedplName ( dplStr1, "pp5mon2.btl"),
NULL,
makedplName ( dplStr2, "pazpl5.mng"),
env2hex("TRANSPUTER", 0x200), 1, -1 );
nain ( argc, argv );
}
}
/*}}} */
+501
View File
@@ -0,0 +1,501 @@
/*
FILE : testpp5.c
PROJECT : pxpl5 renderer test
Author : Phil Atkin
(C) Division Ltd 1993.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "dpl5.h"
#include "boot.h"
#include "startup.h"
#include "camera.h"
char *progname;
int860 link_A, link_B;
extern int860 __acks_per_frame;
extern int magicLeftVal,
magicRightVal;
/*{{{ reproducible random number support*/
/* as always, this is CASIO calculator output */
static float sfx_random_numbers[67] = { 0.990f, 0.196f, 0.030f, 0.452f,
0.165f, 0.663f, 0.737f, 0.774f,
0.996f, 0.269f, 0.676f, 0.786f,
0.123f, 0.474f, 0.755f, 0.919f,
0.873f, 0.603f, 0.628f, 0.045f,
0.089f, 0.509f, 0.413f, 0.416f,
0.304f, 0.011f, 0.083f, 0.110f,
0.177f, 0.602f, 0.810f, 0.181f,
0.723f, 0.394f, 0.035f, 0.873f,
0.678f, 0.331f, 0.407f, 0.499f,
0.132f, 0.210f, 0.081f, 0.550f,
0.344f, 0.894f, 0.469f, 0.307f,
0.641f, 0.936f, 0.779f, 0.833f,
0.373f, 0.915f, 0.972f, 0.887f,
0.019f, 0.613f, 0.540f, 0.898f,
0.755f, 0.689f, 0.076f, 0.173f,
0.870f, 0.825f, 0.364f };
static int sfx_random_ix = 0;
static int sfx_random_base = 0;
static float float_0to1 ()
{
sfx_random_ix++;
if (sfx_random_ix >= 67)
sfx_random_ix=0;
return sfx_random_numbers[sfx_random_ix];
}
/*}}} */
/*{{{ void eyeStuff ( VIEW *view )*/
void eyeStuff ( VIEW *view, int left )
{
float scale=1.0;
PAZidMatrix(view->f);
PAZidMatrix(view->b);
if (left) scale *= -1.0f;
PAZtranslatePair (view->f, view->b, scale*1.275, 0, 0 );
PAZrotatePair (view->f, view->b, 180, PAZ_Y );
PAZtranslatePair (view->f, view->b, 0, 0, -48 );
if (left == (-1)) view->shift_x=0.0;
else if (left) view->shift_x=0.2147;
else view->shift_x=-0.2147;
/* view->shift_y = 0.0f; */
PAZwriteView ( view );
}
/*}}} */
/*{{{ void spinning_jenny ( INSTANCE *inst, VIEW *view, char *scale_str )*/
void spinning_jenny ( INSTANCE *inst, VIEW *eye, VIEW *rye, char *scale_str, int base, int times )
{
float theta, scale_fac=0.1;
int i;
float then, now;
if (rye == NULL)
eyeStuff ( eye, -1 );
else {
eyeStuff ( eye, 0 );
eyeStuff ( rye, 1 );
}
sscanf(scale_str, "%f", &scale_fac );
printf ("spinning jenny, scale factor %f\n", scale_fac );
for (i=base; i<times; i++) {
int nulls=0;
theta = (i+40)*0.43;
PAZidMatrix(inst->f);
PAZidMatrix(inst->b);
PAZscalePair (inst->f, inst->b, scale_fac, scale_fac, scale_fac );
PAZrotatePair(inst->f, inst->b, theta*2.4, PAZ_X );
PAZrotatePair(inst->f, inst->b, theta*1.3, PAZ_Z );
PAZrotatePair(inst->f, inst->b, theta/2.5, PAZ_Y );
PAZwriteInstance ( inst );
PAZrenderScene ();
}
}
/*}}} */
/*{{{ char *makeVizName ( char *name )*/
char vizStr [256];
char *makeVizName ( char *name )
{
char *root;
if ((root=getenv("VIZPATH")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makeTexName ( char *name )*/
char texStr [256];
char *makeTexName ( char *name )
{
char *root;
if ((root=getenv("TEXTURE")) == NULL)
return(name);
else {
strcpy ( texStr, root );
strcat ( texStr, name );
return ( texStr );
}
}
/*}}} */
/*{{{ char *makedplName ( char *name )*/
char *makedplName ( char *dplstr, char *name )
{
char *root;
if ((root=getenv("DVIEWBIN")) == NULL)
return(name);
else {
strcpy ( dplstr, root );
strcat ( dplstr, name );
return ( dplstr );
}
}
/*}}} */
/*{{{ static OBJECT *load_flames( char *fname )*/
static OBJECT *load_flames( char *fname )
{
OBJECT *flame;
FILE *fp=fopen(makeTexName(fname), "rb" );
int texels[32];
int total_texels=0, n_read;
if (fp) {
printf ("load flames\n" );
for (n_read = fread ( texels, 1, 32*4, fp );
n_read;
n_read = fread ( texels, 1, 32*4, fp )) {
PAZfxtexels ( texels, 32 );
total_texels+=32;
}
fclose(fp);
}
printf ( "%d texels read\n", total_texels );
flame=PAZcreateObject ( makeVizName("flame.v2z"), makeTexName );
return flame;
}
/*}}} */
/*{{{ int env2hex ()*/
int env2hex ( char *env_str, int default_v )
{
char *s;
int v;
if (s = getenv(env_str)) {
if (sscanf(s, "%x", &v) == 1) {
return v;
}
}
printf ("Defaulting on %s to 0x%x\n", env_str, default_v );
return default_v;
}
/*}}} */
/*{{{ int nain ( int argc, char *argv[])*/
int nain ( int argc, char *argv[])
{
/*{{{ local variables*/
LIGHTSOURCE *bulb1, *bulb2;
LIGHTSOURCE *fires[2];
INSTANCE *finst[2];
int fireage[2];
int polls=0;
INSTANCE *inst,
*tanks[16];
OBJECT *obj;
OBJECT *flame=NULL, *tank_obj=NULL;
MATERIAL *mtl=NULL;
MATERIAL *temp_mtl=NULL;
TEXTURE *tex=NULL;
TEXTURE *tank_tex=NULL;
SCENE *s;
VIEW *eye, *rye;
float scale_fac, t;
char *objname;
int frames=0, made, ramp,
blowup =0,
blowup0=0,
blowup1=5;
int i, j;
/*}}} */
s = initialize_all ( 0, -1, &eye, &rye );
sscanf(argv[1], "%f", &scale_fac );
/*{{{ build flames geometry*/
flame=load_flames ( "allovem.svt" );
for (i=0; i<2; i++ ) {
finst[i]=PAZcreateInstance();
finst[i]->obj=flame;
PAZidMatrix ( finst[i]->f );
PAZtranslate ( finst[i]->f, 0, 0.5, 0, 1 );
PAZscale ( finst[i]->f, 80, 80, 80, 1 );
PAZtranslate ( finst[i]->f, 0, 0, -6000, 1 );
PAZinvert ( finst[i]->b, finst[i]->f );
finst[i]->billboard=1;
finst[i]->enable=0;
PAZwriteInstance ( finst[i] );
}
/*}}} */
tank_tex=PAZcreateTexture ( makeTexName ( "tank.svt" ), 0, "tank" );
/*{{{ create the tanks*/
for (i=0; i<4; i++ ) {
for (j=0; j<4; j++ ) {
tanks[blowup] = PAZcreateInstance ();
if (tank_obj==NULL)
tank_obj=PAZcreateObject ( makeVizName ("tank_dea.b2z"), makeTexName );
tanks[blowup]->obj=tank_obj;
PAZidMatrix ( tanks[blowup]->f );
PAZrotate ( tanks[blowup]->f, 36.0f * float_0to1(), 1, 1 );
PAZtranslate ( tanks[blowup]->f, (((float) i) - 1.5f)*530.0f, -40, (j-1)*530.0f, 1 );
PAZinvert ( tanks[blowup]->b, tanks[blowup]->f );
tanks[blowup]->enable=1;
temp_mtl=PAZcreateMaterial();
temp_mtl->kd[0]=0.99f;
temp_mtl->kd[1]=0.99f;
temp_mtl->kd[2]=0.99f;
temp_mtl->ks=0.0f;
temp_mtl->tex=NULL;
PAZwriteMaterial(temp_mtl);
tanks[blowup]->f_material=temp_mtl->name;
tanks[blowup]->f_texture =tank_tex->name;
PAZwriteInstance ( tanks[blowup] );
blowup++;
}
}
/*}}} */
/*{{{ create the floor*/
inst = PAZcreateInstance ();
obj=PAZcreateObject ( makeVizName(argv[2]), makeTexName );
inst->obj=obj;
PAZidMatrixPair ( inst->f, inst->b );
PAZscalePair ( inst->f, inst->b, scale_fac, scale_fac, scale_fac );
PAZtranslatePair ( inst->f, inst->b, 0, -40, 0 );
inst->enable=1;
PAZwriteInstance ( inst );
/*}}} */
/*{{{ create the lights*/
/* create 2 light bulbs, 1 of which ambient */
bulb2=PAZcreateLight ();
PAZinitLight ( bulb2, light_ambient, 0.2, 0.2, 0.3, -0.577, 0.577, -0.577 );
PAZwriteLight ( bulb2 );
bulb1=PAZcreateLight ();
PAZinitLight ( bulb1, light_directional, 0.65, 0.65, 0.43, 1, 1, -1 );
PAZwriteLight ( bulb1 );
/* create the flame light sources */
for (i=0; i<2; i++ ) {
fires[i]=PAZcreateLight ();
PAZinitLight ( fires[i], light_null, 0.99, 0.55, 0.2, -10000, -10000, -10000 );
fires[i]->min_rad=0.0f;
fires[i]->max_rad=0.01f;
PAZwriteLight ( fires[i] );
}
/*}}} */
fireage[0]=100;
fireage[1]=100;
PAZsetBackGND ( 0.2, 0.3, 0.6 );
blowup =0;
blowup0=0;
blowup1=5;
PAZfog ( 1, 7000.0f, 12000.0f, 0.1f, 0.2f, 0.3f );
PAZrenderScene();
while (1) {
frames++;
camera_move_kbd ( eye, "tankview.spl",
&inst->f[3][0], 1.0f, 0.0057f );
polls=0;
while (PAZpollAck() == 0) {
polls++;
if ((polls & 0xffff) == 0xffff)
printf ("Waited %d times\n", polls );
}
if (polls==0) printf ("Polls 0 frame %d\n", frames );
PAZrenderScene();
if (frames == 100) {
/*{{{ fire off a new explosion*/
MATRIX m;
frames=0;
i=blowup;
blowup^=1;
PAZidMatrix (m);
if (i==0) {
m[3][0]=tanks[blowup0]->f[3][0];
m[3][1]=tanks[blowup0]->f[3][1];
m[3][2]=tanks[blowup0]->f[3][2];
blowup0++;
blowup0&=15;
}
else {
m[3][0]=tanks[blowup1]->f[3][0];
m[3][1]=tanks[blowup1]->f[3][1];
m[3][2]=tanks[blowup1]->f[3][2];
blowup1++;
blowup1&=15;
}
PAZsfx ( 1, 0.0f, m );
PAZidMatrix ( finst[i]->f );
PAZtranslate ( finst[i]->f, 0, 0.5, 0, 1 );
PAZscale ( finst[i]->f, 80, 80, 80, 1 );
PAZtranslate ( finst[i]->f, m[3][0], m[3][1], m[3][2], 1 );
finst[i]->enable=1;
PAZinvert ( finst[i]->b, finst[i]->f );
PAZwriteInstance ( finst[i] );
fires[i]->position[0]=m[3][0];
fires[i]->position[1]=180.0f + m[3][1];
fires[i]->position[2]=m[3][2];
fires[i]->positional=light_positional;
fires[i]->colour[0]=0.99f;
fires[i]->colour[1]=0.99f;
fires[i]->colour[2]=0.99f;
fires[i]->min_rad=480.0f;
fires[i]->max_rad=1200.0f;
PAZwriteLight ( fires[i] );
/*}}} */
}
else {
/*{{{ step current ones*/
for (i=0; i<2; i++ ) {
if (finst[i]->enable) {
fireage[i]++;
if (fireage[i] > 170) {
fireage[i]=0;
finst[i]->enable=0;
PAZwriteInstance ( finst[i] );
fires[i]->positional=light_null;
fires[i]->min_rad=0.0f;
fires[i]->max_rad=0.01f;
PAZwriteLight ( fires[i] );
}
else {
PAZtranslate ( finst[i]->f, 0, -0.7, 0, 1 );
PAZwriteMatrix ( finst[i] );
fires[i]->position[1]-=0.7f;
fires[i]->min_rad*=0.976;
fires[i]->max_rad*=0.976;
fires[i]->colour[1]*=0.984f;
fires[i]->colour[2]*=0.976f;
PAZwriteLight ( fires[i] );
}
}
}
/*}}} */
}
}
}
/*}}} */
/*{{{ int main ( int argc, char *argv[] )*/
int main ( int argc, char *argv[] )
{
link_A= 1;
link_B=-1;
progname=argv[0];
if (argc < 4) {
printf ("usage %s: <scale> <v2zfile> <texfile>\n", argv[0] );
exit(666);
}
else {
char dplStr1 [256];
char dplStr2 [256];
magicLeftVal =env2hex("LEFTMAGIC", 0x3281);
magicRightVal=env2hex("RIGHTMAGIC", 0x3281);
size_from_magic ( magicLeftVal );
near_clip=12.8;
far_clip =12000.0f;
start_dView ( makedplName ( dplStr1, "pp5mon2.btl"),
NULL,
makedplName ( dplStr2, "pazpl5.mng"),
env2hex("TRANSPUTER", 0x200), 1, -1 );
nain ( argc, argv );
}
}
/*}}} */
+5
View File
@@ -0,0 +1,5 @@
4
-550 148 0 0 0 0
-0 58 550 0 0 0
550 228 0 0 0 0
0 52 -550 0 0 0
+406
View File
@@ -0,0 +1,406 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <dpl.h>
#include "matrix.h"
#include <math.h>
char *dpl_arg;
/*{{{ 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, -140.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" );
*/
dpl_LoadObject ( obj=dpl_NewObject(), "little" );
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, 5.0f, 5.0f, 5.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;
frig->texture->u0=0;
frig->texture->v0=0;
frig->texture->dv=0;
frig->texture->du=0.43;
dpl_Flush(frig);
dpl_Flush(frig->texture);
dpl_SetInstanceFrontMaterial ( ins, frig );
dpl_SetInstanceBackMaterial ( ins, frig );
/*
*/
{
float alpha=0.0f;
float alphacycle=0;
int angle=0, clampcycle=0;
while (1) {
float f;
dpl_MATRIX m;
angle++;
f=sin(alphacycle/22.0f);
if (f > 0.99f) {
f=1.0f;
clampcycle++;
if (clampcycle==20) {
alphacycle+=1.0f;
clampcycle=0;
}
}
else
alphacycle+=1.0f;
alpha=0.5f + 0.505f * f;
if (alpha < 0.0f)
alpha=0.0f;
else if (alpha > 1.0f)
alpha=1.0f;
dpl_SetMaterialOpacity ( frig, alpha, alpha, alpha );
dpl_IdMatrix ( m );
dpl_Translate ( m, -cx, -cy, -cz );
dpl_Rotate ( m, angle*0.30f, dpl_Y );
dpl_Rotate ( m, angle*0.437f, dpl_X );
dpl_Rotate ( m, angle*0.1739f, 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 )
{
dpl_PATHITEM *gpathitem, *tpathitem;
dpl_EXTNITEM *gextnitem, *textnitem;
dpl_FILEPATH *gpath, *tpath;
dpl_arg=getenv("dplarg");
printf ("test is go\n" );
dpl_SetWarningLevel(0);
dpl_Init ( dpl_arg );
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 );
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;
}
/*}}} */
Binary file not shown.
Binary file not shown.
+573
View File
@@ -0,0 +1,573 @@
/*
FILE : testf15.c
PROJECT : pxpl5 renderer example - F15 squadron
Author : Phil Atkin
(C) Division Ltd 1994.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "dpl5.h"
#include "boot.h"
#include "startup.h"
#include "spline.h"
#include "camera.h"
char *progname;
int860 link_A, link_B;
extern int magicLeftVal,
magicRightVal;
/*{{{ void eyeStuff ( VIEW *view )*/
void eyeStuff ( VIEW *view, int left )
{
float scale=1.0;
PAZidMatrix(view->f);
PAZidMatrix(view->b);
if (left) scale *= -1.0f;
if (left != (-1))
PAZtranslatePair (view->f, view->b, scale*1.275, 0, 0 );
PAZrotatePair (view->f, view->b, 180, PAZ_Y );
PAZtranslatePair (view->f, view->b, 0, 0, -102 );
if (left == (-1)) view->shift_x=0.0;
else if (left) view->shift_x=0.2147;
else view->shift_x=-0.2147;
/* view->shift_y = 0.0f; */
PAZwriteView ( view );
}
/*}}} */
#define MAX_PLANES 5
static int planes_inited=0;
static int camera_inited=0;
cntl_point *splinehead=NULL;
static float flight_t;
static MATRIX flight_m;
typedef struct s_plane {
cntl_point *cntl;
float t;
MATRIX orig;
} plane_cntl_type;
plane_cntl_type plane_cntl[16];
static void check_matrix ( MATRIX m, char *s )
{
MATRIX tmp;
MATRIX res;
float hyp;
int i, j;
PAZinvert ( tmp, m );
PAZconcat ( res, m, tmp, 1 );
for (i=0; i<4; i++ ) {
for (j=0; j<4; j++ ) {
float t=res[i][j];
hyp+=t*t;
}
}
if ((hyp < 3.99f) || (hyp > 4.01f)) {
printf("MATRIX %s >>>>>\n", s );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", m[0][0], m[0][1], m[0][2], m[0][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", m[1][0], m[1][1], m[1][2], m[1][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", m[2][0], m[2][1], m[2][2], m[2][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", m[3][0], m[3][1], m[3][2], m[3][3] );
printf("concat with inverse %s >>>>>\n", s );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", res[0][0], res[0][1], res[0][2], res[0][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", res[1][0], res[1][1], res[1][2], res[1][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", res[2][0], res[2][1], res[2][2], res[2][3] );
printf ( " [ %3.3f, %3.3f, %3.3f, %3.3f ]\n", res[3][0], res[3][1], res[3][2], res[3][3] );
}
}
static float atan2deg ( float dz, float dx )
{
float angle;
if ((dx*dx) < 0.0001f) {
angle=(dz>0) ? 90.0f : -90.0f;
return angle;
}
else {
return (180.0f / 3.1415926535f) * atan2 ( dz, dx );
/*
if (dx>0)
return angle;
else
return 180.0f + angle;
*/
}
}
static void xformpoint ( POINT q, POINT p, MATRIX m )
{
POINT r;
int i;
for (i=0; i<4; i++ ) {
r[i]=(p[0]*m[0][i])+
(p[1]*m[1][i])+
(p[2]*m[2][i])+
(p[3]*m[3][i]);
}
memcpy ( q, r, sizeof(POINT));
}
void look_at ( VIEW *v, float *from, float *at, float z_spin )
{
/* construct a view from 2 points */
float dx, dy, dz;
float px, py, pz;
float thetax, thetay, thetaz;
float yaw, roll;
MATRIX m;
POINT p, q;
/* put 'at' at origin, construct a vector from 'from' */
px=from[0]; py=from[1]; pz=from[2];
dx=at[0]-px;
dy=at[1]-py;
dz=at[2]-pz;
thetaz=0.0f;
thetay=0.0f;
thetax=0.0f;
p[0]=dx;
p[1]=dy;
p[2]=dz;
p[3]=1;
yaw=-atan2deg ( dz, dx );
PAZidMatrix ( m );
PAZrotate ( m, -yaw, PAZ_Y, 1 );
xformpoint ( q, p, m );
roll=atan2deg(q[1], q[0] );
/* project onto x-z plane, assuming camera is initially looking down -z */
PAZidMatrix ( v->f );
/* apply angles to matrix */
PAZrotate ( v->f, z_spin, PAZ_Z, 1 );
PAZrotate ( v->f, roll, PAZ_X, 1 );
PAZrotate ( v->f, yaw-90.0f, PAZ_Y, 1 );
PAZtranslate( v->f, px, py, pz, 1 );
}
float evalx, evaly, evalz;
float tx, ty, tz, theta=0, dtheta=0, flight_r;
static float camera_t=0.0f;
static cntl_point *camerahead=NULL;
void cameradicking ( VIEW *eye,
INSTANCE *look_at_me,
float scale_fac,
float dt )
{
cntl_point *p=camerahead;
float t=camera_t;
float px, py, pz, rx, ry, rz;
POINT evalp;
if (camera_inited == 0) {
camera_inited=1;
p=init_splines("camera.spl");
t=0;
}
px=eval(p->x_pos_cubic, t );
py=eval(p->y_pos_cubic, t );
pz=eval(p->z_pos_cubic, t );
rx=eval(p->x_rot_cubic, t );
ry=eval(p->y_rot_cubic, t );
rz=eval(p->z_rot_cubic, t );
camerahead=walk_spline ( p, &t, dt );
camera_t=t;
/* we have wobbled the spline according to the file - now build the
view matrix */
eye->f[3][0]=px+look_at_me->f[3][0];
eye->f[3][1]=py+look_at_me->f[3][1];
eye->f[3][2]=pz+look_at_me->f[3][2];
evalp[0]=evalx;
evalp[1]=evaly;
evalp[2]=evalz;
/*
look_at ( eye, &eye->f[3][0], &look_at_me->f[3][0], rz );
*/
look_at ( eye, &eye->f[3][0], evalp, rz );
PAZwriteViewMatrix ( eye );
/* check_matrix ( eye->f, "view" ); */
}
void planedicking ( INSTANCE *inst, int planeId,
float scale, float dt, float dplane )
{
float px, py, pz, rx, ry, rz;
cntl_point *p;
float t;
int i;
MATRIX camera_target;
if (planes_inited == 0) {
planes_inited=1;
splinehead=init_splines("planes.spl");
for (i=1; i<MAX_PLANES; i++) {
float angle;
float fi=(float) i;
angle=fi * (3.1415926f * 2.0f) / (MAX_PLANES-1);
plane_cntl[i].cntl=splinehead;
plane_cntl[i].t=fi * dplane;
PAZidMatrix ( plane_cntl[i].orig );
PAZtranslate ( plane_cntl[i].orig,
10.3f*cos(angle), 0, 11.7f*sin(angle), 1 );
}
PAZidMatrix ( plane_cntl[0].orig );
plane_cntl[0].cntl=splinehead;
plane_cntl[0].t=dplane;
}
p=plane_cntl[planeId].cntl;
t=plane_cntl[planeId].t;
PAZidMatrix ( inst->f );
px=eval(p->x_pos_cubic, t );
py=eval(p->y_pos_cubic, t );
pz=eval(p->z_pos_cubic, t );
rx=eval(p->x_rot_cubic, t );
ry=eval(p->y_rot_cubic, t );
rz=eval(p->z_rot_cubic, t );
plane_cntl[planeId].cntl=walk_spline ( p, &plane_cntl[planeId].t, dt );
PAZscale ( inst->f, scale, scale, scale, 1 );
if (planeId == 0) {
PAZidMatrix ( camera_target );
PAZscale ( camera_target, scale, scale, scale, 1 );
}
/* the above scale should have brought us up to 1.0 ish in plane space */
/* now apply the spline */
PAZtranslate ( inst->f, px, py, pz, 1 );
PAZrotate ( inst->f, rz, PAZ_Z, 1 );
PAZrotate ( inst->f, rx, PAZ_X, 1 );
PAZrotate ( inst->f, ry, PAZ_Y, 1 );
PAZconcat ( inst->f, inst->f, plane_cntl[planeId].orig, 1 );
if (planeId==0) {
float rad=theta*3.1415926535f/180.0f;
theta+=dtheta;
tx=flight_r*cos(rad);
tz=flight_r*sin(rad);
}
PAZrotate ( inst->f, 180.0f-theta, PAZ_Y, 1 );
PAZtranslate ( inst->f, tx, 0, tz, 1 );
PAZscale ( inst->f, 6, 6, 6, 1 );
if (planeId == 0) {
PAZconcat ( camera_target, camera_target, plane_cntl[planeId].orig, 1 );
PAZrotate ( camera_target, 180.0f-theta, PAZ_Y, 1 );
PAZtranslate ( camera_target, tx, 0, tz, 1 );
PAZscale ( camera_target, 6, 6, 6, 1 );
evalx=camera_target[3][0];
evaly=camera_target[3][1];
evalz=camera_target[3][2];
}
}
void squadron_antics ( INSTANCE **planes, VIEW *eye, VIEW *rye, float scale_fac, int base, int times )
{
float theta;
int i, j;
float then, now;
if (rye == NULL)
eyeStuff ( eye, -1 );
else {
eyeStuff ( eye, 0 );
eyeStuff ( rye, 1 );
}
flight_r=26000;
dtheta=0.13;
for (i=base; i<times; i++) {
int nulls=0;
for (j=0; j<MAX_PLANES; j++) {
planedicking ( planes[j], j,
scale_fac, (j/392.0f)+0.034f, (j/283.0f)+0.007f );
PAZwriteMatrix ( planes[j] );
}
cameradicking(eye, planes[0], scale_fac, 0.02f );
PAZrenderScene();
}
}
/*{{{ char *makeVizName ( char *name )*/
char vizStr [256];
char *makeVizName ( char *name )
{
char *root;
if ((root=getenv("VIZPATH")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makeTexName ( char *name )*/
char texStr [256];
char *makeTexName ( char *name )
{
char *root;
if ((root=getenv("TEXTURE")) == NULL)
return(name);
else {
strcpy ( vizStr, root );
strcat ( vizStr, name );
if (strchr(vizStr, '.')==NULL) {
strcat(vizStr, ".svt");
}
return ( vizStr );
}
}
/*}}} */
/*{{{ char *makedplName ( char *name )*/
char *makedplName ( char *dplstr, char *name )
{
char *root;
if ((root=getenv("DVIEWBIN")) == NULL)
return(name);
else {
strcpy ( dplstr, root );
strcat ( dplstr, name );
return ( dplstr );
}
}
/*}}} */
/*{{{ int env2hex ()*/
int env2hex ( char *env_str, int default_v )
{
char *s;
int v;
if (s = getenv(env_str)) {
if (sscanf(s, "%x", &v) == 1) {
return v;
}
}
printf ("Defaulting on %s to 0x%x\n", env_str, default_v );
return default_v;
}
/*}}} */
/*{{{ static OBJECT *load_flames( char *fname )*/
static OBJECT *load_flames( char *fname )
{
OBJECT *flame;
FILE *fp=fopen(makeTexName(fname), "rb" );
int texels[32];
int total_texels=0, n_read;
if (fp) {
printf ("load flames\n" );
for (n_read=fread ( texels, 1, 32*4, fp ); n_read; n_read=fread(texels,1,32*4,fp )) {
PAZfxtexels ( texels, 32 );
total_texels+=32;
}
fclose(fp);
}
printf ( "%d texels read\n", total_texels );
flame=PAZcreateObject ( makeVizName("flame.v2z"), makeTexName );
return flame;
}
/*}}} */
/*{{{ int nain ( int argc, char *argv[])*/
int nain ( int argc, char *argv[])
{
LIGHTSOURCE *bulb1, *bulb2, *bulb3, *bulb4, *bulb5, *bulb6;
INSTANCE *planes[MAX_PLANES];
INSTANCE *groundinst[25];
OBJECT *obj;
OBJECT *groundobj[25];
SCENE *s;
VIEW *eye, *rye;
OBJECT *F15, *F16, *flames;
float t, scale_fac=0.1;
char *objname;
int g, i, j, made, ramp;
s = initialize_all ( 0, -1, &eye, &rye );
sscanf(argv[1], "%f", &scale_fac );
PAZfog ( 1, 15000.0f, 26244.0f, 0.4, 0.5, 0.6 );
flames=load_flames("allovem.svt");
printf ("Making hills\n" );
g=0;
for (i=0; i<5; i++) {
for (j=0; j<5; j++) {
INSTANCE *terrinst;
OBJECT *terrobj;
char hilly[256];
sprintf(hilly, "terr%1d%1d.b2z", i*2, j*2 );
terrobj=PAZcreateObject(makeVizName(hilly), makeTexName);
terrinst=PAZcreateInstance();
terrinst->enable=1;
terrinst->obj=terrobj;
PAZwriteInstance ( terrinst );
PAZscale ( terrinst->f,
10*scale_fac, 0.41*scale_fac, 10*scale_fac, 1 );
PAZtranslate ( terrinst->f, 10.0, -14*scale_fac, 10.0, 1 );
PAZwriteMatrix ( terrinst );
groundobj[g]=terrobj;
groundinst[g]=terrinst;
g++;
}
}
printf ("Made hills\n" );
printf ("Making sky\n" );
{
OBJECT *skyobj;
INSTANCE *skyinst;
skyobj=PAZcreateObject(makeVizName("mtl_frig.v2z"), makeTexName);
skyinst=PAZcreateInstance();
skyinst->obj=skyobj;
skyinst->enable=1;
PAZscalePair ( skyinst->f, skyinst->b,
50*scale_fac, 50*scale_fac, 50*scale_fac );
PAZtranslatePair ( skyinst->f, skyinst->b, 0, 8*scale_fac, 0 );
PAZwriteInstance ( skyinst );
}
F15=PAZcreateObject ( makeVizName("F15.v2z"), makeTexName );
F16=PAZcreateObject ( makeVizName("F16.v2z"), makeTexName );
for (i=0; i< MAX_PLANES; i++) {
INSTANCE *p=(planes[i]=PAZcreateInstance());
if ((i&1) ==0)
p->obj=F15;
else
p->obj=F16;
p->enable=1;
PAZidMatrixPair ( p->f, p->b );
PAZwriteInstance ( p );
}
/* create 3 light bulbs */
bulb1=PAZcreateLight ();
PAZinitLight ( bulb1, light_directional, 0.99, 0.99, 0.79, 0, 1, 0 );
PAZwriteLight ( bulb1 );
bulb2=PAZcreateLight ();
PAZinitLight ( bulb2, light_ambient, 0.2, 0.3, 0.4, 0, 0, 0 );
PAZwriteLight ( bulb2 );
PAZsetBackGND ( 0.2, 0.3, 0.6 );
while (1) {
squadron_antics ( planes, eye, rye, scale_fac, 0, 1000 );
}
}
/*}}} */
/*{{{ int main ( int argc, char *argv[] )*/
int main ( int argc, char *argv[] )
{
link_A= 1;
link_B=-1;
progname=argv[0];
if (argc < 3) {
printf ("usage %s: <scale> <v2zfile>\n", argv[0] );
exit(666);
}
else {
char dplStr1 [256];
char dplStr2 [256];
magicLeftVal =env2hex("LEFTMAGIC", 0x3201);
magicRightVal=env2hex("RIGHTMAGIC", 0x3201);
near_clip=25.6/2;
far_clip =52428.8/2;
size_from_magic ( magicLeftVal );
start_dView ( makedplName ( dplStr1, "pp5mon2.btl"),
NULL,
makedplName ( dplStr2, "pazpl5.mng"),
env2hex("TRANSPUTER", 0x150), 1, -1 );
nain ( argc, argv );
}
}
/*}}} */
+1
View File
@@ -0,0 +1 @@
set DPLARG=/tranny~..\vrendmon.btl~/i860~..\vrend.mng~/link_A~3~/link_B~-1~/device~0x150~/video~svga~/n_860s~1
+6
View File
@@ -0,0 +1,6 @@
FOG 900.0 12000.0 0.1 0.3 0.2
BACKGND 0.4 0.6 0.8
AMBIENT 0.3 0.6 0.4
LIGHT 0.99 0.82 0.99 30 50 40
STATIC ocean 20.0 0 -190 0 0 0 0
STATIC little 20.0 0.0 0.0 0.0 0 20 0
BIN
View File
Binary file not shown.
+51
View File
@@ -0,0 +1,51 @@
Phar Lap Macro Assembler Version 4.1 Fri Jul 22 12:43:04 1994
Page 1-1
; outsw.asm - just does an outsw with W
atcom register conventions
;
assume cs:_text
00000000 _text segment para public use32 'code
'
public _outsw_
00000000 _outsw_ proc
; eax = address,
; edx = port (useful!)
; ebx = count
00000000 8B F0 mov esi,eax
00000002 8B CB mov ecx,ebx
00000004 F3/ 66| 6F rep outsw
00000007 C3 ret ; retu
rn to caller
_outsw_ endp
00000008 _text ends
end _outsw_
Phar Lap Macro Assembler Version 4.1 Fri Jul 22 12:43:04 1994
Symbols-1
GROUPS AND SEGMENTS
Name Size Use Align Combine Class
_text . . . . . . . . . . . . . 00000008 USE32 PARA PUBLIC code
PROCEDURES
Name Type Offset Scope Segment
_outsw_ . . . . . . . . . . . . N PROC 00000000 Public _text
2 Symbols
0 Warning Errors
0 Severe Errors
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
Module: farhello.asm
MAIN MODULE
Starting Address: _OUTSW_
Segment: _TEXT PARA USE32 00000009 bytes
0000 cb _OUTSW_ retf
0001 8b f0 mov esi,eax
0003 8b cb mov ecx,ebx
0005 f3 66 6f repe outsw
0008 cb retf
No disassembly errors
------------------------------------------------------------
+14
View File
@@ -0,0 +1,14 @@
f dpltypes.h
f dpl.c
f dpl.h
f dpl_host.c
f dpl_host.h
f dpl_load.c
f dpl_load.h
f vr_comms.c
f vr_comms.h
f bizread.c
f makefile
cmake test.exe > dump
f dump
+27
View File
@@ -0,0 +1,27 @@
goto total.c (Editing* C)
goto fold.stp (Editing* Default)
command "fold.cmd"
foldmark "Occam" "--" ""
foldmark "C" "/*" "*/"
foldmark "Pascal" "(*" "*)"
foldmark "Iterm" "#" ""
foldmark "Latex" "%%" ""
foldmark "Asm" ";" ""
foldmark "As860" "\\" ""
foldmark "C++" "//" ""
#{{{ 0 Macro key to type "--" at the beginning of a line
209 45 45 202
#}}}
#{{{ 1 Macro key to say Hello World
72 101 108 108 111 32 87 111 114 108 100
#}}}
#{{{ 3 Macro key to duplicate a fold marker
221 212 211 222 209 246 249 202 211 209 205
#}}}
#{{{ 8 Macro key to search
224
#}}}
#{{{ 9 Macro key to replace
225
#}}}
+69
View File
@@ -0,0 +1,69 @@
Module: outfast.asm
Segment: _TEXT PARA USE32 000000a1 bytes
0000 51 OUTVERYFAST_ push ecx
0001 56 push esi
0002 fc cld
0003 8b f0 mov esi,eax
0005 8b cb mov ecx,ebx
0007 66 83 c2 03 add dx,0003H
000b 33 db L1 xor ebx,ebx
000d ec L2 in al,dx
000e 24 01 and al,01H
0010 0f 84 12 00 00 00 je L3
0016 66 83 f2 02 xor dx,0002H
001a 6e outsb
001b 66 83 f2 02 xor dx,0002H
001f e2 ea loop L1
0021 66 b8 01 00 mov ax,0001H
0025 5e pop esi
0026 59 pop ecx
0027 c3 ret
0028 43 L3 inc ebx
0029 81 f3 00 e8 03 00 xor ebx,0003e800H
002f 75 dc jne L2
0031 66 b8 00 00 mov ax,0000H
0035 5e pop esi
0036 59 pop ecx
0037 c3 ret
0038 56 OUTSW_ push esi
0039 83 c1 03 add ecx,00000003H
003c 83 e1 fc and ecx,0fffffffcH
003f d1 e9 shr ecx,1
0041 8b f3 mov esi,ebx
0043 66 83 f2 04 xor dx,0004H
0047 f3 66 6f repe outsw
004a 66 83 f2 07 xor dx,0007H
004e 8b c8 mov ecx,eax
0050 e8 1f 00 00 00 call L4
0055 c1 e9 08 shr ecx,08H
0058 e8 17 00 00 00 call L4
005d c1 e9 08 shr ecx,08H
0060 e8 0f 00 00 00 call L4
0065 c1 e9 08 shr ecx,08H
0068 e8 07 00 00 00 call L4
006d 5e pop esi
006e b8 01 00 00 00 mov eax,00000001H
0073 c3 ret
0074 33 db L4 xor ebx,ebx
0076 ec L5 in al,dx
0077 24 01 and al,01H
0079 0f 85 0e 00 00 00 jne L6
007f 43 inc ebx
0080 81 f3 00 e8 03 00 xor ebx,0003e800H
0086 75 ee jne L5
0088 e9 0c 00 00 00 jmp L7
008d 8b c1 L6 mov eax,ecx
008f 66 83 f2 02 xor dx,0002H
0093 ee out dx,al
0094 66 83 f2 02 xor dx,0002H
0098 c3 ret
0099 5e L7 pop esi
009a 5e pop esi
009b b8 00 00 00 00 mov eax,00000000H
00a0 c3 ret
No disassembly errors
------------------------------------------------------------
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
#include <stdio.h>
#include <math.h>
int main ( int argc, char **argv )
{
float k, scale=1.0f, gamma=1.7f;
int i, o;
printf ( "int gamma_2point2[256] = \n {");
for (i=0; i<256; i++ ) {
k = scale * (1023.0 / pow(255.0,1.0/gamma));
o = (int) (k * (pow((float)i,1.0/gamma)));
printf (" %d", o );
if (i==255)
printf ( " };\n");
else if ((i&7)==7)
printf(",\n ");
else
printf (",");
}
return 1;
}

Some files were not shown because too many files have changed in this diff Show More