本文整理汇总了C#中IntPtr.FetchAndIncrement方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.FetchAndIncrement方法的具体用法?C# IntPtr.FetchAndIncrement怎么用?C# IntPtr.FetchAndIncrement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntPtr
的用法示例。
在下文中一共展示了IntPtr.FetchAndIncrement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderAndDeleteTrajectory
private void RenderAndDeleteTrajectory(ref IntPtr trajectory_iterator,
VectorLine vector_line)
{
int new_min_draw_index = 0;
try {
XYZSegment segment;
int index_in_line_points = vector_line.points3.Length -
2 * trajectory_iterator.NumberOfSegments();
// If the |VectorLine| is too big, make sure we're not keeping garbage.
for (int i = vector_line.minDrawIndex; i < index_in_line_points; ++i) {
vector_line.points3[i] = UnityEngine.Vector3.zero;
}
while (index_in_line_points < 0) {
trajectory_iterator.FetchAndIncrement();
index_in_line_points += 2;
}
new_min_draw_index = index_in_line_points;
vector_line.minDrawIndex = Math.Min(vector_line.minDrawIndex,
new_min_draw_index);
while (!trajectory_iterator.AtEnd()) {
segment = trajectory_iterator.FetchAndIncrement();
// TODO(egg): should we do the |LocalToScaledSpace| conversion in
// native code?
// TODO(egg): could we directly assign to
// |vector_line.points3| from C++ using unsafe code and
// something like the following?
// |fixed (UnityEngine.Vector3* pts = vector_line.points3)|
vector_line.points3[index_in_line_points++] =
ScaledSpace.LocalToScaledSpace((Vector3d)segment.begin);
vector_line.points3[index_in_line_points++] =
ScaledSpace.LocalToScaledSpace((Vector3d)segment.end);
}
} finally {
Interface.DeleteLineAndIterator(ref trajectory_iterator);
}
if (MapView.Draw3DLines && !force_2d_trajectories_) {
Vector.DrawLine3D(vector_line);
} else {
Vector.DrawLine(vector_line);
}
vector_line.minDrawIndex = new_min_draw_index;
}