public static MutableColor stringToColor(String color) { String[] vecString = color.split("\\s+"); MutableColor color3f = new MutableColor(Float.parseFloat(vecString[0]), Float.parseFloat(vecString[1]), Float.parseFloat(vecString[2])); return color3f; }
public static MutableColor parseColor3f(String color) { try { StringTokenizer s = new StringTokenizer(color, ","); return new MutableColor(new float[] {Float.parseFloat(s.nextToken()), Float.parseFloat(s.nextToken()), Float.parseFloat(s.nextToken())}); } catch (Exception e) { return null; } } }
public YoAppearanceRGBColor(Color color, double transparency) { this.color = new MutableColor(color); awtColor = new Color(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, (float) (1.0 - transparency)); setTransparency(transparency); }
public YoAppearanceRGBColor(double red, double green, double blue, double transparency) { color = new MutableColor((float) red, (float) green, (float) blue); awtColor = new Color((float) red, (float) green, (float) blue, (float) (1.0 - transparency)); setTransparency(transparency); }
public YoAppearanceRGBColor(float red, float green, float blue, double transparency) { color = new MutableColor(red, green, blue); awtColor = new Color(red, green, blue, (float) (1.0 - transparency)); setTransparency(transparency); }
public static AppearanceDefinition Color(Color color) { return Color(new MutableColor(color)); }
public void run() { transparency += 0.01; if (transparency > 1.0) transparency = 0.0; MutableColor color = new MutableColor((float) Math.random(), (float) Math.random(), (float) Math.random()); YoAppearanceRGBColor appearance = new YoAppearanceRGBColor(color, 0.0); appearance.setTransparency(transparency); instruction.setAppearance(appearance); }
public void run() { transparency += 0.01; if (transparency > 1.0) transparency = 0.0; MutableColor color = new MutableColor((float) Math.random(), (float) Math.random(), (float) Math.random()); YoAppearanceRGBColor appearance = new YoAppearanceRGBColor(color, 0.0); appearance.setTransparency(transparency); instruction.setAppearance(appearance); }
public static void addCube(double cubeX, double cubeY, double cubeSize, Color color, SimulationConstructionSet scs) { final double CUBE_HEIGHT = 0.001; // Make cubes a tiny bit smaller so they don't blend together. cubeSize *= 0.9; Graphics3DObject linkGraphics = new Graphics3DObject(); linkGraphics.translate(new Vector3D(cubeX, cubeY ,CUBE_HEIGHT)); linkGraphics.addCube(cubeSize, cubeSize, cubeSize, new YoAppearanceRGBColor(new MutableColor(color), 0.0)); scs.addStaticLinkGraphics(linkGraphics); }
public YoAppearanceRGBColor(MutableColor color, double transparency) { this.color = new MutableColor(color); awtColor = new Color(this.color.getX(), this.color.getY(), this.color.getZ(), (float) (1.0 - transparency)); setTransparency(transparency); }
appearance.setDiffuseColor(new MutableColor(color)); appearance.setSpecularColor(new MutableColor(color)); appearance.setShininess(5.0f);
private RemoteYoGraphic getRemoteGraphic(DynamicGraphicMessage msg) { int registrationID = msg.getType(); String name = msg.getName(); YoVariable<?>[] vars = new YoVariable[msg.getYoIndexCount()]; for (int v = 0; v < vars.length; v++) vars[v] = variables.get(msg.getYoIndex(v)); double[] consts = ArrayUtils.toPrimitive(msg.getConstantList().toArray(new Double[msg.getConstantCount()])); AppearanceDefinition appearance = new YoAppearanceRGBColor(Color.red, 0.0); if (msg.hasAppearance()) { appearance = new YoAppearanceRGBColor(new MutableColor((float) msg.getAppearance().getX(), (float) msg.getAppearance().getY(), (float) msg.getAppearance().getZ()), msg.getAppearance().getTransparency()); } return yoGraphicFromMessage(registrationID, name, vars, consts, appearance); }
private RemoteYoGraphic getRemoteGraphic(GraphicObjectMessage graphicObjectMessage) { int registrationID = graphicObjectMessage.getRegistrationID(); String name = graphicObjectMessage.getNameAsString(); YoVariable<?>[] vars = new YoVariable[graphicObjectMessage.getYoVariableIndex().size()]; for (int v = 0; v < vars.length; v++) vars[v] = variables.get(graphicObjectMessage.getYoVariableIndex().get(v)); double[] consts = graphicObjectMessage.getConstants().toArray(); AppearanceDefinition appearance = new YoAppearanceRGBColor(new MutableColor((float) graphicObjectMessage.getAppearance().getR(), (float) graphicObjectMessage.getAppearance().getG(), (float) graphicObjectMessage.getAppearance().getB()), graphicObjectMessage.getAppearance().getTransparency()); return yoGraphicFromMessage(registrationID, name, vars, consts, appearance); } }
mat.setAmbientColor(new MutableColor(0.5f,0.5f,0.5f)); mat.setDiffuseColor(new MutableColor(0.5f,0.5f,0.5f)); mat.setSpecularColor(new MutableColor(0.5f,0.5f,0.5f));