本文整理汇总了C#中IVertexSource类的典型用法代码示例。如果您正苦于以下问题:C# IVertexSource类的具体用法?C# IVertexSource怎么用?C# IVertexSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVertexSource类属于命名空间,在下文中一共展示了IVertexSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VertexSourceAdapter
public VertexSourceAdapter(IVertexSource vertexSource, IGenerator generator)
{
markers = new null_markers();
this.VertexSource = vertexSource;
this.generator = generator;
m_status = status.initial;
}
示例2: TriangulateFaces
public static Mesh TriangulateFaces(IVertexSource vertexSource)
{
vertexSource.rewind();
CachedTesselator teselatedSource = new CachedTesselator();
VertexSourceToTesselator.SendShapeToTesselator(teselatedSource, vertexSource);
Mesh extrudedVertexSource = new Mesh();
int numIndicies = teselatedSource.IndicesCache.Count;
// build the top first so it will render first when we are translucent
for (int i = 0; i < numIndicies; i += 3)
{
Vector2 v0 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 0].Index].Position;
Vector2 v1 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 1].Index].Position;
Vector2 v2 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 2].Index].Position;
if (v0 == v1 || v1 == v2 || v2 == v0)
{
continue;
}
Vertex topVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, 0));
Vertex topVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, 0));
Vertex topVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, 0));
extrudedVertexSource.CreateFace(new Vertex[] { topVertex0, topVertex1, topVertex2 });
}
return extrudedVertexSource;
}
示例3: ConverterAdaptorVcgen
///<summary>
///</summary>
///<param name="source"></param>
///<param name="generator"></param>
public ConverterAdaptorVcgen(IVertexSource source, IGenerator generator)
{
_markers = new NullMarkers();
_source = source;
_generator = generator;
_status = EStatus.Initial;
}
示例4: Save
public static void Save(IVertexSource vertexSource, string pathAndFileName, bool oldStyle = true)
{
if (oldStyle)
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
vertexSource.rewind(0);
double x;
double y;
ShapePath.FlagsAndCommand flagsAndCommand = vertexSource.vertex(out x, out y);
do
{
outFile.WriteLine("{0}, {1}, {2}", x, y, flagsAndCommand.ToString());
flagsAndCommand = vertexSource.vertex(out x, out y);
}
while (flagsAndCommand != ShapePath.FlagsAndCommand.CommandStop);
}
}
else
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
foreach (VertexData vertexData in vertexSource.Vertices())
{
outFile.WriteLine("{0}, {1}, {2}", vertexData.position.x, vertexData.position.y, vertexData.command.ToString());
}
}
}
}
示例5: ConvAdaptorVcgen
public ConvAdaptorVcgen(IVertexSource source, IGenerator generator)
{
this.markers = null;
// TODO NullMarkers();
this.source = source;
this.generator = generator;
this.status = Status.Initial;
}
示例6: CurveConverter
public CurveConverter(IVertexSource source)
{
m_curve3 = new Curve3();
m_curve4 = new Curve4();
m_source=(source);
m_last_x=(0.0);
m_last_y=(0.0);
}
示例7: FlattenCurves
public FlattenCurves(IVertexSource vertexSource)
{
m_curve3 = new Curve3();
m_curve4 = new Curve4();
VertexSource = vertexSource;
lastX = (0.0);
lastY = (0.0);
}
示例8: CheckTestAgainstControl
private void CheckTestAgainstControl(IVertexSource testVertexSource, string testTypeString)
{
// there is an assumtion that we got to save valid vertex lists at least once.
string controlFileTxt = testTypeString + " Control.Txt";
string vertexSourceFolder = "ControlVertexSources";
PathStorage controlVertexSource = new PathStorage();
if (!Directory.Exists(vertexSourceFolder))
{
Directory.CreateDirectory(vertexSourceFolder);
}
string controlPathAndFileName = Path.Combine(vertexSourceFolder, controlFileTxt);
if (File.Exists(controlPathAndFileName))
{
VertexSourceIO.Load(controlVertexSource, controlPathAndFileName);
// this test the old vertex getting code
{
string testOldToOldFailPathAndFileName = Path.Combine(vertexSourceFolder, testTypeString + " Test Old Fail.Txt");
bool testOldToOldIsSameAsControl = controlVertexSource.Equals(testVertexSource, oldStyle: true);
if (!testOldToOldIsSameAsControl)
{
// this VertexSource will be in the current output folder inside of VertexSourceFolder
VertexSourceIO.Save(testVertexSource, testOldToOldFailPathAndFileName, oldStyle: true);
}
else if (File.Exists(testOldToOldFailPathAndFileName))
{
// we don't want to have these confounding our results.
File.Delete(testOldToOldFailPathAndFileName);
}
Assert.IsTrue(testOldToOldIsSameAsControl);
}
// this test the new vertex generator code
if (true)
{
string testOldToNewFailPathAndFileName = Path.Combine(vertexSourceFolder, testTypeString + " Test New Fail.Txt");
bool testOldToNewIsSameAsControl = controlVertexSource.Equals(testVertexSource, oldStyle: false);
if (!testOldToNewIsSameAsControl)
{
// this VertexSource will be in the current output folder inside of VertexSourceFolder
VertexSourceIO.Save(testVertexSource, testOldToNewFailPathAndFileName, oldStyle: false);
}
else if (File.Exists(testOldToNewFailPathAndFileName))
{
// we don't want to have these confounding our results.
File.Delete(testOldToNewFailPathAndFileName);
}
Assert.IsTrue(testOldToNewIsSameAsControl);
}
// If you want to create new control VertexSources select SetNextStatement to inside the else condition to creat them.
}
else
{
VertexSourceIO.Save(testVertexSource, controlPathAndFileName);
}
}
示例9: bounding_rect_single
public static bool bounding_rect_single(IVertexSource vs, int path_id, ref RectangleDouble rect)
{
double x1, y1, x2, y2;
bool rValue = bounding_rect_single(vs, path_id, out x1, out y1, out x2, out y2);
rect.Left = x1;
rect.Bottom = y1;
rect.Right = x2;
rect.Top = y2;
return rValue;
}
示例10: BoundingRectSingle
public static bool BoundingRectSingle(IVertexSource vs, uint path_id, ref RectD rect)
{
double x1, y1, x2, y2;
bool rValue = BoundingRectSingle(vs, path_id, out x1, out y1, out x2, out y2);
rect.x1 = x1;
rect.y1 = y1;
rect.x2 = x2;
rect.y2 = y2;
return rValue;
}
示例11: Render
public override void Render(IVertexSource vertexSource, int pathIndexToRender, RGBA_Bytes colorBytes)
{
m_Rasterizer.reset();
Affine transform = GetTransform();
if (!transform.IsIdentity())
{
vertexSource = new conv_transform(vertexSource, transform);
}
m_Rasterizer.add_path(vertexSource, pathIndexToRender);
Renderer.RenderSolid(m_DestImage, m_Rasterizer, m_ScanlineCache, colorBytes);
}
示例12: RenderSolidAllPaths
public void RenderSolidAllPaths(IImageByte destImage,
IRasterizer ras,
IScanlineCache sl,
IVertexSource vs,
RGBA_Bytes[] color_storage,
int[] path_id,
int num_paths)
{
for (int i = 0; i < num_paths; i++)
{
ras.reset();
ras.add_path(vs, path_id[i]);
RenderSolid(destImage, ras, sl, color_storage[i]);
}
}
示例13: SendShapeToTesselator
public static void SendShapeToTesselator(VertexTesselatorAbstract tesselator, IVertexSource vertexSource)
{
#if !DEBUG
try
#endif
{
tesselator.BeginPolygon();
ShapePath.FlagsAndCommand PathAndFlags = 0;
double x, y;
bool haveBegunContour = false;
while (!ShapePath.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
{
if (ShapePath.is_close(PathAndFlags)
|| (haveBegunContour && ShapePath.is_move_to(PathAndFlags)))
{
tesselator.EndContour();
haveBegunContour = false;
}
if (!ShapePath.is_close(PathAndFlags))
{
if (!haveBegunContour)
{
tesselator.BeginContour();
haveBegunContour = true;
}
tesselator.AddVertex(x, y);
}
}
if (haveBegunContour)
{
tesselator.EndContour();
}
tesselator.EndPolygon();
}
#if !DEBUG
catch
{
}
#endif
}
示例14: CombinePaths
private PathStorage CombinePaths(IVertexSource a, IVertexSource b, ClipType clipType)
{
List<List<IntPoint>> aPolys = VertexSourceToClipperPolygons.CreatePolygons(a);
List<List<IntPoint>> bPolys = VertexSourceToClipperPolygons.CreatePolygons(b);
Clipper clipper = new Clipper();
clipper.AddPaths(aPolys, PolyType.ptSubject, true);
clipper.AddPaths(bPolys, PolyType.ptClip, true);
List<List<IntPoint>> intersectedPolys = new List<List<IntPoint>>();
clipper.Execute(clipType, intersectedPolys);
PathStorage output = VertexSourceToClipperPolygons.CreatePathStorage(intersectedPolys);
output.Add(0, 0, ShapePath.FlagsAndCommand.CommandStop);
return output;
}
示例15: Render
public override void Render(IVertexSource vertexSource, int pathIndexToRender, IColorType colorBytes)
{
rasterizer.reset();
Affine transform = GetTransform();
if (!transform.is_identity())
{
vertexSource = new VertexSourceApplyTransform(vertexSource, transform);
}
rasterizer.add_path(vertexSource, pathIndexToRender);
if (destImageByte != null)
{
scanlineRenderer.RenderSolid(destImageByte, rasterizer, m_ScanlineCache, colorBytes.GetAsRGBA_Bytes());
DestImage.MarkImageChanged();
}
else
{
scanlineRenderer.RenderSolid(destImageFloat, rasterizer, m_ScanlineCache, colorBytes.GetAsRGBA_Floats());
destImageFloat.MarkImageChanged();
}
}