64 Color bad = Misc.getNegativeHighlightColor();
65 Color gray = Misc.getGrayColor();
66 Color highlight = Misc.getHighlightColor();
68 String status =
" (off)";
73 LabelAPI title = tooltip.addTitle(
spec.getName() + status);
74 title.highlightLast(status);
75 title.setHighlightColor(gray);
80 tooltip.addPara(
"Reconfigures the fleet's drive field to act as a neutrino detector, " +
81 "allowing detection of human-made artifacts - and occasionally fleets - at extreme ranges. ", pad);
83 tooltip.addSectionHeading(
"Normal space", Alignment.MID, pad);
84 tooltip.addPara(
"High-emission sources such as stars, planets, jump-points, or space stations produce constant streams. " +
85 "Average sources produce periodic bursts. Low-emission sources produce occasional bursts.", pad);
87 tooltip.addPara(
"Notoriously unreliable and almost guaranteed to produce numerous false readings.", pad);
94 unit +=
" of " +
spec.getName().toLowerCase();
96 tooltip.addPara(
"Increases the range at which the fleet can be detected by %s and consumes %s " + unit +
" per day.",
102 tooltip.addPara(
"Increases the range at which the fleet can be detected by %s.",
109 tooltip.addSectionHeading(
"Hyperspace", Alignment.MID, pad);
110 tooltip.addPara(
"Reliably detects the presence of slipstreams out to a range of %s light-years. "
111 +
"Except for abyssal areas, the background noise levels are such that it is unable to detect any other neutrino sources. "
112 +
"When the fleet is traversing a slipstream, the detector is overwhelmed and shuts down.",
113 pad, highlight,
"" + maxRange);
114 if (Misc.isInsideSlipstream(
getFleet())) {
115 tooltip.addPara(
"Cannot activate while inside slipstream.", bad, pad);
224 public void render(CampaignEngineLayers layer, ViewportAPI viewport) {
226 if (
data ==
null)
return;
229 if (
level <= 0)
return;
231 if (!
getFleet().isPlayerFleet())
return;
233 float alphaMult = viewport.getAlphaMult() *
level;
250 float bandWidthInTexture = 256;
254 float radEnd = radStart + 75f;
256 float circ = (float) (Math.PI * 2f * (radStart + radEnd) / 2f);
258 float pixelsPerSegment = circ / 360f;
260 float segments = Math.round(circ / pixelsPerSegment);
266 float startRad = (float) Math.toRadians(0);
267 float endRad = (float) Math.toRadians(360f);
268 float spanRad = Math.abs(endRad - startRad);
269 float anglePerSegment = spanRad / segments;
271 Vector2f loc =
getFleet().getLocation();
277 GL11.glTranslatef(x, y, 0);
282 GL11.glEnable(GL11.GL_TEXTURE_2D);
287 GL11.glEnable(GL11.GL_BLEND);
289 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
291 boolean outlineMode =
false;
294 GL11.glDisable(GL11.GL_TEXTURE_2D);
295 GL11.glDisable(GL11.GL_BLEND);
296 GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
300 float thickness = (radEnd - radStart) * 1f;
301 float radius = radStart;
303 float texProgress = 0f;
304 float texHeight =
texture.getTextureHeight();
305 float imageHeight =
texture.getHeight();
306 float texPerSegment = pixelsPerSegment * texHeight / imageHeight * bandWidthInTexture / thickness;
310 float totalTex = Math.max(1f, Math.round(texPerSegment * segments));
311 texPerSegment = totalTex / segments;
313 float texWidth =
texture.getTextureWidth();
314 float imageWidth =
texture.getWidth();
318 Color color =
new Color(25,215,255,255);
322 for (
int iter = 0; iter < 2; iter++) {
329 texProgress = segments/2f * texPerSegment;
333 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
337 float leftTX = (float) bandIndex * texWidth * bandWidthInTexture / imageWidth;
338 float rightTX = (float) (bandIndex + 1f) * texWidth * bandWidthInTexture / imageWidth - 0.001f;
340 GL11.glBegin(GL11.GL_QUAD_STRIP);
341 for (
float i = 0; i < segments + 1; i++) {
343 float segIndex = i % (int) segments;
348 phaseAngleRad = (float) Math.toRadians(
phaseAngle) + (segIndex * anglePerSegment * 29f);
350 phaseAngleRad = (float) Math.toRadians(-
phaseAngle) + (segIndex * anglePerSegment * 17f);
354 float angle = (float) Math.toDegrees(segIndex * anglePerSegment);
358 float pulseSin = (float) Math.sin(phaseAngleRad);
359 float pulseMax = thickness * 0.5f;
361 pulseMax = thickness * 0.2f;
366 float pulseAmount = pulseSin * pulseMax;
368 float pulseInner = pulseAmount * 0.1f;
375 float theta = anglePerSegment * segIndex;;
376 float cos = (float) Math.cos(theta);
377 float sin = (float) Math.sin(theta);
379 float rInner = r - pulseInner;
383 float rOuter = r + thickness - pulseAmount;
391 if (grav > 750) grav = 750;
403 float alpha = alphaMult;
404 alpha *= 0.25f + Math.min(grav / 100, 0.75f);
417 float x1 = cos * rInner;
418 float y1 = sin * rInner;
419 float x2 = cos * rOuter;
420 float y2 = sin * rOuter;
422 x2 += (float) (Math.cos(phaseAngleRad) * pixelsPerSegment * 0.33f);
423 y2 += (float) (Math.sin(phaseAngleRad) * pixelsPerSegment * 0.33f);
426 GL11.glColor4ub((
byte)color.getRed(),
427 (byte)color.getGreen(),
428 (byte)color.getBlue(),
429 (byte)((
float) color.getAlpha() * alphaMult * alpha));
431 GL11.glTexCoord2f(leftTX, texProgress);
432 GL11.glVertex2f(x1, y1);
433 GL11.glTexCoord2f(rightTX, texProgress);
434 GL11.glVertex2f(x2, y2);
436 texProgress += texPerSegment * 1f;
445 GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);