public VertexInfo lerp (final VertexInfo target, float alpha) { if (hasPosition && target.hasPosition) position.lerp(target.position, alpha); if (hasNormal && target.hasNormal) normal.lerp(target.normal, alpha); if (hasColor && target.hasColor) color.lerp(target.color, alpha); if (hasUV && target.hasUV) uv.lerp(target.uv, alpha); return this; } }
public VertexInfo lerp (final VertexInfo target, float alpha) { if (hasPosition && target.hasPosition) position.lerp(target.position, alpha); if (hasNormal && target.hasNormal) normal.lerp(target.normal, alpha); if (hasColor && target.hasColor) color.lerp(target.color, alpha); if (hasUV && target.hasUV) uv.lerp(target.uv, alpha); return this; } }
/** Does not set the normal member! */ protected VertexInfo getVertexAt (final VertexInfo out, int x, int y) { final float dx = (float)x / (float)(width - 1); final float dy = (float)y / (float)(height - 1); final float a = data[y * width + x]; out.position.set(corner00).lerp(corner10, dx).lerp(tmpV1.set(corner01).lerp(corner11, dx), dy); out.position.add(tmpV1.set(magnitude).scl(a)); out.color.set(color00).lerp(color10, dx).lerp(tmpC.set(color01).lerp(color11, dx), dy); out.uv.set(dx, dy).scl(uvScale).add(uvOffset); return out; }
@Override public Color alter(float r, float g, float b, float a) { return new Color(r, g, b, a).lerp(this.r, this.g, this.b, this.a, this.amount); }
public VertexInfo lerp (final VertexInfo target, float alpha) { if (hasPosition && target.hasPosition) position.lerp(target.position, alpha); if (hasNormal && target.hasNormal) normal.lerp(target.normal, alpha); if (hasColor && target.hasColor) color.lerp(target.color, alpha); if (hasUV && target.hasUV) uv.lerp(target.uv, alpha); return this; } }
public VertexInfo lerp(final VertexInfo target, float alpha) { if (hasPosition && target.hasPosition) position.lerp(target.position, alpha); if (hasNormal && target.hasNormal) normal.lerp(target.normal, alpha); if (hasColor && target.hasColor) color.lerp(target.color, alpha); if (hasUV && target.hasUV) uv.lerp(target.uv, alpha); return this; } }
@Override public Color alter(float r, float g, float b, float a) { float givenH = globalSCC.getHue(r, g, b), givenS = globalSCC.getSaturation(r, g, b), minDiff = 999.0f, temp; if(givenS < 0.05) return new Color(r, g, b, a); int choice = 0; for (int i = 5; i < state.length; i += 6) { temp = state[i] - givenH; temp = (temp >= 0.5f) ? Math.abs(temp - 1f) % 1f : Math.abs(temp); if(temp < minDiff) { minDiff = temp; choice = i; } } choice /= 6; // rounds down return new Color(r, g, b, a).lerp(state[choice * 6], state[choice * 6 + 1], state[choice * 6 + 2], state[choice * 6 + 3], state[choice * 6 + 4]); } }
public void draw(SpriteBatch batch) { // If we beat a new record, the cup color will linear interpolate to the high score color cupColor.lerp(isNewRecord() ? Klooni.theme.highScore : Klooni.theme.currentScore, 0.05f); batch.setColor(cupColor); batch.draw(cupTexture, cupArea.x, cupArea.y, cupArea.width, cupArea.height); int roundShown = MathUtils.round(shownScore); if (roundShown != currentScore) { shownScore = Interpolation.linear.apply(shownScore, currentScore, 0.1f); currentScoreLabel.setText(Integer.toString(MathUtils.round(shownScore))); } currentScoreLabel.setColor(Klooni.theme.currentScore); currentScoreLabel.draw(batch, 1f); highScoreLabel.setColor(Klooni.theme.highScore); highScoreLabel.draw(batch, 1f); }