00001 package org.hfbk.vis.visnode;
00002
00003 import java.awt.event.MouseEvent;
00004
00005 import org.dronus.gl.GLBoxRenderer;
00006 import org.dronus.graph.Node;
00007 import org.lwjgl.opengl.GL11;
00008 import org.lwjgl.util.vector.Vector3f;
00009
00017 public class VisTarget extends VisNodeMousable {
00018
00019 Vector3f target;
00020 float energy;
00021 VisBalistic balistic;
00022
00023 public VisTarget(Node dummy, Vector3f pos) {
00024 super(null, pos);
00025 radius=w=h=250;
00026 }
00027
00028 void handleEvent(VisMouseEvent evt) {
00029 int id=evt.awtEvent.getID();
00030 if (id==MouseEvent.MOUSE_DRAGGED || id==MouseEvent.MOUSE_PRESSED){
00031 target=evt.hit;
00032 balistic.target=traverse(balistic, target);
00033
00034 }
00035 }
00036
00037 @Override
00038 void transform() {
00039 super.transform();
00040 GL11.glRotatef(90,1,0,0);
00041 }
00042 @Override
00043 void renderSelf() {
00044 if(balistic==null){
00045 for (VisNode n: parent.children)
00046 if (n instanceof VisBalistic)
00047 balistic=(VisBalistic)n;
00048 if (balistic==null)
00049 parent.add(balistic=new VisBalistic(null, new Vector3f(0,20,50)));
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 if (target!=null){
00062 GL11.glColor3f(1,1,1);
00063
00064 GL11.glTranslatef(target.x, target.y, target.z);
00065 GLBoxRenderer.renderBox(1,1,1);
00066 }
00067
00068 }
00069 }