public SCBitmap(Texture2D tex) { this.tex = tex; dbugSettings = UnityEngine.Object.FindObjectOfType <DbugSettings>(); machineConfig = UnityEngine.Object.FindObjectOfType <MachineConfig>(); stripeFieldConfig = UnityEngine.Object.FindObjectOfType <StripeFieldConfig>(); lineWidth = stripeFieldConfig.lineWidth; size = new Vector2(tex.width, tex.height); }
void CreateGenerator() { SVGViewBox viewBox = SCCSSParser.ParseViewBox(svgFullPath); CSSLookup lookup = SCCSSParser.Parse(svgFullPath); SvgParser.SvgPath plist = getSvgPath(svgFullPath); for (var it = plist; it != null; it = it.next) { lookup.updatePath(it); } SCSvgFileData _svgFileData = new SCSvgFileData() { isYAxisInverted = yAxisInverted }; StripeFieldConfig stripeFieldConfig = FindObjectOfType <StripeFieldConfig>(); StripedPathSet stripedPathSet = new StripedPathSet(plist, stripeFieldConfig, _svgFileData); // // Configure generator // if (generatorType == GeneratorType.Crosshatch) { var crosshatchGenerator = new SCCrosshatchGenerator(machineConfig, new HatchConfig(), _svgFileData, viewBox, _generatorConfig); crosshatchGenerator.UsePathSet(stripedPathSet); generator = crosshatchGenerator; } else if (generatorType == GeneratorType.Triangles) { var pixelTree = bitMapPointGenerator.getPixelTriTree(); //if (ShouldMeshPixelTree) // pixelTreeDebugDisplay.GetComponent<MeshFilter>().mesh = pixelTree.getMesh(); var pointSetGenerator = new SCTriangleCrosshatchGenerator( machineConfig, _generatorConfig, pixelTree, bitMapPointGenerator); generator = pointSetGenerator; } else { SCTSPCrosshatchGenerator tspGenerator; if (useBitMapPointGenerator) { tspGenerator = new SCTSPCrosshatchGenerator(machineConfig, bitMapPointGenerator.inputImageBox, _generatorConfig); tspGenerator.SetTSPPointSets(bitMapPointGenerator.getPoints()); tspGenerator.BaseFileName = Path.GetFileNameWithoutExtension(bitMapPointGenerator.bmapName); } else { List <Vector2f> points; tspGenerator = new SCTSPCrosshatchGenerator(machineConfig, viewBox, _generatorConfig); points = stripedPathSet.AllPathsToPoints(); tspGenerator.AddPoints(points); } generator = tspGenerator; } }