当前位置: 首页>>代码示例>>C#>>正文


C# IntPtr.NumberOfSegments方法代码示例

本文整理汇总了C#中IntPtr.NumberOfSegments方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.NumberOfSegments方法的具体用法?C# IntPtr.NumberOfSegments怎么用?C# IntPtr.NumberOfSegments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IntPtr的用法示例。


在下文中一共展示了IntPtr.NumberOfSegments方法的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;
 }
开发者ID:ThomasKerman,项目名称:Principia,代码行数:42,代码来源:ksp_plugin_adapter.cs


注:本文中的IntPtr.NumberOfSegments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。