void OnRenderObject() { if (_lastSelectedWord.Length == 0 || _linkWiresNodes.Length == 0) { return; } else { foreach (uint year in _linkWiresNodes) { List <Vector3> wordLink = new List <Vector3> (); float factor = 2f; uint yearDiff = (year - 1965) / 10; float widthOverride = lineWidth + Mathf.Pow(factor, yearDiff) * 1f; // Debug.Log(string.Format("{0} year with width of {1}", year, widthOverride)); int totalInterpolated = 10; Vector3[] arr = WireframeNodes.GetInterpolatedPoints(0, year, (uint)totalInterpolated * (6 - yearDiff)); for (int i = 0; i < arr.Length - yearDiff * 2; i++) { wordLink.Add(arr [i]); } // wordLink.AddRange(WireframeNodes.GetLinesByYears (new uint[]{ 0 })); GLPlotLines(wordLink.ToArray(), false, widthOverride); } } }
void OnRenderObject() { if (horizontalWires.Count == 0 || verticalWires.Count == 0) { PopulateYears(); } foreach (uint[] years in horizontalWires) { Vector3[] lines = WireframeNodes.GetInterpolatedLinesByYears(years, backToOriginHorizontal); GLPlotLines(lines, backToOriginHorizontal); } foreach (uint[] years in verticalWires) { Vector3[] lines = WireframeNodes.GetInterpolatedLinesByYears(years, backToOriginVertical); GLPlotLines(lines, backToOriginVertical); } }
void Update() { if (!meshGenerated) { foreach (uint[] years in horizontalWires) { Vector3[] lines = WireframeNodes.GetInterpolatedLinesByYears(years, backToOriginHorizontal); GenerateMesh(lines, backToOriginHorizontal); } foreach (uint[] years in verticalWires) { Vector3[] lines = WireframeNodes.GetInterpolatedLinesByYears(years, backToOriginHorizontal); GenerateMesh(lines, backToOriginVertical); } meshGenerated = true; meshGrid = meshBuilder.CreateMesh(); meshFilter.mesh = meshGrid; } }
void Start() { AnnualWordList annualWords = new AnnualWordList(); annualWords.Load(); Vector3 center = centerPosition; float latitude = (180.0f - angleMargin * 2) / (totalSpawners - 1) * (latitudeIndex - 1) + angleMargin - 90.0f; WireframeNodes.RegisterCenterSphere(centerPosition, radius); //WireframeNodes.NorthPole = new Vector3 (center.x, center.y + 2 * radius, center.z); WireframeNodes.RegisterNorthPole(RandomCircleOnSphere(center, radius, 0f, 90f)); for (int i = 0; i < numObjects; i++, yearStart++) { float longitude = 360.0f / numObjects * i; Vector3 pos = RandomCircleOnSphere(center, radius, longitude, latitude); // Debug.Log (string.Format ("Generating pos {0}, {1} for {2} at year {3}", longitude, latitude, latitudeIndex, yearStart)); GameObject yearName = Instantiate(prefab, pos, Quaternion.LookRotation(pos - center)); yearName.transform.parent = this.transform; // saving the position to Wireframe Nodes Vector3 offsetPos = RandomCircleOnSphere(center, radius, longitude + AngleOffset, latitude); WireframeNodes.RegisterNode((uint)yearStart, offsetPos, longitude + AngleOffset, latitude); yearName.GetComponent <TextMeshPro> ().text = yearStart.ToString(); // yearName.GetComponent<TextMeshPro> ().faceColor = new Color32 (255, 0, 0, 255); yearName.GetComponent <TextMeshPro> ().fontMaterial.SetColor("_GlowColor", UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f)); yearName.gameObject.name = yearStart.ToString(); //yearName.GetComponent<LyricSpawner> ().GenerateWords (yearName.transform); List <TopWord> annualTopWords = annualWords.GetTopWordsByYear((uint)yearStart, LyricSpawner.NUM_WORDS); //Year, top#3 // UnityEngine.Debug.Log(yearStart.ToString() + " : " + annualTopWords[0].Word + "and" + annualTopWords[0].Polarity + " and " + annualTopWords[1].Word + " and " + annualTopWords[2].Word); yearName.GetComponent <LyricSpawner>().GenerateWords(yearName.transform, annualTopWords.ToArray()); } }