本文整理汇总了C#中Entity.getVolumeFromAtomCount方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.getVolumeFromAtomCount方法的具体用法?C# Entity.getVolumeFromAtomCount怎么用?C# Entity.getVolumeFromAtomCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.getVolumeFromAtomCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: layout
public static void layout(Entity subset, float delay = 0.0f)
{
float parentVolume = 0.0f;
if (subset.parent == null)
{
return;
}
parentVolume = subset.parent.boundingBoxW * subset.parent.boundingBoxH * subset.parent.boundingBoxD;
float subsetAC = subset.getVolumeFromAtomCount();
float totalAC = subset.parent.getVolumeFromAtomCount();
float width = (subsetAC / totalAC) * subset.parent.boundingBoxW;
//seed all sub-entities into the bounding volume
foreach (Entity e in subset.entities)
{
float x = Random.Range(0.0f, subset.parent.boundingBoxD);
float y = Random.Range(0.0f, subset.parent.boundingBoxH);
float z = Random.Range(0.0f, width);
e.transformEntity(new Vector3(x - subset.parent.boundingBoxD * 0.5f,
y - subset.parent.boundingBoxH * 0.5f,
z - subset.parent.boundingBoxW * 0.5f), delay);
}
subset.boundingBoxD = subset.parent.boundingBoxD;
subset.boundingBoxH = subset.parent.boundingBoxH;
subset.boundingBoxW = width;
}
示例2: layout
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);
}
}
示例3: layout
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);
}
}
示例4: layout
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);
}
}