// Find, /// <summary> /// Find object on screen /// </summary> /// <param name="findshader">The shader to use for the find</param> /// <param name="glstate">Render state</param> /// <param name="pos">Position on screen of find point</param> /// <param name="size">Screen size</param> /// <returns>Returns null, or /// item1 = return the list of blocks /// item2 = the found block /// item3 = the index within that found block /// item4 = the total index into the data (summed up) /// item5 = the z of the find ///</returns> public Tuple <List <GLObjectsWithLabels.BlockRef>, int, int, int, float> FindBlock(GLShaderPipeline findshader, GLRenderState glstate, Point pos, Size size) { var ret = Find(findshader, glstate, pos, size); // return set, group, index, z if (ret != null) { GLObjectsWithLabels s = set[ret.Item1]; // this is set var fb = BlockList.Find(x => x.Find(y => y.owl == s && y.blockindex == ret.Item2) != null); // find (set,blockindex) in block list if (fb != null) { int c = 0; foreach (var br in fb) // until we get to owl/blockindex, count previous block counts so we get a cumulative total { if (br.owl == s && br.blockindex == ret.Item2) { break; } c += br.count; } return(new Tuple <List <GLObjectsWithLabels.BlockRef>, int, int, int, float>(fb, ret.Item2, ret.Item3, c + ret.Item3, ret.Item4)); // return block list, and real index into it } } return(null); }
private void AddSet() // add a new set { var owl = new GLObjectsWithLabels(); var ris = owl.Create(textures, estimateditemspergroup, mingroups, objectbuffer, objectvertexescount, objrc, objpt, texturesize, textrc, textureformat, limittexturedepth); robjects.Add(objectshader, name + "O" + (setnumber).ToStringInvariant(), ris.Item1); robjects.Add(textshader, name + "T" + (setnumber++).ToStringInvariant(), ris.Item2); set.Add(owl); }