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

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "07_03TextureFunction"
  4.    ClientHeight    =   5505
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1425
  7.    ClientWidth     =   6690
  8.    Height          =   5880
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5505
  12.    ScaleWidth      =   6690
  13.    Top             =   1110
  14.    Width           =   6810
  15.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  16.       Height          =   5535
  17.       Left            =   -120
  18.       TabIndex        =   0
  19.       Top             =   0
  20.       Width           =   6855
  21.       _Version        =   131072
  22.       _ExtentX        =   12091
  23.       _ExtentY        =   9763
  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.     'Choose a texture.
  33.     Dim faceTexture As SoTexture2
  34.     Set faceTexture = New SoTexture2
  35.     Call root.addChild(faceTexture)
  36.     Call faceTexture.filename.setValue(V3Space1.getRegistryDataPath() + "\examples\data\sillyFace.rgb")
  37.     'Make the diffuse color pure white
  38.     Dim myMaterial As SoMaterial
  39.     Set myMaterial = New SoMaterial
  40.     Call myMaterial.diffuseColor.setValue(1, 1, 1)
  41.     Call root.addChild(myMaterial)
  42.     'This texture2Transform centers the texture about (0,0,0)
  43.     Dim myTexXf As SoTexture2Transform
  44.     Set myTexXf = New SoTexture2Transform
  45.     Call myTexXf.translation.setValue(0.5, 0.5)
  46.     Call root.addChild(myTexXf)
  47.     'Define a texture coordinate plane node.  This one will
  48.     'repeat with a frequency of two times per unit length.
  49.     'Add a sphere for it to affect.
  50.     Dim texPlane1 As SoTextureCoordinatePlane
  51.     Set texPlane1 = New SoTextureCoordinatePlane
  52.     Call texPlane1.directionS.setValue(2, 0, 0)
  53.     Call texPlane1.directionT.setValue(0, 2, 0)
  54.     Call root.addChild(texPlane1)
  55.     Dim sphere As SoSphere
  56.     Set sphere = New SoSphere
  57.     Call root.addChild(sphere)
  58.     'A translation node for spacing the three spheres.
  59.     Dim myTranslation As SoTranslation
  60.     Set myTranslation = New SoTranslation
  61.     Call myTranslation.translation.setValue(2.5, 0, 0)
  62.     'Create a second sphere with a repeat frequency of 1.
  63.     Dim texPlane2 As SoTextureCoordinatePlane
  64.     Set texPlane2 = New SoTextureCoordinatePlane
  65.     Call texPlane2.directionS.setValue(1, 0, 0)
  66.     Call texPlane2.directionT.setValue(0, 1, 0)
  67.     Call root.addChild(myTranslation)
  68.     Call root.addChild(texPlane2)
  69.     Call root.addChild(sphere)
  70.     'The third sphere has a repeat frequency of .5
  71.     Dim texPlane3 As SoTextureCoordinatePlane
  72.     Set texPlane3 = New SoTextureCoordinatePlane
  73.     Call texPlane3.directionS.setValue(0.5, 0, 0)
  74.     Call texPlane3.directionT.setValue(0, 0.5, 0)
  75.     Call root.addChild(myTranslation)
  76.     Call root.addChild(texPlane3)
  77.     Call root.addChild(sphere)
  78.     Call V3Space1.setSceneRoot(root)
  79.     Call V3Space1.viewAll
  80.     Set root = Nothing
  81.     Set faceTexture = Nothing
  82.     Set myMaterial = Nothing
  83.     Set myTexXf = Nothing
  84.     Set texPlane1 = Nothing
  85.     Set sphere = Nothing
  86.     Set myTranslation = Nothing
  87.     Set myTexPlane2 = Nothing
  88.     Set texPlane3 = Nothing
  89.         
  90. End Sub
  91.