Java Code Examples for com.jme3.math.ColorRGBA#White
The following examples show how to use
com.jme3.math.ColorRGBA#White .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestIssue1340.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { stateManager.attach(new EnvironmentCamera(32)); DirectionalLight light = new DirectionalLight(Vector3f.UNIT_Y.negate(), ColorRGBA.White); rootNode.addLight(light); assetManager.registerLocator("https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/RiggedFigure/", UrlLocator.class); model = assetManager.loadModel("/glTF-Embedded/RiggedFigure.gltf"); SkinningControl skinningControl = getSkinningControl(model); if (skinningControl == null || !skinningControl.isHardwareSkinningPreferred()) { throw new IllegalArgumentException("This test case requires a model with a SkinningControl and with Hardware skinning preferred!"); } viewPort.setBackgroundColor(ColorRGBA.LightGray); }
Example 2
Source File: TangentBinormalGenerator.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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; }
Example 3
Source File: SilentTangentBinormalGenerator.java From OpenRTS with MIT License | 5 votes |
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; }
Example 4
Source File: TangentBinormalGenerator.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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; }
Example 5
Source File: SlopeTerrainToolControl.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
@Override @FromAnyThread protected @NotNull ColorRGBA getBrushColor() { return ColorRGBA.White; }
Example 6
Source File: TestMultiRenderTarget.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { viewPort.addProcessor(this); // 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 }; pls = new PointLight[3]; for (int i = 0; i < pls.length; i++){ PointLight pl = new PointLight(); pl.setColor(colors[i % colors.length]); pl.setRadius(5); display.addLight(pl); pls[i] = pl; } }
Example 7
Source File: MaterialManager.java From OpenRTS with MIT License | 4 votes |
private static void initBaseMaterials() { ColorRGBA lotColorBase = new ColorRGBA(200f / 255f, 200f / 255f, 200f / 255f, 255f / 255f); ColorRGBA concreteColor = new ColorRGBA(90f / 255f, 100f / 255f, 255f / 255f, 255f / 255f); ColorRGBA redConcreteColor = ColorRGBA.Red; ColorRGBA blueConcreteColor = ColorRGBA.Blue; ColorRGBA yellowConcreteColor = ColorRGBA.Yellow; ColorRGBA cyanConcreteColor = new ColorRGBA(0, 1, 1, 0.4f); ColorRGBA blackConcreteColor = ColorRGBA.Black; ColorRGBA greenConcreteColor = ColorRGBA.Green; ColorRGBA floorColor = ColorRGBA.Gray; ColorRGBA windowsColor = ColorRGBA.White; ColorRGBA itemColor = ColorRGBA.LightGray; ColorRGBA roadsColor = ColorRGBA.LightGray; ColorRGBA terrainColor = new ColorRGBA(0f / 255f, 50f / 255f, 14f / 255f, 255f / 255f); am.registerLocator("assets/", FileLocator.class); contourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); contourMaterial.setColor("Color", blackConcreteColor); blockContourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); blockContourMaterial.setColor("Color", redConcreteColor); lotContourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); lotContourMaterial.setColor("Color", blueConcreteColor); lotMaterial1 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); lotMaterial1.setColor("Color", lotColorBase); lotMaterial2 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); lotMaterial2.setColor("Color", lotColorBase); lotMaterial3 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); lotMaterial3.setColor("Color", lotColorBase); // debug material debugMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); debugMaterial.setColor("Color", redConcreteColor); // debug texture material // debugTextureMaterial = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md"); // debugTextureMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); // debugTextureMaterial.setTexture("DiffuseMap", assetManager.loadTexture("Textures/UVTest.jpg")); // debugTextureMaterial.setFloat("Shininess", 128f); // [0,128] // Red Material redMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); redMaterial.setColor("Color", redConcreteColor); redMaterial.setColor("GlowColor", redConcreteColor); // Concrete Material yellowMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); yellowMaterial.setColor("Color", yellowConcreteColor); // Concrete Material cyanMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); cyanMaterial.setColor("Color", cyanConcreteColor); cyanMaterial.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); // Concrete Material blackMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); blackMaterial.setColor("Color", blackConcreteColor); // Concrete Material greenMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); greenMaterial.setColor("Color", greenConcreteColor); greenMaterial.setColor("GlowColor", greenConcreteColor); // Item Material itemMaterial = new Material(am, "Common/MatDefs/Light/Lighting.j3md"); itemMaterial.setColor("Diffuse", itemColor); itemMaterial.setBoolean("UseMaterialColors", true); // gradient blue for (int i = 0; i < 4; i++) { gradientMaterial.add(new Material(am, "Common/MatDefs/Misc/Unshaded.j3md")); gradientMaterial.get(i).setColor("Color", new ColorRGBA(i * 30 / 255f, i * 30 / 255f, i * 85 / 255f, 1)); } }
Example 8
Source File: TestMultiRenderTarget.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@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); } }