protected virtual void _CollectMesh(Matrix4 transMat, int w, int h, RenderType rt, List <IPosLight> lights, AddPixelHandler handler) { Camera camera = Camera.Default; if (null == camera) { return; } Vertex vertex1, vertex2; Vertex2D point1, point2; int pointCount = _pointList.Count - 1; for (int i = 0; i < pointCount; ++i) { vertex1 = _pointList[i]; vertex2 = _pointList[i + 1]; // 将3d坐标投影到2d空间; point1 = GraphPragma.BuildVertex2D(vertex1, transMat, camera.Pos, lights, w, h); point2 = GraphPragma.BuildVertex2D(vertex2, transMat, camera.Pos, lights, w, h); // 计算线段; Line.DrawLine(point1, point2, handler, DrawLineType.Bresenham, SoftDevice.Default.ZTest); } vertex1 = _pointList[_pointList.Count - 1]; vertex2 = _pointList[0]; point1 = GraphPragma.BuildVertex2D(vertex1, transMat, camera.Pos, lights, w, h); point2 = GraphPragma.BuildVertex2D(vertex2, transMat, camera.Pos, lights, w, h); Line.DrawLine(point1, point2, handler, DrawLineType.Bresenham, SoftDevice.Default.ZTest); }
protected override void _CollectMesh(Matrix4 transMat, int w, int h, RenderType rt, List <IPosLight> lights, AddPixelHandler handler) { if (_pointList.Count % 2 != 0) { return; } Camera camera = Camera.Default; if (null == camera) { return; } int pointCount = _pointList.Count - 1; for (int i = 0; i < pointCount; i += 2) { Vertex v0 = _pointList[i]; Vertex v1 = _pointList[i + 1]; Vertex2D p0 = GraphPragma.BuildVertex2D(v0, transMat, camera.Pos, lights, w, h); Vertex2D p1 = GraphPragma.BuildVertex2D(v1, transMat, camera.Pos, lights, w, h); Line.DrawLine(p0, p1, handler, DrawLineType.Bresenham, SoftDevice.Default.ZTest); } }