home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / 06_02Simple3DText / 06_02Simple3DText.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-10-13  |  4.1 KB  |  114 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "06_02 Simple 3D Text"
  4.    ClientHeight    =   4920
  5.    ClientLeft      =   915
  6.    ClientTop       =   1230
  7.    ClientWidth     =   5775
  8.    Height          =   5295
  9.    Left            =   855
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4920
  12.    ScaleWidth      =   5775
  13.    Top             =   915
  14.    Width           =   5895
  15.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  16.       Height          =   4932
  17.       Left            =   0
  18.       TabIndex        =   0
  19.       Top             =   0
  20.       Width           =   5772
  21.       _Version        =   131072
  22.       _ExtentX        =   10181
  23.       _ExtentY        =   8700
  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 SoGroup
  31.     Set root = New SoGroup
  32.     'Choose a font
  33.     Dim myFont As SoFont
  34.     Set myFont = New SoFont
  35.     Call myFont.Name.setValue("Times New Roman;Regular")
  36.     Call myFont.Size.setValue(0.2)
  37.     Call root.addChild(myFont)
  38.     'We'll color the front of the text white, and the sides
  39.     'dark grey. So use a materialBinding of PER_PART and
  40.     'two diffuseColor values in the material node.
  41.     Dim myMaterial As SoMaterial
  42.     Set myMaterial = New SoMaterial
  43.     Dim myBinding As SoMaterialBinding
  44.     Set myBinding = New SoMaterialBinding
  45.     Call myMaterial.diffuseColor.set1RGBValue(0, 1#, 1#, 1#)
  46.     Call myMaterial.diffuseColor.set1RGBValue(1, 0.1, 0.1, 0.1)
  47.     Call myMaterial.diffuseColor.set1RGBValue(2, 1, 1, 1)
  48.     'TODO VB dosn't support OLE enum Types
  49.     Call myBinding.Value.setValue(3)
  50.     Call root.addChild(myMaterial)
  51.     Call root.addChild(myBinding)
  52.     'Create the globe
  53.     Dim sphereSep As SoSeparator
  54.     Set sphereSep = New SoSeparator
  55.     Dim myTexture2 As SoTexture2
  56.     Set myTexture2 = New SoTexture2
  57.     Dim sphereComplexity As SoComplexity
  58.     Set sphereComplexity = New SoComplexity
  59.     Call sphereComplexity.Value.setValue(0.55)
  60.     Call root.addChild(sphereSep)
  61.     Call sphereSep.addChild(myTexture2)
  62.     Call sphereSep.addChild(sphereComplexity)
  63.     Dim mySphere As SoSphere
  64.     Set mySphere = New SoSphere
  65.     Call sphereSep.addChild(mySphere)
  66.     Call myTexture2.filename.setValue(V3Space1.getRegistryDataPath() + "\examples\data\globe.rgb")
  67.     'Add Text3 for AFRICA, transformed to proper location.
  68.     Dim africaSep As SoSeparator
  69.     Set africaSep = New SoSeparator
  70.     Dim africaTransform As SoTransform
  71.     Set africaTransform = New SoTransform
  72.     Dim africaText As SoText3
  73.     Set africaText = New SoText3
  74.     Dim axis As SbVec3f
  75.     Set axis = New SbVec3f
  76.     Call axis.setValue(0, 1, 0)
  77.     Call africaTransform.rotation.setValueAxis(axis, 0.4)
  78.     Call africaTransform.translation.setValue(0.25, 0#, 1.25)
  79.     Call africaText.parts.setValue(&H7&) ' = SoText3::ALL;
  80.     Call africaText.Str.setValue("AFRICA")
  81.     Call root.addChild(africaSep)
  82.     Call africaSep.addChild(africaTransform)
  83.     Call africaSep.addChild(africaText)
  84.     'Add Text3 for ASIA, transformed to proper location.
  85.     Dim asiaSep As SoSeparator
  86.     Set asiaSep = New SoSeparator
  87.     Dim asiaTransform As SoTransform
  88.     Set asiaTransform = New SoTransform
  89.     Dim asiaText As SoText3
  90.     Set asiaText = New SoText3
  91.     Call asiaTransform.rotation.setValueAxis(axis, 1.5)
  92.     Call asiaTransform.translation.setValue(0.8, 0.6, 0.5)
  93.     Call asiaText.parts.setValue(&H7&) 'SoText3::ALL;
  94.     Call asiaText.Str.setValue("ASIA")
  95.     Call root.addChild(asiaSep)
  96.     Call asiaSep.addChild(asiaTransform)
  97.     Call asiaSep.addChild(asiaText)
  98.     Call V3Space1.setSceneRoot(root)
  99.     Call V3Space1.viewAll
  100.     'Clean up
  101.     Set root = Nothing
  102.     Set sceneRoot = Nothing
  103.     Set myFont = Nothing
  104.     Set africaText = Nothing
  105.     Set africaSep = Nothing
  106.     Set africaTransform = Nothing
  107.     Set asiaText = Nothing
  108.     Set asiaSep = Nothing
  109.     Set asiaTransform = Nothing
  110.     Set axis = Nothing
  111.     Set mySphere = Nothing
  112.     Set myTexture2 = Nothing
  113. End Sub
  114.