本文整理汇总了Java中com.jme3.math.ColorRGBA.Blue方法的典型用法代码示例。如果您正苦于以下问题:Java ColorRGBA.Blue方法的具体用法?Java ColorRGBA.Blue怎么用?Java ColorRGBA.Blue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.ColorRGBA
的用法示例。
在下文中一共展示了ColorRGBA.Blue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: genNormalLines
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
public static Mesh genNormalLines(Mesh mesh, float scale) {
FloatBuffer vertexBuffer = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
FloatBuffer normalBuffer = (FloatBuffer) mesh.getBuffer(Type.Normal).getData();
ColorRGBA originColor = ColorRGBA.White;
ColorRGBA normalColor = ColorRGBA.Blue;
Mesh lineMesh = new Mesh();
lineMesh.setMode(Mesh.Mode.Lines);
Vector3f origin = new Vector3f();
Vector3f point = new Vector3f();
FloatBuffer lineVertex = BufferUtils.createFloatBuffer(vertexBuffer.capacity() * 2);
FloatBuffer lineColor = BufferUtils.createFloatBuffer(vertexBuffer.capacity() / 3 * 4 * 2);
for (int i = 0; i < vertexBuffer.capacity() / 3; i++) {
populateFromBuffer(origin, vertexBuffer, i);
populateFromBuffer(point, normalBuffer, i);
int index = i * 2;
setInBuffer(origin, lineVertex, index);
setInBuffer(originColor, lineColor, index);
point.multLocal(scale);
point.addLocal(origin);
setInBuffer(point, lineVertex, index + 1);
setInBuffer(normalColor, lineColor, index + 1);
}
lineMesh.setBuffer(Type.Position, 3, lineVertex);
lineMesh.setBuffer(Type.Color, 4, lineColor);
lineMesh.setStatic();
lineMesh.setInterleaved();
return lineMesh;
}
示例4: genNormalLines
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
public static Mesh genNormalLines(Mesh mesh, float scale) {
FloatBuffer vertexBuffer = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
FloatBuffer normalBuffer = (FloatBuffer) mesh.getBuffer(Type.Normal).getData();
ColorRGBA originColor = ColorRGBA.White;
ColorRGBA normalColor = ColorRGBA.Blue;
Mesh lineMesh = new Mesh();
lineMesh.setMode(Mesh.Mode.Lines);
Vector3f origin = new Vector3f();
Vector3f point = new Vector3f();
FloatBuffer lineVertex = BufferUtils.createFloatBuffer(vertexBuffer.limit() * 2);
FloatBuffer lineColor = BufferUtils.createFloatBuffer(vertexBuffer.limit() / 3 * 4 * 2);
for (int i = 0; i < vertexBuffer.limit() / 3; i++) {
populateFromBuffer(origin, vertexBuffer, i);
populateFromBuffer(point, normalBuffer, i);
int index = i * 2;
setInBuffer(origin, lineVertex, index);
setInBuffer(originColor, lineColor, index);
point.multLocal(scale);
point.addLocal(origin);
setInBuffer(point, lineVertex, index + 1);
setInBuffer(normalColor, lineColor, index + 1);
}
lineMesh.setBuffer(Type.Position, 3, lineVertex);
lineMesh.setBuffer(Type.Color, 4, lineColor);
lineMesh.setStatic();
// lineMesh.setInterleaved();
return lineMesh;
}
示例5: getBrushColor
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
@Override
protected @NotNull ColorRGBA getBrushColor() {
return ColorRGBA.Blue;
}
示例6: simpleInitApp
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
viewPort.addProcessor(this);
renderManager.setForcedTechnique("GBuf");
// flyCam.setEnabled(false);
cam.setLocation(new Vector3f(4.8037705f, 4.851632f, 10.789033f));
cam.setRotation(new Quaternion(-0.05143692f, 0.9483723f, -0.21131563f, -0.230846f));
Node tank = (Node) assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");
//tankMesh.getMaterial().setColor("Specular", ColorRGBA.Black);
rootNode.attachChild(tank);
display1 = new Picture("Picture");
display1.move(0, 0, -1); // make it appear behind stats view
display2 = (Picture) display1.clone();
display3 = (Picture) display1.clone();
display4 = (Picture) display1.clone();
display = (Picture) display1.clone();
ColorRGBA[] colors = new ColorRGBA[]{
ColorRGBA.White,
ColorRGBA.Blue,
ColorRGBA.Cyan,
ColorRGBA.DarkGray,
ColorRGBA.Green,
ColorRGBA.Magenta,
ColorRGBA.Orange,
ColorRGBA.Pink,
ColorRGBA.Red,
ColorRGBA.Yellow
};
for (int i = 0; i < 3; i++){
PointLight pl = new PointLight();
float angle = 0.314159265f * i;
pl.setPosition( new Vector3f(FastMath.cos(angle)*2f, 0,
FastMath.sin(angle)*2f));
pl.setColor(colors[i]);
pl.setRadius(5);
rootNode.addLight(pl);
display.addLight(pl);
}
}
示例7: genTangentLines
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
private static Mesh genTangentLines(Mesh mesh, float scale) {
FloatBuffer vertexBuffer = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
FloatBuffer normalBuffer = (FloatBuffer) mesh.getBuffer(Type.Normal).getData();
FloatBuffer tangentBuffer = (FloatBuffer) mesh.getBuffer(Type.Tangent).getData();
FloatBuffer binormalBuffer = null;
if (mesh.getBuffer(Type.Binormal) != null) {
binormalBuffer = (FloatBuffer) mesh.getBuffer(Type.Binormal).getData();
}
ColorRGBA originColor = ColorRGBA.White;
ColorRGBA tangentColor = ColorRGBA.Red;
ColorRGBA binormalColor = ColorRGBA.Green;
ColorRGBA normalColor = ColorRGBA.Blue;
Mesh lineMesh = new Mesh();
lineMesh.setMode(Mesh.Mode.Lines);
Vector3f origin = new Vector3f();
Vector3f point = new Vector3f();
Vector3f tangent = new Vector3f();
Vector3f normal = new Vector3f();
IntBuffer lineIndex = BufferUtils.createIntBuffer(vertexBuffer.capacity() / 3 * 6);
FloatBuffer lineVertex = BufferUtils.createFloatBuffer(vertexBuffer.capacity() * 4);
FloatBuffer lineColor = BufferUtils.createFloatBuffer(vertexBuffer.capacity() / 3 * 4 * 4);
for (int i = 0; i < vertexBuffer.capacity() / 3; i++) {
populateFromBuffer(origin, vertexBuffer, i);
populateFromBuffer(normal, normalBuffer, i);
populateFromBuffer(tangent, tangentBuffer, i);
int index = i * 4;
int id = i * 6;
lineIndex.put(id, index);
lineIndex.put(id + 1, index + 1);
lineIndex.put(id + 2, index);
lineIndex.put(id + 3, index + 2);
lineIndex.put(id + 4, index);
lineIndex.put(id + 5, index + 3);
setInBuffer(origin, lineVertex, index);
setInBuffer(originColor, lineColor, index);
point.set(tangent);
point.multLocal(scale);
point.addLocal(origin);
setInBuffer(point, lineVertex, index + 1);
setInBuffer(tangentColor, lineColor, index + 1);
if (binormalBuffer == null) {
normal.cross(tangent, point);
point.normalizeLocal();
}
else {
populateFromBuffer(point, binormalBuffer, i);
}
point.multLocal(scale);
point.addLocal(origin);
setInBuffer(point, lineVertex, index + 2);
setInBuffer(binormalColor, lineColor, index + 2);
point.set(normal);
point.multLocal(scale);
point.addLocal(origin);
setInBuffer(point, lineVertex, index + 3);
setInBuffer(normalColor, lineColor, index + 3);
}
lineMesh.setBuffer(Type.Index, 1, lineIndex);
lineMesh.setBuffer(Type.Position, 3, lineVertex);
lineMesh.setBuffer(Type.Color, 4, lineColor);
lineMesh.setStatic();
lineMesh.setInterleaved();
return lineMesh;
}
示例8: 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 + "'");
}
}