00001 package org.hfbk.vis.visnode;
00002
00003 import org.dronus.gl.GLSphereRenderer;
00004 import org.dronus.graph.Node;
00005 import org.lwjgl.opengl.GL11;
00006 import org.lwjgl.util.vector.Vector3f;
00007
00014 public class VisAtom extends VisNode {
00015
00016 char type;
00017
00018 public VisAtom(Node n, Vector3f dummy) {
00019 super(n, new Vector3f());
00020 String[] args=n.text.split(" ");
00021 position=new Vector3f(
00022 Float.parseFloat(args[1]),
00023 Float.parseFloat(args[2]),
00024 Float.parseFloat(args[3])
00025 );
00026 type=args[0].charAt(0);
00027
00028 switch(type){
00029 case 'C': radius=.8f; break;
00030 case 'N': radius=.4f;break;
00031 case 'O': radius=.5f; break;
00032 default: radius=.3f;
00033 }
00034 }
00035
00039 void renderSelf() {
00040
00041 switch(type){
00042 case 'C': GL11.glColor3f(.1f,.1f,.1f); break;
00043 case 'N': GL11.glColor3f(.1f,.1f,.9f); break;
00044 case 'O': GL11.glColor3f(.9f,.1f,.1f); break;
00045 case 'H': GL11.glColor3f(.9f,.9f,.9f); break;
00046 }
00047 GLSphereRenderer.renderSphere(radius);
00048 }
00049
00050 }