Skip to content

Commit

Permalink
WIP #12: For now, DAMCONs are blue and bigger spheres
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmaxfrank committed Jan 31, 2016
1 parent e157eef commit 8465b59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import javax.media.j3d.*;
import javax.vecmath.*;
import java.util.Objects;

public class InternalNode extends InternalSelectable {
private VesselNode vesselNode;

public InternalNode(VesselNode vessel_node) {
alpha = 0.4f;
radius = 0.05f;

this.vesselNode = vessel_node;

Expand All @@ -23,7 +23,7 @@ public InternalNode(VesselNode vessel_node) {
Vector3f pos = new Vector3f(-vessel_node.getX(), vessel_node.getY(), vessel_node.getZ());
pos.scale(SCALE);

sphere = new Sphere(RADIUS, appearanceFromHealthPercentage());
sphere = new Sphere(radius, appearanceFromHealthPercentage());
sphere.getShape(Sphere.BODY).setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

Transform3D transform = new Transform3D();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import java.awt.*;

public abstract class InternalSelectable extends Internal {
protected static final float RADIUS = 0.05f;
protected static final float SHININESS = 0f;
protected static final Color3f BLACK = new Color3f(0f, 0f, 0f), WHITE = new Color3f(1f, 1f, 1f);
private static final float TRANSPARENT = 1f, OPAQUE = 0f;

protected boolean hovered = false;
protected float healthPct = 1f;

protected float radius;
protected Sphere sphere;
protected BranchGroup branchGroup;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ public class InternalTeam extends InternalSelectable {
private EnhancedDamconStatus status;
protected boolean selected = false;

private Color3f DAMCON_COLOR = new Color3f(0f, 0f, 1f);

// TODO: use a Box instead of a sphere or something (set every side to be pickable or use billboards)

public InternalTeam(EngineeringConsoleManager.EnhancedDamconStatus damcon_status) {
this.status = damcon_status;

alpha = 0.25f;
radius = 0.075f;

this.branchGroup = new BranchGroup();

this.sphere = new Sphere(RADIUS, appearanceFromHealthPercentage());
this.sphere = new Sphere(radius, appearanceFromHealthPercentage());

Shape3D shape = this.sphere.getShape(Sphere.BODY);
shape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
Expand All @@ -50,6 +53,11 @@ public void updateHealth(float pct) {
sphere.setAppearance(appearanceFromHealthPercentage());
}

@Override
protected Color3f getColorFromHealth(float pct) {
return DAMCON_COLOR;
}

@Override
public void setSelected(boolean selected) {
if (selected) {
Expand Down

0 comments on commit 8465b59

Please sign in to comment.