Class ViewJComponentLightBulbs


  • public class ViewJComponentLightBulbs
    extends java.lang.Object
    Holds parent BranchGroup and an array of 8 spheres that represent the lights on the surface.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.media.j3d.BranchGroup[] m_akLightArrows
      Arrows representing light bulb directions.
      private javax.media.j3d.BranchGroup[] m_akLightBG
      Parent of each light bulb.
      private javax.media.j3d.Material[] m_akLightMaterials
      Material properties for each light bulb.
      private com.sun.j3d.utils.geometry.Sphere[] m_akLightSpheres
      Shapes representing light bulbs.
      private javax.media.j3d.TransformGroup[] m_akLightTransformGroup
      Parent transform group.
      private javax.media.j3d.BranchGroup m_kLightRoot
      Parent of all the light bulbs.
      private javax.vecmath.Color3f s_kBlack
      A black sphere is off.
    • Constructor Summary

      Constructors 
      Constructor Description
      ViewJComponentLightBulbs​(int iNumLights, com.sun.j3d.utils.picking.PickCanvas pickCanvas)
      Create an array of light bulb objects that can be rendered or picked.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getPickedLight​(javax.media.j3d.Shape3D kPickedShape)
      Determine if a given shape is the sphere for one of the lights.
      javax.media.j3d.BranchGroup getRoot()
      Accessor that returns the root node for the light bulbs.
      void setLightAttributes​(int index, GeneralLight kLight)
      Update the properties of the specified light bulb.
      private void setLightColor​(int i, javax.vecmath.Color3f kColor)
      Set the light color.
      private void setLightDirection​(int i, javax.vecmath.Vector3f kDirection)
      The the light direction.
      private void setLightDirectional​(int i, boolean bDirectional)
      Enable the light direction arrow.
      private void setLightPosition​(int i, javax.vecmath.Point3f kPosition)
      The the light move positions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_akLightArrows

        private javax.media.j3d.BranchGroup[] m_akLightArrows
        Arrows representing light bulb directions.
      • m_akLightBG

        private javax.media.j3d.BranchGroup[] m_akLightBG
        Parent of each light bulb.
      • m_akLightMaterials

        private javax.media.j3d.Material[] m_akLightMaterials
        Material properties for each light bulb.
      • m_akLightSpheres

        private com.sun.j3d.utils.geometry.Sphere[] m_akLightSpheres
        Shapes representing light bulbs.
      • m_akLightTransformGroup

        private javax.media.j3d.TransformGroup[] m_akLightTransformGroup
        Parent transform group.
      • m_kLightRoot

        private javax.media.j3d.BranchGroup m_kLightRoot
        Parent of all the light bulbs.
      • s_kBlack

        private javax.vecmath.Color3f s_kBlack
        A black sphere is off.
    • Constructor Detail

      • ViewJComponentLightBulbs

        public ViewJComponentLightBulbs​(int iNumLights,
                                        com.sun.j3d.utils.picking.PickCanvas pickCanvas)
        Create an array of light bulb objects that can be rendered or picked.
        Parameters:
        iNumLights - int Number of lights to create in the array.
        pickCanvas - PickCanvas Used for picking a light from the array.
    • Method Detail

      • getPickedLight

        public int getPickedLight​(javax.media.j3d.Shape3D kPickedShape)
        Determine if a given shape is the sphere for one of the lights.
        Parameters:
        kPickedShape - Shape3D Reference to a picked shape.
        Returns:
        int Index of the corresponding light object in the array, or -1 if picked shape does not correspond to any light object.
      • getRoot

        public javax.media.j3d.BranchGroup getRoot()
        Accessor that returns the root node for the light bulbs.
        Returns:
        Root node that holds light bulbs.
      • setLightAttributes

        public void setLightAttributes​(int index,
                                       GeneralLight kLight)
        Update the properties of the specified light bulb.
        Parameters:
        index - int Index of the bulb in the array.
        kLight - GeneralLight Contains properties which describe the light.
      • setLightColor

        private void setLightColor​(int i,
                                   javax.vecmath.Color3f kColor)
        Set the light color.
        Parameters:
        i - light index
        kColor - light color
      • setLightDirection

        private void setLightDirection​(int i,
                                       javax.vecmath.Vector3f kDirection)
        The the light direction.
        Parameters:
        i - light index
        kDirection - lighting direction
      • setLightDirectional

        private void setLightDirectional​(int i,
                                         boolean bDirectional)
        Enable the light direction arrow.
        Parameters:
        i - light index
        bDirectional - show direction arrow or not.
      • setLightPosition

        private void setLightPosition​(int i,
                                      javax.vecmath.Point3f kPosition)
        The the light move positions.
        Parameters:
        i - light index
        kPosition - position coordinate