private GlyphCache(int height) { cellHeight = height; texture = Planets.LoadPlanetTexture("/webclient/images/glyphs1.png"); webFile = new WebFile("/webclient/images/glyphs1.xml"); webFile.OnStateChange = GlyphXmlReady; webFile.Send(); }
public static Texture LoadPlanetTexture(string url) { Texture texture = new Texture(); texture.Load(url); return texture; }
public void CleanUp() { dirty = true; texture = null; }
//const double jBase = 2455198.0; void InitBuffer(RenderContext renderContext) { if (!init) { if (renderContext.gl == null) { starProfile = (ImageElement)Document.CreateElement("img"); starProfile.AddEventListener("load", delegate(ElementEvent e) { imageReady = true; }, false); starProfile.Src = "/images/starProfile.png"; worldList = new Vector3d[points.Count]; transformedList = new Vector3d[points.Count]; int index = 0; foreach (Vector3d pnt in points) { // todo filter by date DataItem item = new DataItem(); item.Location = pnt; item.Tranformed = new Vector3d(); item.Size = sizes[index]; item.Color = colors[index]; worldList[index] = item.Location; transformedList[index] = item.Tranformed; items.Add(item); index++; } } else { if (pointBuffers.Count == 0) { if (starTexture == null) { starTexture = Planets.LoadPlanetTexture("/images/starProfile.png"); } int count = this.points.Count; TimeSeriesPointVertexBuffer pointBuffer = null; TimeSeriesPointVertex[] pointList = null; int countLeft = count; int index = 0; int counter = 0; foreach (Vector3d point in points) { if (counter >= 100000 || pointList == null) { if (pointBuffer != null) { pointBuffer.Unlock(); } int thisCount = Math.Min(100000, countLeft); countLeft -= thisCount; pointBuffer = new TimeSeriesPointVertexBuffer(thisCount); pointList = (TimeSeriesPointVertex[])pointBuffer.Lock(); // Lock the buffer (which will return our structs) pointBuffers.Add(pointBuffer); pointBufferCounts.Add(thisCount); counter = 0; } pointList[counter] = new TimeSeriesPointVertex(); pointList[counter].Position = point; pointList[counter].PointSize = sizes[index]; pointList[counter].Tu = (float)(dates[index].StartDate ); pointList[counter].Tv = (float)(dates[index].EndDate ); pointList[counter].Color = colors[index]; index++; counter++; } if (pointBuffer != null) { pointBuffer.Unlock(); } } } init = true; } }