Allow binary orbits without text source

Closes: #1088
pull/1096/head
Hleb Valoshka 2021-06-23 22:30:50 +04:00
parent 03388d6d1d
commit d394192999
5 changed files with 39 additions and 5 deletions

View File

@ -83,6 +83,21 @@ Orbit* TrajectoryInfo::load(const fs::path& filename)
break;
}
}
else if (filetype == Content_CelestiaXYZVBinary)
{
switch (precision)
{
case TrajectoryPrecisionSingle:
sampTrajectory = LoadXYZVBinarySinglePrec(strippedFilename, interpolation);
break;
case TrajectoryPrecisionDouble:
sampTrajectory = LoadXYZVBinaryDoublePrec(strippedFilename, interpolation);
break;
default:
assert(0);
break;
}
}
else
{
switch (precision)

View File

@ -934,3 +934,18 @@ Orbit* LoadXYZVTrajectoryDoublePrec(const fs::path& filename, TrajectoryInterpol
return LoadSampledOrbitXYZV(filename, interpolation, 0.0);
}
/*! Load a binary trajectory file with single precision positions and velocities.
*/
Orbit* LoadXYZVBinarySinglePrec(const fs::path& filename, TrajectoryInterpolation interpolation)
{
return LoadSampledOrbitXYZVBinary(filename, interpolation, 0.0f);
}
/*! Load a trajectory file with double precision positions and velocities.
*/
Orbit* LoadXYZVBinaryDoublePrec(const fs::path& filename, TrajectoryInterpolation interpolation)
{
return LoadSampledOrbitXYZVBinary(filename, interpolation, 0.0);
}

View File

@ -29,5 +29,6 @@ extern Orbit* LoadSampledTrajectoryDoublePrec(const fs::path& filename, Trajecto
extern Orbit* LoadSampledTrajectorySinglePrec(const fs::path& filename, TrajectoryInterpolation interpolation);
extern Orbit* LoadXYZVTrajectoryDoublePrec(const fs::path& filename, TrajectoryInterpolation interpolation);
extern Orbit* LoadXYZVTrajectorySinglePrec(const fs::path& filename, TrajectoryInterpolation interpolation);
extern Orbit* LoadXYZVBinarySinglePrec(const fs::path& filename, TrajectoryInterpolation interpolation);
extern Orbit* LoadXYZVBinaryDoublePrec(const fs::path& filename, TrajectoryInterpolation interpolation);
#endif // _CELENGINE_SAMPORBIT_H_

View File

@ -35,7 +35,8 @@ static const char CelestiaModelExt[] = ".cmod";
static const char CelestiaParticleSystemExt[] = ".cpart";
static const char CelestiaXYZTrajectoryExt[] = ".xyz";
static const char CelestiaXYZVTrajectoryExt[] = ".xyzv";
static const char Content_WarpMeshExt[] = ".map";
static const char ContentXYZVBinaryExt[] = ".xyzvbin";
static const char ContentWarpMeshExt[] = ".map";
ContentType DetermineFileType(const fs::path& filename)
{
@ -82,8 +83,9 @@ ContentType DetermineFileType(const fs::path& filename)
return Content_CelestiaXYZTrajectory;
if (compareIgnoringCase(CelestiaXYZVTrajectoryExt, ext) == 0)
return Content_CelestiaXYZVTrajectory;
if (compareIgnoringCase(Content_WarpMeshExt, ext) == 0)
if (compareIgnoringCase(ContentWarpMeshExt, ext) == 0)
return Content_WarpMesh;
else
return Content_Unknown;
if (compareIgnoringCase(ContentXYZVBinaryExt, ext) == 0)
return Content_CelestiaXYZVBinary;
return Content_Unknown;
}

View File

@ -36,6 +36,7 @@ enum ContentType
Content_CelestiaXYZVTrajectory = 19,
Content_CelestiaParticleSystem = 20,
Content_WarpMesh = 21,
Content_CelestiaXYZVBinary = 22,
Content_Unknown = -1,
};