Listing 1

------------------------------------------------------
--3D DEBUG LINE
------------------------------------------------------
property p_vPosA    -- position A of line
property p_vPosB    -- position B of line
property p_mshMesh  -- line mesh
property p_mModel   -- line model

-------------------------------------------------------
-- ThreeDLine::New()
-------------------------------------------------------
-- Purpose: 
-- a_sName     - string name of the line to be created
-- a_aColor    - array of 2 rgb colors [start, end]
-- a_vPoint1   - vector start of line
-- a_vPoint2   - vector end of line
-- a_shShader  - shader to be applied to the line
-------------------------------------------------------
on new me, a_sName, a_aColor, a_vPoint1, \
           a_vPoint2, a_shShader, a_3dWorld

  me.p_vPosA = a_vPoint1
  me.p_vPosB = a_vPoint2

  --create a mesh for this connector
  if voidP(a_3dWorld.model(a_sName)) then

    --continue
  else
    return 0
  end if
  
  me.p_mshMesh = a_3dWorld.newMesh(a_sName,1,3,3,3,0)
  
  --set color list
  me.p_mshMesh.colorList  = [ a_aColor[1], \
                              a_aColor[2], \
                              a_aColor[1] ]
  
  --set vertex list
  me.p_mshMesh.vertexList = [ vector(0,0,0), \
                              vector(0,100,0), \
                              vector(100,100,0) ]
  
  --set normal list
  --NOTE: this is a hack, normals here make ok
  --lines, but are not technically correct for 3D
  --lighting...
  me.p_mshMesh.normalList = [ vector(1,1,1), \
                              vector(1,1,1), \
                              vector(1,1,1) ]
  
  --set the vertices and colors into the mesh
  me.p_mshMesh.face[1].vertices = [1,2,3]
  me.p_mshMesh.face[1].colors = list(1,2,3)
  
  --build the triangle
  me.p_mshMesh.build()
  
  --create a model from our triangle
  me.p_mModel = a_3dWorld.newModel(a_sName, \
                me.p_mshMesh)
  
  
  --set render ops for best debug lines
  me.p_mModel.visibility = #both
  
  --set shader on this model
  me.p_mModel.shader = a_shShader
  
  me.mUpdate(me.p_vPosA, me.p_vPosB)
  
  return me
end ThreeDLine
-------------------------------------------------------


-------------------------------------------------------
-- ThreeDLine::mUpdate()
-------------------------------------------------------
-- a_vPointA  - vector new start position
-- a_vPointB  - vector new end position
-------------------------------------------------------
on mUpdate me, a_vPointA, a_vPointB
  -- make the connector position itself between the A
  -- and B parent nodes.  This is a little but tricky.
  me.p_vPosA = a_vPointA
  me.p_vPosB = a_vPointB
  
  vPosC = vector( me.p_vPosA.x, \
                  me.p_vPosA.y - 2.000, \
                  me.p_vPosA.z - 2.000)
  
  me.p_mshMesh.vertexList = [me.p_vPosA, \
                             me.p_vPosB, \
                             vPosC]
end mUpdate


Listing 2

//--- --------------------------------------------------
function ThreeDLine(a_sName, a_aColor,
                    a_vPoint1, a_vPoint2) {

  this.p_vPosA = a_vPoint1;
  this.p_vPosB = a_vPoint2;
  
  //create a mesh for this connector
  this.p_mshMesh = _global.D3D_WORLD.getProp(
           "g_3DWorld").newMesh(a_sName,1,3,3,3,0);

  //set color list
  this.p_mshMesh.colorList  = list( a_aColor[1],
                                    a_aColor[2 ],
                                    a_aColor[2]);
  
  //set vertex list
  this.p_mshMesh.vertexList = list(vector(0,0,0),
                                   vector(0,100,0),
                                   vector(100,100,0));
  
  //set normal list
  //NOTE: this is a hack, normals here make ok
  //lines, but are not technically correct for 3D
  //lighting...
  this.p_mshMesh.normalList = list( vector(0,1,0),
                                    vector(0,1,0),
                                    vector(0,1,0));


  //set the vertices and colors into the mesh
  //NOTE: Need to use getPropRef to parse the lingo
  //arrays that are embedded in the S3D Xtra
  this.p_oFace = this.p_mshMesh.getPropRef("face",1)
  this.p_oFace.vertices = list(1,2,3);
  this.p_oFace.getPropRef("face", 1).colors =
                                  list(1,2,3);

  //build the triangle
  //this.p_mshMesh.generateNormals(symbol("flat"));
  this.p_mshMesh.build();


  //create a model from our triangle
  this.p_mModel = _global.D3D_WORLD.getProp(
   "g_3DWorld").newModel(this.p_sName, this.p_mshMesh);

  
  this.p_mModel.shader = _global.D3D_WORLD.getProp(
                      "g_3DWorld").getProp("shader",1);
  

  this.p_mModel.shader.shininess = 0;
  this.p_mModel.shader.blend = 10;
  this.p_mModel.shader.texture = 0;
  this.p_mModel.shader.emissive = color(50,50,50);
  
  this.mUpdate(this.p_vPosA, this.p_vPosB);
  
  return this;
}

/*-----------------------------------------------------
Connector::mUpdate

-----------------------------------------------------*/
ThreeDLine.prototype.mUpdate = function(a_vA, a_vB) {


    //make the connector position itself between
    //the A and B parent nodes.

    this.p_vPosA = a_vA;
    this.p_vPosB = a_vB;

    var vPosC = vector( vPosA.x,
                        vPosA.y - 2.000,
                        vPosA.z - 2.000);
 
    this.p_mshMesh.vertexList = list(vPosA,
                                     vPosB,
                                     vPosC);

}
//-----------------------------------------------------