JD2022-TU1/main/extern/Camcam/LIBS/Trackeur/ShotInterface.cpp

64 lines
1.1 KiB
C++

#include "track.h"
#include "ShotTracker.h"
//float SHOTS_FOCALE = 1.7f;
SHOTS_CLASS *MS = 0;
void FindHotSpot(MAP *pSrc,float Focale)
{
if (!MS) return;
if (!MS->THIS_IS_USED)
{
if (MS->MapCal) CC_free(MS->MapCal);
CC_free(MS);
MS = NULL;
return;
}
MS->SHOTS_FOCALE = Focale;
MS->THIS_IS_USED--;
MS->MainCall(pSrc);
}
u32 SHOT_GetMatrix(u32 id , MATRIX *pDest)
{
if (!MS)
{
MS = (SHOTS_CLASS*)CC_malloc(sizeof(SHOTS_CLASS));
memset(MS,0,sizeof(SHOTS_CLASS));
}
MS->THIS_IS_USED = 20;
pDest->Identity();
if ((id<1<<RAW_CODEBITNUM))
{
#ifndef NOTRANCKING
MS->TrackedCodeRequested[id>>5] |= 1<<(id&31);
#endif
if (MS->TrackedGrav[id].Validated)
{
*pDest = MS->TrackedGrav[id].MatrixSmoothed;
return 1;
}
}
return 0;
}
float SHOT_GetError(u32 id )
{
if (!MS)
{
MS = (SHOTS_CLASS*)CC_malloc(sizeof(SHOTS_CLASS));
memset(MS,0,sizeof(SHOTS_CLASS));
}
MS->THIS_IS_USED = 20;
if ((id<1<<RAW_CODEBITNUM))
{
#ifndef NOTRANCKING
MS->TrackedCodeRequested[id>>5] |= 1<<(id&31);
#endif
return (MS->TrackedGrav[id].ContourError);
}
return 0;
}