本文整理汇总了C++中MoveSpline::_Spline方法的典型用法代码示例。如果您正苦于以下问题:C++ MoveSpline::_Spline方法的具体用法?C++ MoveSpline::_Spline怎么用?C++ MoveSpline::_Spline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveSpline
的用法示例。
在下文中一共展示了MoveSpline::_Spline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteCatmullRomPath
void PacketBuilder::WriteCatmullRomPath(const MoveSpline& move_spline, ByteBuffer& data)
{
const Spline<int32> spline = move_spline._Spline();
uint32 count = spline.getPointCount() - 3;
data << count;
for (uint32 i = 0; i < count; ++i)
data << CalcTransportOffset(move_spline, spline.getPoint(2 + i));
}
示例2: WriteCatmullRomCyclicPath
void PacketBuilder::WriteCatmullRomCyclicPath(const MoveSpline& move_spline, ByteBuffer& data)
{
const Spline<int32> spline = move_spline._Spline();
uint32 count = spline.getPointCount() - 3;
data << uint32(count + 1);
data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
for (uint32 i = 0; i < count; ++i)
data << CalcTransportOffset(move_spline, spline.getPoint(1 + i));
}
示例3: WriteLinearPath
void PacketBuilder::WriteLinearPath(const MoveSpline& move_spline, ByteBuffer& data)
{
const Spline<int32> spline = move_spline._Spline();
uint32 last_idx = spline.getPointCount() - 3;
const Vector3 * real_path = &spline.getPoint(1);
data << last_idx;
data << CalcTransportOffset(move_spline, real_path[last_idx]); // destination
if (last_idx > 1)
{
Vector3 middle = (CalcTransportOffset(move_spline, real_path[0]) + CalcTransportOffset(move_spline, real_path[last_idx])) / 2.f;
Vector3 offset;
// first and last points already appended
for (uint32 i = 1; i < last_idx; ++i)
{
offset = CalcTransportOffset(move_spline, middle) - CalcTransportOffset(move_spline, real_path[i]);
data.appendPackXYZ(offset.x, offset.y, offset.z);
}
}
}