public void color(Color color) { this.color.set(color); }
public ShapeAttributes set(ShapeAttributes attributes) { if (attributes == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ShapeAttributes", "set", "missingAttributes")); } this.drawInterior = attributes.drawInterior; this.drawOutline = attributes.drawOutline; this.drawVerticals = attributes.drawVerticals; this.depthTest = attributes.depthTest; this.enableLighting = attributes.enableLighting; this.interiorColor.set(attributes.interiorColor); this.outlineColor.set(attributes.outlineColor); this.outlineWidth = attributes.outlineWidth; this.interiorImageSource = attributes.interiorImageSource; this.outlineImageSource = attributes.outlineImageSource; return this; }
public TextAttributes setTextColor(Color color) { if (color == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "TextAttributes", "setTextColor", "missingColor")); } this.textColor.set(color); return this; }
public void drawElements(int mode, int count, int type, int offset) { DrawElements prim = this.prims[this.primCount++]; prim.mode = mode; prim.count = count; prim.type = type; prim.offset = offset; prim.color.set(this.color); prim.lineWidth = this.lineWidth; prim.texture = this.texture; prim.texCoordMatrix.set(this.texCoordMatrix); prim.texCoordAttrib.size = this.texCoordAttrib.size; prim.texCoordAttrib.offset = this.texCoordAttrib.offset; }
public TextAttributes setOutlineColor(Color color) { if (color == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "TextAttributes", "setOutlineColor", "missingColor")); } this.outlineColor.set(color); return this; }
public void setColor(Color color) { if (color == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ShowTessellationLayer", "setColor", "missingColor")); } this.color.set(color); }
/** * Sets shape interior color and opacity. * * @param color the new RGBA color to use for shape interiors * * @throws IllegalArgumentException If the color is null */ public ShapeAttributes setInteriorColor(Color color) { if (color == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ShapeAttributes", "setInteriorColor", "missingColor")); } this.interiorColor.set(color); return this; }
public TextAttributes set(TextAttributes attributes) { if (attributes == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "TextAttributes", "set", "missingAttributes")); } this.textColor.set(attributes.textColor); this.textOffset.set(attributes.textOffset); this.textSize = attributes.textSize; this.typeface = attributes.typeface; this.enableOutline = attributes.enableOutline; this.outlineColor.set(attributes.outlineColor); this.enableDepthTest = attributes.enableDepthTest; this.outlineWidth = attributes.outlineWidth; return this; }
/** * Sets shape outline color and opacity. * * @param color the new RGBA color to use for shape outlines * * @throws IllegalArgumentException If the color is null */ public ShapeAttributes setOutlineColor(Color color) { if (color == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ShapeAttributes", "setOutlineColor", "missingColor")); } this.outlineColor.set(color); return this; }
public void loadColor(Color color) { if (!this.color.equals(color)) { this.color.set(color); float alpha = color.alpha; GLES20.glUniform4f(this.colorId, color.red * alpha, color.green * alpha, color.blue * alpha, alpha); } } }
public void loadColor(Color color) { if (!this.color.equals(color)) { // suppress unnecessary writes to GLSL uniform variables this.color.set(color); float a = color.alpha; GLES20.glUniform4f(this.colorId, color.red * a, color.green * a, color.blue * a, a); } } }
public void reset() { this.program = null; this.vertexBuffer = null; this.elementBuffer = null; this.vertexOrigin.set(0, 0, 0); this.vertexStride = 0; this.enableCullFace = true; this.enableDepthTest = true; this.depthOffset = 0; this.color.set(1, 1, 1, 1); this.lineWidth = 1; this.texture = null; this.texCoordMatrix.setToIdentity(); this.texCoordAttrib.size = 0; this.texCoordAttrib.offset = 0; this.primCount = 0; for (int idx = 0; idx < MAX_DRAW_ELEMENTS; idx++) { this.prims[idx].texture = null; } }
public DrawableSurfaceTexture set(SurfaceTextureProgram program, Sector sector, Texture texture, Matrix3 texCoordMatrix) { this.program = program; this.color.set(1, 1, 1, 1); this.texture = texture; if (sector != null) { this.sector.set(sector); } else { this.sector.setEmpty(); } if (texCoordMatrix != null) { this.texCoordMatrix.set(texCoordMatrix); } else { this.texCoordMatrix.setToIdentity(); } return this; }
/** * Prepares this placemark's icon or symbol for processing in a subsequent drawing pass. Implementations must be * careful not to leak resources from Placemark into the Drawable. * * @param rc the current render context * @param drawable the Drawable to be prepared */ protected void prepareDrawableIcon(RenderContext rc, DrawableScreenTexture drawable) { // Use the basic GLSL program to draw the placemark's icon. drawable.program = (BasicShaderProgram) rc.getShaderProgram(BasicShaderProgram.KEY); if (drawable.program == null) { drawable.program = (BasicShaderProgram) rc.putShaderProgram(BasicShaderProgram.KEY, new BasicShaderProgram(rc.resources)); } // Use the plaemark's unit square transform matrix. drawable.unitSquareTransform.set(unitSquareTransform); // Configure the drawable according to the placemark's active attributes. Use a color appropriate for the pick // mode. When picking use a unique color associated with the picked object ID. Use the texture associated with // the active attributes' image source and its associated tex coord transform. If the texture is not specified // or not available, draw a simple colored square. drawable.color.set(rc.pickMode ? this.pickColor : this.activeAttributes.imageColor); drawable.texture = this.activeTexture; drawable.enableDepthTest = this.activeAttributes.depthTest; }
protected void makeDrawable(RenderContext rc) { // Obtain a pooled drawable and configure it to draw the sightline's coverage. Pool<DrawableSightline> pool = rc.getDrawablePool(DrawableSightline.class); DrawableSightline drawable = DrawableSightline.obtain(pool); // Compute the transform from sightline local coordinates to world coordinates. drawable.centerTransform = rc.globe.cartesianToLocalTransform(this.centerPoint.x, this.centerPoint.y, this.centerPoint.z, drawable.centerTransform); drawable.range = (float) WWMath.clamp(this.range, 0, Float.MAX_VALUE); // Configure the drawable colors according to the current attributes. When picking use a unique color associated // with the picked object ID. Null attributes indicate that nothing is drawn. if (this.activeAttributes != null) { drawable.visibleColor.set(rc.pickMode ? this.pickColor : this.activeAttributes.interiorColor); } if (this.occludeAttributes != null) { drawable.occludedColor.set(rc.pickMode ? this.pickColor : this.occludeAttributes.interiorColor); } // Use the sightline GLSL program to draw the coverage. drawable.program = (SightlineProgram) rc.getShaderProgram(SightlineProgram.KEY); if (drawable.program == null) { drawable.program = (SightlineProgram) rc.putShaderProgram(SightlineProgram.KEY, new SightlineProgram(rc.resources)); } // Enqueue a drawable for processing on the OpenGL thread. rc.offerSurfaceDrawable(drawable, 0 /*z-order*/); } }
public TextCacheKey set(String text, TextAttributes attributes) { this.text = text; if (attributes != null) { this.textColor = (this.textColor != null) ? this.textColor.set(attributes.getTextColor()) : new Color(attributes.getTextColor()); this.textSize = attributes.getTextSize(); this.typeface = attributes.getTypeface(); this.enableOutline = attributes.isEnableOutline(); this.outlineColor = (this.outlineColor != null) ? this.outlineColor.set(attributes.getOutlineColor()) : new Color(attributes.getOutlineColor()); this.outlineWidth = attributes.getOutlineWidth(); } else { this.textColor = null; this.textSize = 0; this.typeface = null; this.enableOutline = false; this.outlineColor = null; this.outlineWidth = 0; } return this; }
protected void initProgram(DrawContext dc) { this.enablePickModeId = GLES20.glGetUniformLocation(this.programId, "enablePickMode"); GLES20.glUniform1i(this.enablePickModeId, 0); // disable pick mode this.enableTextureId = GLES20.glGetUniformLocation(this.programId, "enableTexture"); GLES20.glUniform1i(this.enableTextureId, 0); // disable texture this.mvpMatrixId = GLES20.glGetUniformLocation(this.programId, "mvpMatrix"); new Matrix4().transposeToArray(this.mvpMatrixArray, 0); // 4 x 4 identity matrix GLES20.glUniformMatrix4fv(this.mvpMatrixId, 1, false, this.mvpMatrixArray, 0); this.texCoordMatrixId = GLES20.glGetUniformLocation(this.programId, "texCoordMatrix"); new Matrix3().transposeToArray(this.texCoordMatrixArray, 0); // 3 x 3 identity matrix new Matrix3().transposeToArray(this.texCoordMatrixArray, 9); // 3 x 3 identity matrix GLES20.glUniformMatrix3fv(this.texCoordMatrixId, 2, false, this.texCoordMatrixArray, 0); this.colorId = GLES20.glGetUniformLocation(this.programId, "color"); this.color.set(1, 1, 1, 1); // opaque white GLES20.glUniform4f(this.colorId, this.color.red, this.color.green, this.color.blue, this.color.alpha); this.texSamplerId = GLES20.glGetUniformLocation(this.programId, "texSampler"); GLES20.glUniform1i(this.texSamplerId, 0); // GL_TEXTURE0 }
@Test public void testModifiedAttrs() { // Common Text Attributes TextAttributes attrs = new TextAttributes(); attrs.setEnableOutline(true); attrs.setOutlineColor(new Color(0.5f, 0.2f, 0.3f, 1)); attrs.setOutlineWidth(15); attrs.setTextColor(new Color(1, 1, 0.2f, 1)); attrs.setTextSize(90); // Common Text String text = "Testing"; // Cache Key 1 RenderContext.TextCacheKey textCacheKeyOne = new RenderContext.TextCacheKey().set(text, attrs); // Modify color property Color outlineColor = attrs.getOutlineColor().set(1, 1, 0.3f, 1); attrs.setOutlineColor(outlineColor); // Cache Key 2 RenderContext.TextCacheKey textCacheKeyTwo = new RenderContext.TextCacheKey().set(text, attrs); assertFalse("TextCacheKey modified attributes equals", textCacheKeyOne.equals(textCacheKeyTwo)); assertFalse("TextCacheKey modified attributes hashcode", textCacheKeyOne.hashCode() == textCacheKeyTwo.hashCode()); } }