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>
62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include "dpltypes.h"
|
|
#include "matrix.h"
|
|
|
|
float billboard_rotY=0.0f;
|
|
|
|
/*{{{ 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 );
|
|
}
|
|
}
|
|
/*}}} */
|
|
|
|
void billboardize ( dpl_MATRIX front, dpl_MATRIX back )
|
|
{
|
|
float dx, dy, dz;
|
|
|
|
dx=front[3][0];
|
|
dy=front[3][1];
|
|
dz=front[3][2];
|
|
|
|
dpl_Translate ( front, -dx, -dy, -dz );
|
|
dpl_Rotate ( front, billboard_rotY, dpl_Y );
|
|
dpl_Translate ( front, dx, dy, dz );
|
|
if (back) dpl_Invert ( back, front );
|
|
|
|
return;
|
|
}
|
|
|
|
void billboardstuff ( dpl_MATRIX m )
|
|
{
|
|
/* pass 0,0,-1 thru view matrix to find Y angle */
|
|
dpl_POINT a, b;
|
|
|
|
if (m) {
|
|
a[0]= 0;
|
|
a[1]= 0;
|
|
a[2]= 0;
|
|
|
|
dpl_XformPoint ( a, a, m );
|
|
|
|
b[0]= 0;
|
|
b[1]= 0;
|
|
b[2]=-1;
|
|
|
|
dpl_XformPoint ( b, b, m );
|
|
|
|
billboard_rotY=90.0f - _atan2deg (b[2]-a[2], b[0]-a[0]);
|
|
}
|
|
}
|
|
|
|
|