home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / 04_02Lights / 04_02Lights.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-10  |  2.7 KB  |  76 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "04_02 Lights"
  4.    ClientHeight    =   4695
  5.    ClientLeft      =   915
  6.    ClientTop       =   1230
  7.    ClientWidth     =   4560
  8.    Height          =   5070
  9.    Left            =   855
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4695
  12.    ScaleWidth      =   4560
  13.    Top             =   915
  14.    Width           =   4680
  15.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  16.       Height          =   4692
  17.       Left            =   0
  18.       TabIndex        =   0
  19.       Top             =   0
  20.       Width           =   4572
  21.       _Version        =   131072
  22.       _ExtentX        =   8065
  23.       _ExtentY        =   8276
  24.       _StockProps     =   0
  25.    End
  26. Attribute VB_Name = "Form1"
  27. Attribute VB_Creatable = False
  28. Attribute VB_Exposed = False
  29. Private Sub Form_Initialize()
  30.     Dim root As SoSeparator
  31.     Set root = New SoSeparator
  32.     'Add a directional light
  33.     Dim myDirLight As SoDirectionalLight
  34.     Set myDirLight = New SoDirectionalLight
  35.     Call myDirLight.direction.setValue(0, -1, -1)
  36.     Call myDirLight.Color.setValue(1#, 0#, 0#)
  37.     Call root.addChild(myDirLight)
  38.     'Put the shuttle and the light below a transform separator.
  39.     'A transform separator pushes and pops the transformation
  40.     'just like a separator node, but other aspects of the state
  41.     'are not pushed and popped. So the shuttle's translation
  42.     'will affect only the light. But the light will shine on
  43.     'the rest of the scene.
  44.     Dim myTransformSeparator As SoTransformSeparator
  45.     Set myTransformSeparator = New SoTransformSeparator
  46.     Call root.addChild(myTransformSeparator)
  47.     'A shuttle node translates back and forth between the two
  48.     'fields translation0 and translation1.
  49.     'This moves the light.
  50.     Dim myShuttle As SoShuttle
  51.     Set myShuttle = New SoShuttle
  52.     Call myTransformSeparator.addChild(myShuttle)
  53.     Call myShuttle.translation0.setValue(-2, -1, 3)
  54.     Call myShuttle.translation1.setValue(1, 2, -3)
  55.     'Add the point light below the transformSeparator
  56.     Dim myPointLight As SoPointLight
  57.     Set myPointLight = New SoPointLight
  58.     Call myTransformSeparator.addChild(myPointLight)
  59.     Call myPointLight.Color.setValue(0, 1, 0)
  60.     Dim myCone As SoCone
  61.     Set myCone = New SoCone
  62.     Call root.addChild(myCone)
  63.     Call V3Space1.setSceneRoot(root)
  64.     Call V3Space1.viewAll
  65.     Call V3Space1.setHeadlight(False)
  66.     Call V3Space1.setDecorations(False)
  67.     'Clean Up
  68.     Set myDirLight = Nothing
  69.     Set myTransformSeparator = Nothing
  70.     Set myShuttle = Nothing
  71.     Set myPointLight = Nothing
  72.     Set myCone = Nothing
  73.     Set sceneRoot = Nothing
  74.     Set root = Nothing
  75. End Sub
  76.