home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / 14_2Editors / 14_2Editors.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-12-01  |  4.4 KB  |  114 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "14_2 Editors"
  4.    ClientHeight    =   6630
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1425
  7.    ClientWidth     =   6750
  8.    Height          =   7005
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   6630
  12.    ScaleWidth      =   6750
  13.    Top             =   1110
  14.    Width           =   6870
  15.    Begin VB.Label Label1 
  16.       Caption         =   $"14_2Editors.frx":0000
  17.       BeginProperty Font 
  18.          name            =   "MS Sans Serif"
  19.          charset         =   0
  20.          weight          =   700
  21.          size            =   12
  22.          underline       =   0   'False
  23.          italic          =   0   'False
  24.          strikethrough   =   0   'False
  25.       EndProperty
  26.       Height          =   1695
  27.       Left            =   120
  28.       TabIndex        =   1
  29.       Top             =   120
  30.       Width           =   6375
  31.    End
  32.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  33.       Height          =   4575
  34.       Left            =   120
  35.       TabIndex        =   0
  36.       Top             =   2040
  37.       Width           =   6495
  38.       _Version        =   131072
  39.       _ExtentX        =   11456
  40.       _ExtentY        =   8070
  41.       _StockProps     =   0
  42.       decorationOn    =   0   'False
  43.       headlightOn     =   0   'False
  44.    End
  45. Attribute VB_Name = "Form1"
  46. Attribute VB_Creatable = False
  47. Attribute VB_Exposed = False
  48.     Dim ltEditor As SoWinDirectionalLightEditor
  49.     Dim mtlEditor As SoWinMaterialEditor
  50. Private Sub Form_Initialize()
  51.     'SCENE!
  52.     Dim myScene As SoSceneKit
  53.     Set myScene = New SoSceneKit
  54.     'LIGHTS! Add an SoLightKit to the "lightList." The
  55.     'SoLightKit creates an SoDirectionalLight by default.
  56.     Static myLightKit As SoLightKit
  57.     Set myLightKit = New SoLightKit
  58.     Call myScene.setPart(utlSbName("lightList[0]"), myLightKit)
  59.     'CAMERA!! Add an SoCameraKit to the "cameraList." The
  60.     'SoCameraKit creates an SoPerspectiveCamera by default.
  61.     Dim myCameraKit As SoCameraKit
  62.     Set myCameraKit = New SoCameraKit
  63.     Call myScene.setPart(utlSbName("cameraList[0]"), myCameraKit)
  64.     Call myScene.setCameraNumber(0)
  65.     'Read an object from file.
  66.     Dim fileContents As Object
  67.     Set fileContents = utlReadFile(V3Space1.getRegistryDataPath() + "\examples\data\desk.iv", V3Space1.GetIDispatch())
  68.     Set fileContents = utlStripGroup(fileContents)
  69.     'OBJECT!! Create an SoWrapperKit and set its contents to
  70.     'be what you read from file.
  71.     Dim myDesk As SoWrapperKit
  72.     Set myDesk = New SoWrapperKit
  73.     Call myDesk.setPart(utlSbName("contents"), fileContents)
  74.     Call myScene.setPart(utlSbName("childList[0]"), myDesk)
  75.     'Give the desk a good starting color
  76.     Call myDesk.setParam("material { diffuseColor .8 .3 .1 }")
  77.     'MATERIAL EDITOR!!  Attach it to myDesk's material node.
  78.     'Use the SO_GET_PART macro to get this part from myDesk.
  79.     Set mtlEditor = New SoWinMaterialEditor
  80.     Dim mtl As SoMaterial
  81.     Set mtl = New SoMaterial
  82.     Set mtl = myDesk.SoGetPart(myDesk, utlSbName("material"), mtl.getClassTypeId())
  83.     'mtlEditor->setTitle("Material of Desk");
  84.     Call mtlEditor.Show
  85.     Call mtlEditor.attach(mtl, 0)
  86.     'DIRECTIONAL LIGHT EDITOR!! Attach it to the
  87.     'SoDirectionalLight node within the SoLightKit we made.
  88.     Set ltEditor = New SoWinDirectionalLightEditor
  89.         
  90.     Static ltPath As SoPath
  91.     Set ltPath = myScene.createPathToPart(utlSbName("lightList[0].light"), True, Nothing)
  92.     Call ltEditor.Show
  93.     Call ltEditor.attach(ltPath)
  94.     'Set up Camera with ViewAll...
  95.     '-- use the SO_GET_PART macro to get the camera node.
  96.     '-- viewall is a method on the 'camera' part of
  97.     'the cameraKit, not on the cameraKit itself.  So the part
  98.     'we ask for is not 'cameraList[0]' (which is of type
  99.     'SoPerspectiveCameraKit), but
  100.     'cameraList[0].camera' (which is of type
  101.     '    SoPerspectiveCamera).
  102.     Dim myCamera As SoPerspectiveCamera
  103.     Set myCamera = New SoPerspectiveCamera
  104.     Set myCamera = myScene.SoGetPart(myScene, utlSbName("cameraList[0].camera"), myCamera.getClassTypeId())
  105.     Call myCamera.viewAll(myScene, V3Space1.getViewportRegion(), 1#)
  106.     Call V3Space1.setSceneRoot(myScene)
  107.     Call V3Space1.setCurrentCamera(myCamera)
  108.     Call V3Space1.viewAll
  109. End Sub
  110. Private Sub Form_Terminate()
  111.     Call ltEditor.Hide
  112.     Call mtlEditor.Hide
  113. End Sub
  114.