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

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "04_01 Camera"
  4.    ClientHeight    =   5910
  5.    ClientLeft      =   945
  6.    ClientTop       =   1740
  7.    ClientWidth     =   6480
  8.    Height          =   6285
  9.    Left            =   885
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5910
  12.    ScaleWidth      =   6480
  13.    Top             =   1425
  14.    Width           =   6600
  15.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  16.       Height          =   5895
  17.       Left            =   0
  18.       TabIndex        =   0
  19.       Top             =   0
  20.       Width           =   6495
  21.       _Version        =   131072
  22.       _ExtentX        =   11456
  23.       _ExtentY        =   10398
  24.       _StockProps     =   0
  25.       decorationOn    =   0   'False
  26.    End
  27. Attribute VB_Name = "Form1"
  28. Attribute VB_Creatable = False
  29. Attribute VB_Exposed = False
  30. Private Sub Form_Initialize()
  31.     Dim root As SoSeparator
  32.     Set root = New SoSeparator
  33.     'Create a blinker node and put it in the scene. A blinker
  34.     ' switches between its children at timed intervals.
  35.     Dim myBlinker As SoBlinker
  36.     Set myBlinker = New SoBlinker
  37.     myBlinker.On.setValue (False)
  38.     Call root.addChild(myBlinker)
  39.     'Create two cameras. Their positions will be set later.
  40.     Dim perspViewAll As SoPerspectiveCamera
  41.     Set perspViewAll = New SoPerspectiveCamera 'V3Space1.createPerspectiveCamera("perspViewAll")
  42.     Dim perspOffCenter As SoOrthographicCamera
  43.     Set perspOffCenter = New SoOrthographicCamera 'V3Space1.createPerspectiveCamera("perspOffCenter")
  44.     'Read the object from a file and add to the scene
  45.     Dim myInput As SoInput
  46.     Set myInput = New SoInput
  47.     Dim benchRoot As SoGroup
  48.     Set benchRoot = myInput.readAllUrl(V3Space1.getRegistryDataPath() + "\examples\data\parkbench.iv", V3Space1.GetIDispatch())
  49.     Dim myMaterial As SoMaterial
  50.     Set myMaterial = New SoMaterial
  51.     Call myMaterial.diffuseColor.setValue(1#, 1#, 0#)
  52.     Call root.addChild(myMaterial)
  53.     Call root.addChild(benchRoot)
  54.     Call V3Space1.setSceneRoot(root)
  55.     'Current camera in the control is perspOffCenter
  56.     Call V3Space1.setCurrentCamera(perspOffCenter)
  57.     Call V3Space1.viewAll
  58.     Dim x As Single
  59.     Dim y As Single
  60.     Dim z As Single
  61.     Call perspOffCenter.position.getValue(x, y, z)
  62.     Call perspOffCenter.position.setValue(x + x / 2, y + y / 2, z + z / 4)
  63.     'change cameras in the control
  64.     Call V3Space1.setCurrentCamera(perspViewAll)
  65.     Call V3Space1.viewAll
  66.     Call myBlinker.addChild(perspViewAll)
  67.     Call myBlinker.addChild(perspOffCenter)
  68.     myBlinker.On.setValue (True)
  69.     Set root = Nothing
  70.     Set myBlinker = Nothing
  71.     Set perspViewAll = Nothing
  72.     Set perspOffCenter = Nothing
  73.     Set myInput = Nothing
  74.     Set benchRoot = Nothing
  75.     Set myMaterial = Nothing
  76. End Sub
  77.