49 public void render(
float alphaMult) {
50 if (alphaMult <= 0)
return;
52 float bandWidthInTexture = delegate.getAuroraBandWidthInTexture();
55 float radStart = delegate.getAuroraInnerRadius();
56 float radEnd = delegate.getAuroraOuterRadius();;
58 if (radEnd < radStart + 10f) radEnd = radStart + 10f;
60 float circ = (float) (Math.PI * 2f * (radStart + radEnd) / 2f);
61 float pixelsPerSegment = 50f;
62 float segments = Math.round(circ / pixelsPerSegment);
64 float startRad = (float) Math.toRadians(0);
65 float endRad = (float) Math.toRadians(360f);
66 float spanRad = Math.abs(endRad - startRad);
67 float anglePerSegment = spanRad / segments;
69 Vector2f loc = delegate.getAuroraCenterLoc();
75 GL11.glTranslatef(x, y, 0);
77 GL11.glEnable(GL11.GL_TEXTURE_2D);
80 delegate.getAuroraTexture().bindTexture();
82 GL11.glEnable(GL11.GL_BLEND);
83 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
85 float thickness = (radEnd - radStart) * 1f;
86 float radius = radStart;
88 float texProgress = 0f;
89 float texHeight = delegate.getAuroraTexture().getTextureHeight();
90 float imageHeight = delegate.getAuroraTexture().getHeight();
91 float texPerSegment = pixelsPerSegment * texHeight / imageHeight * bandWidthInTexture / thickness;
93 texPerSegment *= delegate.getAuroraTexPerSegmentMult();
95 float totalTex = Math.max(1f, Math.round(texPerSegment * segments));
96 texPerSegment = totalTex / segments;
98 float texWidth = delegate.getAuroraTexture().getTextureWidth();
99 float imageWidth = delegate.getAuroraTexture().getWidth();
114 for (
int iter = 0; iter < 2; iter++) {
121 float leftTX = (float) bandIndex * texWidth * bandWidthInTexture / imageWidth;
122 float rightTX = (float) (bandIndex + 1f) * texWidth * bandWidthInTexture / imageWidth - 0.001f;
124 GL11.glBegin(GL11.GL_QUAD_STRIP);
125 for (
float i = 0; i < segments + 1; i++) {
127 float segIndex = i % (int) segments;
132 phaseAngleRad = (float) Math.toRadians(phaseAngle) + (segIndex * anglePerSegment * 10f);
134 phaseAngleRad = (float) Math.toRadians(-phaseAngle) + (segIndex * anglePerSegment * 5f);
138 float angle = (float) Math.toDegrees(segIndex * anglePerSegment);
139 if (iter == 1) angle += 180;
141 float blockerMax = 100000f;
142 if (blocker !=
null) {
152 float pulseSin = (float) Math.sin(phaseAngleRad);
154 float pulseMax = thickness * delegate.getAuroraShortenMult(angle);
159 if (pulseMax > blockerMax * 0.5f) {
160 pulseMax = blockerMax * 0.5f;
162 float pulseAmount = pulseSin * pulseMax;
163 float pulseInner = pulseAmount * 0.1f;
164 pulseInner *= delegate.getAuroraInnerOffsetMult(angle);
170 float thicknessMult = delegate.getAuroraThicknessMult(angle);
171 float thicknessFlat = delegate.getAuroraThicknessFlat(angle);
173 float theta = anglePerSegment * segIndex;;
174 float cos = (float) Math.cos(theta);
175 float sin = (float) Math.sin(theta);
177 float rInner = r - pulseInner;
178 if (rInner < r * 0.9f) rInner = r * 0.9f;
180 float rOuter = (r + thickness * thicknessMult - pulseAmount + thicknessFlat);
182 if (blocker !=
null) {
183 if (rOuter > blockerMax - pulseAmount) {
186 rOuter = blockerMax - pulseAmount;
188 if (rOuter < r) rOuter = r;
190 if (rInner > rOuter) {
195 float x1 = cos * rInner;
196 float y1 = sin * rInner;
197 float x2 = cos * rOuter;
198 float y2 = sin * rOuter;
200 x2 += (float) (Math.cos(phaseAngleRad) * pixelsPerSegment * 0.33f);
201 y2 += (float) (Math.sin(phaseAngleRad) * pixelsPerSegment * 0.33f);
203 Color color = delegate.getAuroraColorForAngle(angle);
204 float alpha = delegate.getAuroraAlphaMultForAngle(angle);
205 if (blocker !=
null) {
210 GL11.glColor4ub((
byte)color.getRed(),
211 (byte)color.getGreen(),
212 (byte)color.getBlue(),
213 (byte)((
float) color.getAlpha() * alphaMult * alpha));
215 GL11.glTexCoord2f(leftTX, texProgress);
216 GL11.glVertex2f(x1, y1);
217 GL11.glTexCoord2f(rightTX, texProgress);
218 GL11.glVertex2f(x2, y2);
220 texProgress += texPerSegment * 1f;
224 GL11.glRotatef(180, 0, 0, 1);
234 float radStart = delegate.getAuroraInnerRadius();
235 float radEnd = delegate.getAuroraOuterRadius();
236 if (radEnd < radStart + 10f) radEnd = radStart + 10f;
238 float angleRad = (float) Math.toRadians(angle);
240 float thickness = (radEnd - radStart) * 1f;
241 float radius = radStart;
245 for (
int i = 0; i < 2; i++) {
248 phaseAngleRad = (float) Math.toRadians(phaseAngle) + (angleRad * 10f);
250 phaseAngleRad = (float) Math.toRadians(-phaseAngle) + (angle * 5f);
254 float blockerMax = 100000f;
255 if (blocker !=
null) {
263 float pulseSin = (float) Math.sin(phaseAngleRad);
264 float pulseMax = thickness * delegate.getAuroraShortenMult(angle);
265 if (pulseMax > blockerMax * 0.5f) {
266 pulseMax = blockerMax * 0.5f;
268 float pulseAmount = pulseSin * pulseMax;
270 float thicknessMult = delegate.getAuroraThicknessMult(angle);
271 float thicknessFlat = delegate.getAuroraThicknessFlat(angle);
273 float rOuter = (radius + thickness * thicknessMult - pulseAmount + thicknessFlat);
275 if (blocker !=
null) {
276 if (rOuter > blockerMax - pulseAmount) {
277 rOuter = blockerMax - pulseAmount;
278 if (rOuter < radius) rOuter = radius;
281 if (rOuter > max) max = rOuter;