-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP #12, etc.: Refactor of shared coloring and Internal code
- Loading branch information
1 parent
24659a4
commit ee612bd
Showing
8 changed files
with
87 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/com/brindyblitz/artemis/engconsole/ui/damcon/Internal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.brindyblitz.artemis.engconsole.ui.damcon; | ||
|
||
|
||
import com.brindyblitz.artemis.engconsole.ui.SystemStatusRenderer; | ||
import com.brindyblitz.artemis.engconsole.ui.SystemStatusSlider; | ||
import net.dhleong.acl.vesseldata.VesselNode; | ||
|
||
import javax.media.j3d.Appearance; | ||
import javax.media.j3d.Node; | ||
import javax.vecmath.Color3f; | ||
import javax.vecmath.Point3f; | ||
import java.awt.*; | ||
|
||
public abstract class Internal { | ||
protected static final float SCALE = 0.0034f; | ||
protected static final float SHININESS = 0f; | ||
protected float alpha; | ||
|
||
|
||
protected static Point3f vesselNodePosition(VesselNode vn) { | ||
Point3f p = new Point3f(-vn.getX(), vn.getY(), vn.getZ()); | ||
p.scale(SCALE); | ||
return p; | ||
} | ||
|
||
protected abstract Appearance appearanceFromHealthPercentage(float pct); | ||
public abstract void updateHealth(float pct); | ||
|
||
protected Color3f getColorFromHealth(float pct) { | ||
Color color = Color.getHSBColor( | ||
SystemStatusSlider.getEmptyHue(true) - (SystemStatusSlider.getEmptyHue(true) - SystemStatusSlider.getFullHue(true)) * pct, 1, 1); | ||
return new Color3f(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters