private void drawGraph(MatNode gr) { Color color = ColorParser.GetColor(gr.Fields["color"].GetValue <double[, ]>()); double[,] x = gr.Fields["x"].GetValue <double[, ]>(); double[,] y = gr.Fields["y"].GetValue <double[, ]>(); List <Vector2[]> points = DataParser.buildPointsList(x, y); graphContainer.GetComponent <GraphController>().BuildGraph(points, color); }
// matType Functions private void FVmeshSingleColor(MatNode fv) { Vector3[] vertices = DataParser.MatrixToVectorArray(fv.Fields["vertices"].GetValue <double[, ]>()); int[] faces = DataParser.MatrixTo1DArray(fv.Fields["faces"].GetValue <int[, ]>()); GameObject meshInstance = BuilderFunctions.InstantiateMesh(vertices, faces, transform); Color color = ColorParser.GetColor(fv.Fields["color"].GetValue <double[, ]>()); double[,] temp = fv.Fields["opacity"].GetValue <double[, ]>(); float opacity = (float)temp[0, 0]; BuilderFunctions.AddMat(opacity, meshInstance, _singleColor, _opaqueSingleColor); meshInstance.GetComponent <MeshRenderer>().material.SetColor("_color", color); }
private void SetConfigFromArguments(string config) { if (config.Length < 6) { numericUpDown2.Value = 255; numericUpDown3.Value = 255; numericUpDown4.Value = 255; } else { string s = config.Substring(0, 6); Color c = ColorParser.GetColor(s); numericUpDown2.Value = (decimal)c.R; numericUpDown3.Value = (decimal)c.G; numericUpDown4.Value = (decimal)c.B; customColorControl1.SetConfigString(config.Substring(6)); } }
private void scatter3(MatNode sc) { GameObject scatterInstance = new GameObject("scatter3Container"); scatterInstance.transform.parent = transform; Vector3[] pts = DataParser.MatrixToVectorArray(sc.Fields["vertices"].GetValue <double[, ]>()); int[,] sz = sc.Fields["size"].GetValue <int[, ]>(); Color color = ColorParser.GetColor(sc.Fields["color"].GetValue <double[, ]>()); for (int i = 0; i < pts.GetLength(0); i++) { GameObject sp = GameObject.CreatePrimitive(PrimitiveType.Sphere); sp.transform.position = pts[i]; sp.transform.localScale = new Vector3(sz[0, i], sz[0, i], sz[0, i]); sp.GetComponent <Renderer>().material = _scatterMat; sp.GetComponent <Renderer>().material.SetColor("_BaseColor", color); sp.transform.parent = scatterInstance.transform; } }