home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "03_01 Molecule"
- ClientHeight = 4905
- ClientLeft = 915
- ClientTop = 1230
- ClientWidth = 5670
- Height = 5280
- Left = 855
- LinkTopic = "Form1"
- ScaleHeight = 4905
- ScaleWidth = 5670
- Top = 915
- Width = 5790
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 4932
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 5652
- _Version = 131072
- _ExtentX = 9970
- _ExtentY = 8700
- _StockProps = 0
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Public Function makeWaterMolecule()
- ' Construct all parts
- Dim waterMolecule As SoGroup
- Set waterMolecule = New SoGroup 'water molecule
- Dim oxygen As SoGroup
- Set oxygen = New SoGroup 'oxygen atom
- Dim redPlastic As SoMaterial
- Set redPlastic = New SoMaterial
- Dim sphere1 As SoSphere
- Set sphere1 = New SoSphere
- Dim hydrogen1 As SoGroup ' hydrogen atoms
- Set hydrogen1 = New SoGroup
- Dim hydrogen2 As SoGroup
- Set hydrogen2 = New SoGroup
- Dim hydrogenXform1 As SoTransform
- Set hydrogenXform1 = New SoTransform
- Dim hydrogenXform2 As SoTransform
- Set hydrogenXform2 = New SoTransform
- Dim whitePlastic As SoMaterial
- Set whitePlastic = New SoMaterial
- Dim sphere2 As SoSphere
- Set sphere2 = New SoSphere
- Dim sphere3 As SoSphere
- Set sphere3 = New SoSphere
-
- 'Set all field values for the oxygen atom
- Dim color As SbVec3f
- Set color = New SbVec3f
- Call color.setValue(1#, 0#, 0#)
- Call redPlastic.ambientColor.setValueColor(color)
- Call redPlastic.diffuseColor.setValueColor(color)
- Call color.setValue(0.5, 0.5, 0.5)
- Call redPlastic.specularColor.setValueColor(color)
- Call redPlastic.shininess.setValue(0.5)
- 'Set all field values for the hydrogen atoms
- Call hydrogenXform1.scaleFactor.setValue(0.75, 0.75, 0.75)
- Call hydrogenXform1.translation.setValue(0#, -1.2, 0#)
- Call hydrogenXform2.translation.setValue(1.1852, 1.3877, 0#)
- Call color.setValue(1#, 1#, 1#)
- Call whitePlastic.ambientColor.setValueColor(color)
- Call whitePlastic.diffuseColor.setValueColor(color)
- Call color.setValue(0.5, 0.5, 0.5)
- Call whitePlastic.specularColor.setValueColor(color)
- Call whitePlastic.shininess.setValue(0.5)
- 'Create a hierarchy
- Call waterMolecule.addChild(oxygen)
- Call waterMolecule.addChild(hydrogen1)
- Call waterMolecule.addChild(hydrogen2)
- Call oxygen.addChild(redPlastic)
- Call oxygen.addChild(sphere1)
- Call hydrogen1.addChild(hydrogenXform1)
- Call hydrogen1.addChild(whitePlastic)
- Call hydrogen1.addChild(sphere2)
- Call hydrogen2.addChild(hydrogenXform2)
- Call hydrogen2.addChild(sphere3)
- Set makeWaterMolecule = waterMolecule
- 'Clean up
- Set oxygen = Nothing
- Set redPlastic = Nothing
- Set sphere1 = Nothing
- Set hydrogen1 = Nothing
- Set hydrogen2 = Nothing
- Set hydrogenXform1 = Nothing
- Set hydrogenXform1 = Nothing
- Set whitePlastic = Nothing
- Set color = Nothing
- Set waterMolecule = Nothing
- End Function
- Private Sub Form_Initialize()
- Call V3Space1.deleteSceneGraph
- Dim molecule As SoGroup
- Set molecule = makeWaterMolecule()
- Call V3Space1.setSceneRoot(molecule)
- Call V3Space1.viewAll
- 'Clean up
- Set molecule = Nothing
- End Sub
-