View Javadoc
1 /***************************************************************************** 2 * Virtual Mockup for Machine Vision 3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr., 4 * Carlos S. Santos. 5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP 6 * 7 * Permission is granted to redistribute and/or modify this 8 * software under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html) 16 * for more details. 17 * 18 *****************************************************************************/ 19 20 package camera3d; 21 22 import javax.media.j3d.*; 23 import javax.vecmath.*; 24 25 /*** 26 * Represents an ambient light. 27 * @author Fábio Roberto de Miranda 28 * @version 1.0 29 */ 30 public class VcAmbientLight extends VcLight { 31 32 private static int instanceCounter = 0; 33 private AmbientLight ambientLight; 34 35 public VcAmbientLight() { 36 ambientLight = new AmbientLight(); 37 this.pivotTG.addChild(ambientLight); 38 this.color = new Color3f(); 39 this.setLabel("AmbientLight"+this.instanceCounter++); 40 } 41 42 /*** 43 * Returns the number of objects instatiated so far. 44 */ 45 public static int getInstanceCounter(){ 46 return instanceCounter; 47 } 48 49 /*** 50 * Returns ambient light. 51 */ 52 public Light getJ3DLight(){ 53 return this.ambientLight; 54 } 55 56 /*** 57 * Sets the state (on/off) of this light. 58 */ 59 public void setEnable(boolean enabled){ 60 this.ambientLight.setEnable(enabled); 61 } 62 63 /*** 64 * Sets the color of this light. 65 * @param r Red component of color. 66 * @param g Green component of color. 67 * @param b Blue component of color. 68 */ 69 public void setColor(float r, float g, float b){ 70 this.color.set(r, g, b); 71 this.ambientLight.setColor(color); 72 } 73 74 /*** 75 * Sets the ambient light. 76 */ 77 public void setJ3DLight(Light light){ 78 if (light instanceof AmbientLight){ 79 pivotTG.removeChild(ambientLight); 80 ambientLight = (AmbientLight)light; 81 } 82 } 83 }

This page was automatically generated by Maven