/** * Generate a new FloatBuffer using the given array of ColorRGBA objects. * The FloatBuffer will be 4 * data.length long and contain the color data. * * @param data * array of ColorRGBA objects to place into a new FloatBuffer */ public static FloatBuffer createFloatBuffer(ColorRGBA... data) { if (data == null) { return null; } FloatBuffer buff = createFloatBuffer(4 * data.length); for (int x = 0; x < data.length; x++) { if (data[x] != null) { buff.put(data[x].getRed()).put(data[x].getGreen()).put(data[x].getBlue()).put(data[x].getAlpha()); } else { buff.put(0).put(0).put(0).put(0); } } buff.flip(); return buff; }
/** * Writes the value to the data buffer. * * @param data the data buffer. * @param value the value. */ protected void writeVec4(final ByteBuffer data, final Object value) { if (value == null) { data.putLong(0).putLong(0); } else if (value instanceof Vector4f) { final Vector4f vec4 = (Vector4f) value; data.putFloat(vec4.getX()) .putFloat(vec4.getY()) .putFloat(vec4.getZ()) .putFloat(vec4.getW()); } else if(value instanceof Quaternion) { final Quaternion vec4 = (Quaternion) value; data.putFloat(vec4.getX()) .putFloat(vec4.getY()) .putFloat(vec4.getZ()) .putFloat(vec4.getW()); } else if(value instanceof ColorRGBA) { final ColorRGBA vec4 = (ColorRGBA) value; data.putFloat(vec4.getRed()) .putFloat(vec4.getGreen()) .putFloat(vec4.getBlue()) .putFloat(vec4.getAlpha()); } }
private String formatValue(MatParam param) { Object value = param.getValue(); if (value == null) { return null; } switch (param.getVarType()) { case Vector2: Vector2f v2 = (Vector2f) value; return v2.getX() + " " + v2.getY(); case Vector3: Vector3f v3 = (Vector3f) value; return v3.getX() + " " + v3.getY() + " " + v3.getZ(); case Vector4: if (value instanceof ColorRGBA) { ColorRGBA c = (ColorRGBA) value; return c.getRed() + " " + c.getGreen() + " " + c.getBlue() + " " + c.getAlpha(); } else { Vector4f v4 = (Vector4f) value; return v4.getX() + " " + v4.getY() + " " + v4.getZ() + " " + v4.getW(); } default: return value.toString(); } } }
} else if (val instanceof ColorRGBA) { ColorRGBA color = (ColorRGBA) val; return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha(); } else if (val instanceof Quaternion) {
color.getGreen(), color.getBlue(), l.getType().getId(),
} else if (value instanceof ColorRGBA) { ColorRGBA color = (ColorRGBA) value; return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha(); } else if (value instanceof Quaternion) {
color.getGreen(), color.getBlue(), l.getType().getId(),
protected void updateColorView() { ColorRGBA c = model.getObject(); int r = (int)Math.round(c.getRed() * 255); int g = (int)Math.round(c.getGreen() * 255); int b = (int)Math.round(c.getBlue() * 255); float[] hsb = Color.RGBtoHSB(r, g, b, null); this.hIndex = hsb[0]; this.sIndex = hsb[1]; this.bIndex = hsb[2]; updateColorView(hsb[0], hsb[1], hsb[2]); }
/** * Generate a new FloatBuffer using the given array of ColorRGBA objects. * The FloatBuffer will be 4 * data.length long and contain the color data. * * @param data * array of ColorRGBA objects to place into a new FloatBuffer */ public static FloatBuffer createFloatBuffer(ColorRGBA... data) { if (data == null) { return null; } FloatBuffer buff = createFloatBuffer(4 * data.length); for (int x = 0; x < data.length; x++) { if (data[x] != null) { buff.put(data[x].getRed()).put(data[x].getGreen()).put(data[x].getBlue()).put(data[x].getAlpha()); } else { buff.put(0).put(0).put(0).put(0); } } buff.flip(); return buff; }
private String formatValue(MatParam param) { Object value = param.getValue(); if (value == null) { return null; } switch (param.getVarType()) { case Vector2: Vector2f v2 = (Vector2f) value; return v2.getX() + " " + v2.getY(); case Vector3: Vector3f v3 = (Vector3f) value; return v3.getX() + " " + v3.getY() + " " + v3.getZ(); case Vector4: if (value instanceof ColorRGBA) { ColorRGBA c = (ColorRGBA) value; return c.getRed() + " " + c.getGreen() + " " + c.getBlue() + " " + c.getAlpha(); } else { Vector4f v4 = (Vector4f) value; return v4.getX() + " " + v4.getY() + " " + v4.getZ() + " " + v4.getW(); } default: return value.toString(); } } }
} else if (val instanceof ColorRGBA) { ColorRGBA color = (ColorRGBA) val; return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha(); } else if (val instanceof Quaternion) {
} else if (value instanceof ColorRGBA) { ColorRGBA color = (ColorRGBA) value; return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha(); } else if (value instanceof Quaternion) {
} else if (value instanceof ColorRGBA) { ColorRGBA color = (ColorRGBA) value; return color.getRed() + " " + color.getGreen() + " " + color.getBlue() + " " + color.getAlpha(); } else if (value instanceof Quaternion) {
ColorRGBA color = l.getColor(); lightColor.setVector4InArray(color.getRed(), color.getGreen(), color.getBlue(), l.getType().getId(),
color.getGreen(), color.getBlue(), l.getType().getId(),
color.getGreen(), color.getBlue(), l.getType().getId(),