本文整理汇总了Java中com.jme3.math.FastMath.ceil方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.ceil方法的具体用法?Java FastMath.ceil怎么用?Java FastMath.ceil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.FastMath
的用法示例。
在下文中一共展示了FastMath.ceil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBigBlock
import com.jme3.math.FastMath; //导入方法依赖的package包/类
public Node makeBigBlock(String name, float w, float h, float d,
ColorRGBA color, float unitBlockSize) {
int wCount = (int) FastMath.ceil(w / unitBlockSize);
int hCount = (int) FastMath.ceil(h / unitBlockSize);
int dCount = (int) FastMath.ceil(d / unitBlockSize);
// System.err.println(wCount + " " + dCount);
Node bigBlock = new Node(name);
float xMin = -(wCount / 2) * unitBlockSize;
if (wCount % 2 == 0) {
xMin += unitBlockSize / 2;
}
float yMin = -(hCount / 2) * unitBlockSize;
if (hCount % 2 == 0) {
yMin += unitBlockSize / 2;
}
float zMin = -(dCount / 2) * unitBlockSize;
if (dCount % 2 == 0) {
zMin += unitBlockSize / 2;
}
Vector3f c = new Vector3f(xMin, 0f, 0f);
for (int i = 0; i < wCount; ++i) {
c.y = yMin;
for (int j = 0; j < hCount; ++j) {
c.z = zMin;
for (int k = 0; k < dCount; ++k) {
Spatial unitBlock = makeBlock(
name + "(" + i + ", " + j + ")",
unitBlockSize, unitBlockSize, unitBlockSize, color);
unitBlock.setLocalTranslation(c);
bigBlock.attachChild(unitBlock);
c.z += unitBlockSize;
}
c.y += unitBlockSize;
}
c.x += unitBlockSize;
}
bigBlock.setUserData("obj_shape", "bigblock");
bigBlock.setUserData("obj_width", w);
bigBlock.setUserData("obj_height", h);
bigBlock.setUserData("obj_depth", d);
bigBlock.setUserData("obj_color", color);
bigBlock.setUserData("obj_unitBlockSize", unitBlockSize);
// return GeometryBatchFactory.optimize(bigBlock);
return bigBlock;
}