本文整理匯總了Java中com.jme3.math.ColorRGBA.Brown方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorRGBA.Brown方法的具體用法?Java ColorRGBA.Brown怎麽用?Java ColorRGBA.Brown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.math.ColorRGBA
的用法示例。
在下文中一共展示了ColorRGBA.Brown方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dropRandomBlock
import com.jme3.math.ColorRGBA; //導入方法依賴的package包/類
public void dropRandomBlock() {
final ColorRGBA[] colors = new ColorRGBA[] { ColorRGBA.Red,
ColorRGBA.Blue, ColorRGBA.Yellow, ColorRGBA.Green,
ColorRGBA.Brown, ColorRGBA.Cyan, ColorRGBA.Magenta,
ColorRGBA.Orange };
Spatial s = factory.makeBlock(getUniqueId("largeblock"), 1.5f, 1.5f, 1.5f,
colors[random.nextInt(colors.length)]);
s.setLocalTranslation(
(random.nextFloat() * 2 - 1) * (tableWidth / 2),
10,
(random.nextFloat() * 2 - 1) * (tableDepth / 2));
s.setLocalRotation(new Quaternion().fromAngleAxis(
FastMath.HALF_PI * random.nextFloat(),
Vector3f.UNIT_XYZ));
inventory.addItem(s, 1);
}
示例2: dropRandomStackOfBlocks
import com.jme3.math.ColorRGBA; //導入方法依賴的package包/類
public void dropRandomStackOfBlocks(int blockCount) {
final Vector3f BOX_SIZE = new Vector3f(1, 1, 1);
final ColorRGBA[] colors = new ColorRGBA[] {
ColorRGBA.Red, ColorRGBA.Blue, ColorRGBA.Yellow,
ColorRGBA.Green, ColorRGBA.Brown, ColorRGBA.Cyan,
ColorRGBA.Magenta, ColorRGBA.Orange};
Vector3f pos = new Vector3f(
(random.nextFloat() * 2 - 1) * (tableWidth / 2),
BOX_SIZE.y / 2,
(random.nextFloat() * 2 - 1) * (tableDepth / 2));
Quaternion rot = new Quaternion().fromAngleAxis(
FastMath.HALF_PI * random.nextFloat(), Vector3f.UNIT_Y);
for (int i = 0; i < blockCount; ++i) {
Spatial s = factory.makeBlock(getUniqueId("smallblock"),
BOX_SIZE.x, BOX_SIZE.y, BOX_SIZE.z,
colors[random.nextInt(colors.length)]);
s.setLocalTranslation(pos);
s.setLocalRotation(rot);
inventory.addItem(s, 1);
pos.y += BOX_SIZE.y;
}
}
示例3: parseColor
import com.jme3.math.ColorRGBA; //導入方法依賴的package包/類
private ColorRGBA parseColor(String str) {
if (str.equals("black")) {
return ColorRGBA.Black;
} else if (str.equals("blue")) {
return ColorRGBA.Blue;
} else if (str.equals("brown")) {
return ColorRGBA.Brown;
} else if (str.equals("cyan")) {
return ColorRGBA.Cyan;
} else if (str.equals("darkgray")) {
return ColorRGBA.DarkGray;
} else if (str.equals("gray")) {
return ColorRGBA.Gray;
} else if (str.equals("green")) {
return ColorRGBA.Green;
} else if (str.equals("lightgray")) {
return ColorRGBA.LightGray;
} else if (str.equals("magenta")) {
return ColorRGBA.Magenta;
} else if (str.equals("orange")) {
return ColorRGBA.Orange;
} else if (str.equals("pink")) {
return ColorRGBA.Pink;
} else if (str.equals("red")) {
return ColorRGBA.Red;
} else if (str.equals("white")) {
return ColorRGBA.White;
} else if (str.equals("yellow")) {
return ColorRGBA.Yellow;
} else {
Pattern pattern = Pattern.compile("^\\s*#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})\\s*$");
Matcher m = pattern.matcher(str);
if (m.find()) {
int r = Integer.parseInt(m.group(1), 16);
int g = Integer.parseInt(m.group(2), 16);
int b = Integer.parseInt(m.group(3), 16);
ColorRGBA color = new ColorRGBA();
color.fromIntRGBA((r << 24) + (g << 16) + (b << 8) + 0xff);
return color;
}
throw new IllegalArgumentException("could not parse '" + str + "'");
}
}