61 public void render(CombatEngineLayers layer, ViewportAPI viewport) {
62 super.render(layer, viewport);
67 length1 = Math.min(length1, Misc.getDistance(
from.getLocation(),
to.getLocation()));
68 float length2 =
to.getShieldRadiusEvenIfNoShield();
69 if (length1 < length2) length1 = length2;
71 float w1 =
to.getShieldRadiusEvenIfNoShield() * 0.3f;
72 float w2 =
to.getShieldRadiusEvenIfNoShield() * 1.5f;
73 float w3 =
to.getShieldRadiusEvenIfNoShield() * 2.5f;
80 float angle = Misc.getAngleInDegrees(
from.getLocation(),
to.getLocation());
82 Vector2f dest =
new Vector2f(
to.getShieldCenterEvenIfNoShield());
83 Vector2f src = Misc.getUnitVectorAtDegreeAngle(angle + 180f);
84 src.scale(length1 - length2/2f);
85 Vector2f.add(src, dest, src);
87 Vector2f dir = Misc.getUnitVectorAtDegreeAngle(angle);
88 Vector2f dest2 =
new Vector2f(dir);
89 dest2.scale(length2/3f * 1f);
90 Vector2f.add(dest2, dest, dest2);
91 Vector2f dest1 =
new Vector2f(dir);
92 dest1.scale(-length2/3f * 2f);
93 Vector2f.add(dest1, dest, dest1);
96 Vector2f perp = Misc.getUnitVectorAtDegreeAngle(angle + 90);
98 GL11.glEnable(GL11.GL_TEXTURE_2D);
101 GL11.glEnable(GL11.GL_BLEND);
102 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
104 Color color =
new Color(0,121,216,255);
106 boolean wireframe =
false;
109 GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
110 GL11.glDisable(GL11.GL_TEXTURE_2D);
114 float alpha = (float) (viewport.getAlphaMult() * Math.sqrt(
fader.getBrightness()));
116 alpha *= (0.5f + Math.min(0.5f, 0.5f * w2 / 360f));
117 GL11.glBegin(GL11.GL_TRIANGLE_FAN);
118 Misc.setColor(color, alpha * 1f);
120 GL11.glVertex2f((src.x + dest1.x)/2f, (src.y + dest1.y)/2f);
122 Misc.setColor(color, alpha * 0f);
124 GL11.glVertex2f(src.x + perp.x * w1/2f, src.y + perp.y * w1/2f);
126 GL11.glVertex2f(src.x - perp.x * w1/2f, src.y - perp.y * w1/2f);
128 Misc.setColor(color, alpha * 1f);
130 GL11.glVertex2f(dest1.x - perp.x * w2/2f, dest1.y - perp.y * w2/2f);
132 GL11.glVertex2f(dest1.x + perp.x * w2/2f, dest1.y + perp.y * w2/2f);
134 Misc.setColor(color, alpha * 0f);
136 GL11.glVertex2f(src.x + perp.x * w1/2f, src.y + perp.y * w1/2f);
139 float th = length2 / length1;
141 GL11.glBegin(GL11.GL_TRIANGLE_FAN);
142 Misc.setColor(color, alpha * 1f);
144 GL11.glVertex2f((dest1.x + dest2.x)/2f, (dest1.y + dest2.y)/2f);
146 Misc.setColor(color, alpha * 1f);
148 GL11.glVertex2f(dest1.x + perp.x * w2/2f, dest1.y + perp.y * w2/2f);
150 GL11.glVertex2f(dest1.x - perp.x * w2/2f, dest1.y - perp.y * w2/2f);
152 Misc.setColor(color, alpha * 0f);
154 GL11.glVertex2f(dest2.x - perp.x * w3/2f, dest2.y - perp.y * w3/2f);
156 GL11.glVertex2f(dest2.x + perp.x * w3/2f, dest2.y + perp.y * w3/2f);
158 Misc.setColor(color, alpha * 1f);
160 GL11.glVertex2f(dest1.x + perp.x * w2/2f, dest1.y + perp.y * w2/2f);
163 if (wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);