Files
OpenAssetTools/src/ObjWriting/Dumping/SndCurve/SndCurveDumper.cpp
2022-01-22 14:16:25 +01:00

45 lines
938 B
C++

#include "SndCurveDumper.h"
#include <cassert>
#include <iomanip>
SndCurveDumper::SndCurveDumper(std::ostream& stream)
: SndCurveDumper(stream, DEFAULT_PRECISION)
{
}
SndCurveDumper::SndCurveDumper(std::ostream& stream, const size_t precision)
: AbstractTextDumper(stream),
m_precision(precision),
m_current_knot(0u),
m_total_knots(0u)
{
}
void SndCurveDumper::Init(const size_t totalKnots)
{
m_total_knots = totalKnots;
m_current_knot = 0;
m_stream << "SNDCURVE\n\n";
m_stream << totalKnots;
}
void SndCurveDumper::WriteKnot(const float x, const float y)
{
assert(m_current_knot < m_total_knots);
m_stream << "\n" << std::fixed << std::setprecision(m_precision) << x << " " << y;
m_current_knot++;
}
void SndCurveDumper::WriteKnot(const double x, const double y)
{
assert(m_current_knot < m_total_knots);
m_stream << x << " " << y << "\n";
m_current_knot++;
}