Skip to content

Commit bbf923d

Browse files
committed
iv update
1 parent 04be683 commit bbf923d

File tree

9 files changed

+2528
-2071
lines changed

9 files changed

+2528
-2071
lines changed

data/2DFXDataGrabber/iv_data.7z

373 KB
Binary file not shown.

data/2DFXDataGrabber/lcs_data.7z

332 KB
Binary file not shown.

data/2DFXDataGrabber/vcs_data.7z

204 KB
Binary file not shown.

data/IVLodLights/IVLodLights.dat

Lines changed: 2145 additions & 1949 deletions
Large diffs are not rendered by default.

includes/CLODLightManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ void CLODLightManager::LoadDatFile()
7575
float fOffsetX, fOffsetY, fOffsetZ;
7676
unsigned int nRed, nGreen, nBlue, nAlpha;
7777
float fCustomSize = 1.0f;
78+
float fDrawDistance = 0.0f;
7879
int nNoDistance = 0;
7980
int nDrawSearchlight = 0;
8081
int nCoronaShowMode = 0;
81-
sscanf(pLine, "%d %d %d %d %f %f %f %f %d %d %d", &nRed, &nGreen, &nBlue, &nAlpha, &fOffsetX, &fOffsetY, &fOffsetZ, &fCustomSize, &nCoronaShowMode, &nNoDistance, &nDrawSearchlight);
82-
pFileContent->insert(std::make_pair(PackKey(nModel, nCurIndexForModel++), CLamppostInfo(CVector(fOffsetX, fOffsetY, fOffsetZ), CRGBA(static_cast<unsigned char>(nRed), static_cast<unsigned char>(nGreen), static_cast<unsigned char>(nBlue), static_cast<unsigned char>(nAlpha)), fCustomSize, nCoronaShowMode, nNoDistance, nDrawSearchlight, 0.0f)));
82+
if (sscanf(pLine, "%3d %3d %3d %3d %f %f %f %f %f %2d %1d %1d", &nRed, &nGreen, &nBlue, &nAlpha, &fOffsetX, &fOffsetY, &fOffsetZ, &fCustomSize, &fDrawDistance, &nCoronaShowMode, &nNoDistance, &nDrawSearchlight) != 12)
83+
sscanf(pLine, "%3d %3d %3d %3d %f %f %f %f %2d %1d %1d", &nRed, &nGreen, &nBlue, &nAlpha, &fOffsetX, &fOffsetY, &fOffsetZ, &fCustomSize, &nCoronaShowMode, &nNoDistance, &nDrawSearchlight);
84+
pFileContent->insert(std::make_pair(PackKey(nModel, nCurIndexForModel++), CLamppostInfo(CVector(fOffsetX, fOffsetY, fOffsetZ), CRGBA(static_cast<unsigned char>(nRed), static_cast<unsigned char>(nGreen), static_cast<unsigned char>(nBlue), static_cast<unsigned char>(nAlpha)), fCustomSize, nCoronaShowMode, nNoDistance, nDrawSearchlight, 0.0f, fDrawDistance)));
8385
}
8486
}
8587
}

includes/CLODLightManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ class CLamppostInfo
2323
int nDrawSearchlight;
2424
float fHeading;
2525
int nCoronaShowMode;
26+
float fObjectDrawDistance;
2627

27-
CLamppostInfo(const CVector& pos, const CRGBA& col, float fCustomMult, int CoronaShowMode, int nNoDistance, int nDrawSearchlight, float heading)
28-
: vecPos(pos), colour(col), fCustomSizeMult(fCustomMult), nCoronaShowMode(CoronaShowMode), nNoDistance(nNoDistance), nDrawSearchlight(nDrawSearchlight), fHeading(heading)
28+
CLamppostInfo(const CVector& pos, const CRGBA& col, float fCustomMult, int CoronaShowMode, int nNoDistance, int nDrawSearchlight, float heading, float ObjectDrawDistance = 0.0f)
29+
: vecPos(pos), colour(col), fCustomSizeMult(fCustomMult), nCoronaShowMode(CoronaShowMode), nNoDistance(nNoDistance), nDrawSearchlight(nDrawSearchlight), fHeading(heading), fObjectDrawDistance(ObjectDrawDistance)
2930
{}
3031
};
3132

includes/Maths.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef __MATHS__H
22
#define __MATHS__H
33

4+
#define _USE_MATH_DEFINES
45
#include <math.h>
56
#include "rwsdk\rwcore.h"
67

78
#define RAD_TO_DEG (180.0/M_PI)
89
#define DEG_TO_RAD (M_PI/180.0)
10+
#define RADTODEG(x) ((x) * 180.0f / M_PI)
911

1012
class CVector
1113
{
@@ -502,4 +504,40 @@ inline CVector& CVector::FromMultiply3X3(const CMatrix& mat, const CVector& vec)
502504
return *this = Multiply3x3(mat, vec);
503505
}
504506

507+
static CMatrix identMat = {
508+
{ 1.0f, 0.0f, 0.0f },
509+
{ 0.0f, 1.0f, 0.0f },
510+
{ 0.0f, 0.0f, 1.0f },
511+
{ 0.0f, 0.0f, 0.0f },
512+
};
513+
514+
inline RwV3d makeV3d(float x, float y, float z) { RwV3d v = { x, y, z }; return v; }
515+
inline float dot(const RwV3d& a, const RwV3d& b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
516+
inline RwV3d scale(const RwV3d& a, float r) { return makeV3d(a.x * r, a.y * r, a.z * r); }
517+
inline void makeRotation(CMatrix* dst, const RwV3d* axis, float angle, const RwV3d* translation)
518+
{
519+
float len = dot(*axis, *axis);
520+
if (len != 0.0f) len = 1.0f / sqrtf(len);
521+
RwV3d v = scale(*axis, len);
522+
angle = angle * (float)M_PI / 180.0f;
523+
float s = sinf(angle);
524+
float c = cosf(angle);
525+
float t = 1.0f - c;
526+
527+
*dst = identMat;
528+
dst->matrix.pos = *translation;
529+
dst->matrix.right.x = c + v.x * v.x * t;
530+
dst->matrix.right.y = v.x * v.y * t + v.z * s;
531+
dst->matrix.right.z = v.z * v.x * t - v.y * s;
532+
dst->matrix.up.x = v.x * v.y * t - v.z * s;
533+
dst->matrix.up.y = c + v.y * v.y * t;
534+
dst->matrix.up.z = v.y * v.z * t + v.x * s;
535+
dst->matrix.at.x = v.z * v.x * t + v.y * s;
536+
dst->matrix.at.y = v.y * v.z * t - v.x * s;
537+
dst->matrix.at.z = c + v.z * v.z * t;
538+
//dst->matrix.pos.x = 0.0;
539+
//dst->matrix.pos.y = 0.0;
540+
//dst->matrix.pos.z = 0.0;
541+
}
542+
505543
#endif

0 commit comments

Comments
 (0)