public static void layout(Entity subset, float delay = 0.0f) { //get the total volume of all its sub-entities float totalVolume; if (LayoutParams.Get.barLayout.useAtomCount) { float numAtoms = subset.getVolumeFromAtomCount(); totalVolume = numAtoms * TrannimationManager.atomDensity; } else totalVolume = subset.getVolumeFromBoundingSphere(); //float totalVolume = subset.getVolumeFromAtomCount(); //create a new bounding volume that will house all sub-entities //for this we need a base that we will fill float baseWidth = 100; float baseDepth = 100; float height = totalVolume / (baseWidth * baseDepth) * /*0.02f*/ /*0.003f*/ 0.01f; subset.boundingBoxW = baseWidth; subset.boundingBoxD = baseDepth; subset.boundingBoxH = height; Vector3 entryPoint = new Vector3(baseWidth * 0.5f, baseDepth * 0.5f, height); //seed all sub-entities into the bounding volume int counter = 0; //subset.entities.Sort() subset.entities.Sort(delegate (Entity x, Entity y) { return (int)(x.center.y - y.center.y); /*if (x.center.y == null && y.PartName == null) return 0; else if (x.PartName == null) return -1; else if (y.PartName == null) return 1; else return x.PartName.CompareTo(y.PartName);*/ }); foreach (Entity e in subset.entities) { /*float x = Random.Range(0.0f, baseWidth); float y = Random.Range(0.0f, height); float z = Random.Range(0.0f, baseDepth);*/ float x = 0.0f; float y = ((float)counter / (float)subset.entities.Count) * height; float z = 0.0f; counter++; e.transformEntity(new Vector3(x, /*height*1.5f*/ 2000.0f, baseWidth * 0.5f), delay); e.newStage = true; e.transformEntity(new Vector3(x, y, z), delay); } }
public static void layout(Entity subset, float delay = 0.0f) { //get the total volume of all its sub-entities float totalVolume; if (LayoutParams.Get.barLayout.useAtomCount) { float numAtoms = subset.getVolumeFromAtomCount(); totalVolume = numAtoms * TrannimationManager.atomDensity; } else totalVolume = subset.getVolumeFromBoundingSphere(); //float totalVolume = subset.getVolumeFromAtomCount(); //create a new bounding volume that will house all sub-entities //for this we need a base that we will fill float baseWidth = 200; float baseDepth = 200; float height = totalVolume / (baseWidth * baseDepth) * 0.02f; subset.boundingBoxW = baseWidth; subset.boundingBoxD = baseDepth; subset.boundingBoxH = height; Vector3 entryPoint = new Vector3(baseWidth * 0.5f, baseDepth * 0.5f, height); //seed all sub-entities into the bounding volume foreach (Entity e in subset.entities) { float x = Random.Range(0.0f, baseWidth); float y = Random.Range(0.0f, height); float z = Random.Range(0.0f, baseDepth); e.transformEntity(new Vector3(x, height * 1.5f, baseWidth * 0.5f), delay); e.newStage = true; e.transformEntity(new Vector3(x, y, z), delay); } }
public static void layout(Entity subset, float delay = 0.0f) { //get the total volume of all its sub-entities float totalVolume; if (LayoutParams.Get.barLayout.useAtomCount) { float numAtoms = subset.getVolumeFromAtomCount(); totalVolume = numAtoms * TrannimationManager.atomDensity; } else totalVolume = subset.getVolumeFromBoundingSphere(); //create a new bounding volume that will house all sub-entities //for this we need a base that we will fill float baseHeight = subset.boundingBoxH; float baseDepth = subset.boundingBoxD; float width = totalVolume / (baseHeight * baseDepth); //#warning: this should already be known //subset.boundingBoxD = baseDepth; //subset.boundingBoxH = baseHeight; subset.boundingBoxW = width; //#warning: entrypoint not yet used Vector3 entryPoint = new Vector3(width * 0.5f, baseDepth * 0.5f, baseHeight); //seed all sub-entities into the bounding volume foreach (Entity e in subset.entities) { float x = Random.Range(0.0f, width); float y = Random.Range(0.0f, baseHeight); float z = Random.Range(0.0f, baseDepth); e.transformEntity(new Vector3(x, y, z), delay); } }