Code cleanup
This commit is contained in:
parent
0d0135fb96
commit
2aa83bdb9a
1 changed files with 3 additions and 2 deletions
|
@ -3,6 +3,7 @@ package cr0s.warpdrive.api;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
public interface IBeamFrequency {
|
||||
|
||||
int BEAM_FREQUENCY_SCANNING = 1420;
|
||||
int BEAM_FREQUENCY_MIN = 0;
|
||||
int BEAM_FREQUENCY_MAX = 65000;
|
||||
|
@ -15,7 +16,7 @@ public interface IBeamFrequency {
|
|||
void setBeamFrequency(final int beamFrequency);
|
||||
|
||||
static Vector3 getBeamColor(final int beamFrequency) {
|
||||
float r, g, b;
|
||||
final float r, g, b;
|
||||
if (beamFrequency <= BEAM_FREQUENCY_MIN) { // invalid frequency
|
||||
r = 1.0F;
|
||||
g = 0.0F;
|
||||
|
@ -45,7 +46,7 @@ public interface IBeamFrequency {
|
|||
g = 0.0F;
|
||||
b = 0.5F - 0.5F * (beamFrequency - 50000F) / 10000F;
|
||||
} else if (beamFrequency <= BEAM_FREQUENCY_MAX) { // rainbow
|
||||
int component = Math.round(4096F * (beamFrequency - 60000F) / (BEAM_FREQUENCY_MAX - 60000F));
|
||||
final int component = Math.round(4096F * (beamFrequency - 60000F) / (BEAM_FREQUENCY_MAX - 60000F));
|
||||
r = 1.0F - 0.5F * (component & 0xF);
|
||||
g = 0.5F + 0.5F * (component >> 4 & 0xF);
|
||||
b = 0.5F + 0.5F * (component >> 8 & 0xF);
|
||||
|
|
Loading…
Reference in a new issue