www.pudn.com > Intra3D-Software.rar > frmMain.frm


VERSION 5.00 
Object = "{4D8BEF20-5303-11D3-BEE0-0080C842CA37}#1.0#0"; "INTRA3D.OCX" 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Begin VB.Form frmMain  
   Caption         =   "Intra3D Example - Polygonal Models" 
   ClientHeight    =   6675 
   ClientLeft      =   165 
   ClientTop       =   735 
   ClientWidth     =   7455 
   Icon            =   "frmMain.frx":0000 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   6675 
   ScaleWidth      =   7455 
   StartUpPosition =   3  'Windows Default 
   Begin INTRA3DLibCtl.SceneView AppView  
      Height          =   3735 
      Left            =   1320 
      OleObjectBlob   =   "frmMain.frx":0442 
      TabIndex        =   3 
      Top             =   1200 
      Width           =   4935 
   End 
   Begin MSComctlLib.Toolbar tbDetailed  
      Align           =   4  'Align Right 
      Height          =   6315 
      Left            =   7095 
      TabIndex        =   2 
      Top             =   360 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   11139 
      ButtonWidth     =   609 
      ButtonHeight    =   582 
      Appearance      =   1 
      Style           =   1 
      ImageList       =   "ImageList2" 
      _Version        =   393216 
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}  
         NumButtons      =   21 
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateXP" 
            Object.ToolTipText     =   "Translate  to +X" 
            ImageIndex      =   1 
         EndProperty 
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateYP" 
            Object.ToolTipText     =   "Translate  to +Y" 
            ImageIndex      =   2 
         EndProperty 
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateZP" 
            Object.ToolTipText     =   "Translate  to +Z" 
            ImageIndex      =   3 
         EndProperty 
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateXN" 
            Object.ToolTipText     =   "Translate  to -X" 
            ImageIndex      =   4 
         EndProperty 
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateYN" 
            Object.ToolTipText     =   "Translate  to -Y" 
            ImageIndex      =   5 
         EndProperty 
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateZN" 
            Object.ToolTipText     =   "Translate  to -Z" 
            ImageIndex      =   6 
         EndProperty 
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateXP" 
            Object.ToolTipText     =   "Rotate from X" 
            ImageIndex      =   7 
         EndProperty 
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateYP" 
            Object.ToolTipText     =   "Rotate from Y" 
            ImageIndex      =   8 
         EndProperty 
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateZP" 
            Object.ToolTipText     =   "Rotate from Z" 
            ImageIndex      =   9 
         EndProperty 
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateXN" 
            Object.ToolTipText     =   "Rotate from X" 
            ImageIndex      =   10 
         EndProperty 
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateYN" 
            Object.ToolTipText     =   "Rotate from Y" 
            ImageIndex      =   11 
         EndProperty 
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateZN" 
            Object.ToolTipText     =   "Rotate from Z" 
            ImageIndex      =   12 
         EndProperty 
         BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
         BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleXP" 
            Object.ToolTipText     =   "Scale Up X" 
            ImageIndex      =   13 
         EndProperty 
         BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleYP" 
            Object.ToolTipText     =   "Scale Up Y" 
            ImageIndex      =   14 
         EndProperty 
         BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleZP" 
            Object.ToolTipText     =   "Scale Up Z" 
            ImageIndex      =   15 
         EndProperty 
         BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleXN" 
            Object.ToolTipText     =   "Scale Down X" 
            ImageIndex      =   16 
         EndProperty 
         BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleYN" 
            Object.ToolTipText     =   "Scale Down Y" 
            ImageIndex      =   17 
         EndProperty 
         BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleZN" 
            Object.ToolTipText     =   "Scale Down Z" 
            ImageIndex      =   18 
         EndProperty 
         BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628}  
         EndProperty 
      EndProperty 
   End 
   Begin MSComctlLib.Toolbar tbApp  
      Align           =   3  'Align Left 
      Height          =   6315 
      Left            =   0 
      TabIndex        =   1 
      Top             =   360 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   11139 
      ButtonWidth     =   609 
      ButtonHeight    =   582 
      Appearance      =   1 
      Style           =   1 
      ImageList       =   "ImageList3" 
      _Version        =   393216 
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}  
         NumButtons      =   2 
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ClearColor" 
            Object.ToolTipText     =   "Edit Clear Color" 
            ImageIndex      =   1 
         EndProperty 
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "DirLight" 
            Object.ToolTipText     =   "Eidt DirLight" 
            ImageIndex      =   3 
         EndProperty 
      EndProperty 
      BorderStyle     =   1 
   End 
   Begin MSComctlLib.Toolbar tbStandard  
      Align           =   1  'Align Top 
      Height          =   360 
      Left            =   0 
      TabIndex        =   0 
      Top             =   0 
      Width           =   7455 
      _ExtentX        =   13150 
      _ExtentY        =   635 
      ButtonWidth     =   609 
      ButtonHeight    =   582 
      Appearance      =   1 
      Style           =   1 
      ImageList       =   "ImageList1" 
      _Version        =   393216 
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}  
         NumButtons      =   19 
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Animate" 
            Object.ToolTipText     =   "Toggle Animate" 
            ImageIndex      =   1 
            Style           =   1 
         EndProperty 
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Select" 
            Object.ToolTipText     =   "Select/Unselect" 
            ImageIndex      =   2 
            Style           =   1 
         EndProperty 
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateXY" 
            Object.ToolTipText     =   "Translate in XY-Plane" 
            ImageIndex      =   3 
            Style           =   1 
         EndProperty 
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "TranslateXZ" 
            Object.ToolTipText     =   "Translate in XZ-Plane" 
            ImageIndex      =   4 
            Style           =   1 
         EndProperty 
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Trackball" 
            Object.ToolTipText     =   "Trackball" 
            ImageIndex      =   5 
            Style           =   1 
         EndProperty 
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateLR" 
            Object.ToolTipText     =   "Rotate Left-Right" 
            ImageIndex      =   6 
            Style           =   1 
         EndProperty 
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateUD" 
            Object.ToolTipText     =   "Rotate Up-Down" 
            ImageIndex      =   7 
            Style           =   1 
         EndProperty 
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "RotateCW" 
            Object.ToolTipText     =   "Rotate CW-CCW" 
            ImageIndex      =   8 
            Style           =   1 
         EndProperty 
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleUp" 
            Object.ToolTipText     =   "Scale Up" 
            ImageIndex      =   9 
         EndProperty 
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ScaleDown" 
            Object.ToolTipText     =   "Scale Down" 
            ImageIndex      =   10 
         EndProperty 
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
         BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ZoomOut" 
            Object.ToolTipText     =   "Increase ViewAngle" 
            ImageIndex      =   11 
         EndProperty 
         BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "ZoomIn" 
            Object.ToolTipText     =   "Decrease ViewAngle" 
            ImageIndex      =   12 
         EndProperty 
         BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Perspective" 
            Object.ToolTipText     =   "Perspective" 
            ImageIndex      =   13 
            Style           =   1 
         EndProperty 
         BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Ortho" 
            Object.ToolTipText     =   "Ortho" 
            ImageIndex      =   14 
            Style           =   1 
         EndProperty 
         BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Key             =   "Reset" 
            Object.ToolTipText     =   "Reset" 
            ImageIndex      =   15 
         EndProperty 
         BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}  
            Style           =   3 
         EndProperty 
      EndProperty 
      BorderStyle     =   1 
   End 
   Begin MSComctlLib.ImageList ImageList3  
      Left            =   3360 
      Top             =   5520 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   16 
      ImageHeight     =   16 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   5 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0466 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":057A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":068E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":07A2 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":08B6 
            Key             =   "" 
         EndProperty 
      EndProperty 
   End 
   Begin MSComctlLib.ImageList ImageList2  
      Left            =   2400 
      Top             =   5520 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   16 
      ImageHeight     =   16 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   18 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":09CA 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0AE6 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0C02 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0D1E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0E3A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":0F56 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1072 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":118E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":12AA 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":13C6 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":14E2 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":15FE 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":171A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1836 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1952 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1A6E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1B8A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1CA6 
            Key             =   "" 
         EndProperty 
      EndProperty 
   End 
   Begin MSComctlLib.ImageList ImageList1  
      Left            =   1440 
      Top             =   5520 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   16 
      ImageHeight     =   16 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   15 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1DC2 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1ED6 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":1FEA 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":20FE 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2212 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2326 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":243A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":254E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2662 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2776 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":288A 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":299E 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2AB2 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2BC6 
            Key             =   "" 
         EndProperty 
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmMain.frx":2CE2 
            Key             =   "" 
         EndProperty 
      EndProperty 
   End 
   Begin VB.Menu mnuFile  
      Caption         =   "&File" 
      Begin VB.Menu mnuSave  
         Caption         =   "Save as temp.bmp" 
      End 
      Begin VB.Menu mnuFileBar  
         Caption         =   "-" 
      End 
      Begin VB.Menu mnuExit  
         Caption         =   "Exit" 
      End 
   End 
   Begin VB.Menu mnuOptions  
      Caption         =   "&Options" 
      Begin VB.Menu mnuSolidModel  
         Caption         =   "Solid Model" 
         Checked         =   -1  'True 
      End 
      Begin VB.Menu mnuWireModel  
         Caption         =   "Wire Model" 
      End 
      Begin VB.Menu mnuOptionsBar  
         Caption         =   "-" 
      End 
      Begin VB.Menu mnuAntialiasing  
         Caption         =   "Antialiasing" 
      End 
   End 
   Begin VB.Menu mnuObjModels  
      Caption         =   "ObjModels" 
      Begin VB.Menu mnuObjF16  
         Caption         =   "F-16" 
      End 
      Begin VB.Menu mnuObjMan  
         Caption         =   "Man" 
         Checked         =   -1  'True 
      End 
      Begin VB.Menu mnuObjCastle  
         Caption         =   "Castle" 
      End 
      Begin VB.Menu mnuObjFlowers  
         Caption         =   "Flowers" 
      End 
      Begin VB.Menu mnuObjRose  
         Caption         =   "Rose" 
      End 
      Begin VB.Menu mnuObjSoccerBall  
         Caption         =   "Soccer Ball" 
      End 
      Begin VB.Menu mnuObjCar  
         Caption         =   "Car" 
      End 
   End 
   Begin VB.Menu mnu3dsModels  
      Caption         =   "3dsModels" 
      Begin VB.Menu mnu3dsSkell  
         Caption         =   "Skell" 
         Checked         =   -1  'True 
      End 
      Begin VB.Menu mnu3dsHubble  
         Caption         =   "Hubble" 
      End 
      Begin VB.Menu mnu3dsIcon  
         Caption         =   "Icon" 
      End 
      Begin VB.Menu mnu3dsMachine1  
         Caption         =   "Machine1" 
      End 
      Begin VB.Menu mnu3dsMachine2  
         Caption         =   "Machine2" 
      End 
      Begin VB.Menu mnu3dsMachine3  
         Caption         =   "Machine3" 
      End 
   End 
   Begin VB.Menu mnuHelp  
      Caption         =   "&Help" 
      Begin VB.Menu mnuAbout  
         Caption         =   "About..." 
      End 
   End 
End 
Attribute VB_Name = "frmMain" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'Intra3D 2.0 Example : Polygonal Models 
'มึศ๑ , 1999/08/22 
 
Option Explicit 
Dim indexOBJ As Integer 
Dim index3DS As Integer 
Dim draw_mode As EnumDrawMode 
 
Private Sub AppView_InitScene() 
     
    ogl.glDepthFunc GL_Less 
    ogl.glEnable GL_DEPTH_TEST 
    ogl.glEnable GL_NORMALIZE 
    ogl.glEnable GL_LIGHTING 
    CreateScene 
    AppView.SetClearColor 0#, 0#, 0#, 1# 
    AppView.SetSceneRoot m_pGroup 
     
    indexOBJ = 2 
    index3DS = 1 
    draw_mode = SOLID 
End Sub 
 
Private Sub AppView_ControlAnimate() 
    ControlAnimate 
End Sub 
 
Private Sub Form_Load() 
    tbStandard.Buttons("Perspective").Value = tbrPressed 
End Sub 
 
Private Sub Form_Resize() 
 
If (Me.WindowState = 1) Then Exit Sub   'ื๎ะกปฏ 
    AppView.Move tbApp.Width, tbStandard.Height, _ 
             Me.ScaleWidth - tbApp.Width - tbDetailed.Width - 3, _ 
             Me.ScaleHeight - tbStandard.Height 
 
End Sub 
 
Private Sub mnuAbout_Click() 
    frmAbout.Show vbModal, Me 
End Sub 
 
Private Sub mnuExit_Click() 
End 
End Sub 
 
Private Sub mnuSave_Click() 
    AppView.SaveAsBMP "temp.bmp" 
End Sub 
 
Private Sub mnuAntialiasing_Click() 
    Dim flag As Long 
    Dim times As EnumJitterTimes 
    AppView.GetAntialiasingInfo flag, times 
     
    If flag Then 
        AppView.DisableAntialiasing 
        mnuAntialiasing.Checked = False 
    Else 
        AppView.EnableAntialiasing JITTER_TIMES_4 
        mnuAntialiasing.Checked = True 
    End If 
       
    AppView.Run 
 
End Sub 
 
Private Sub UpdateMenu() 
 
    If draw_mode = SOLID Then 
        mnuSolidModel.Checked = True 
        mnuWireModel.Checked = False 
    Else 
        mnuSolidModel.Checked = False 
        mnuWireModel.Checked = True 
    End If 
     
    If indexOBJ = 1 Then 
        mnuObjF16.Checked = True 
    Else 
        mnuObjF16.Checked = False 
    End If 
   
    If indexOBJ = 2 Then 
        mnuObjMan.Checked = True 
    Else 
        mnuObjMan.Checked = False 
    End If 
   
    If indexOBJ = 3 Then 
        mnuObjCastle.Checked = True 
    Else 
        mnuObjCastle.Checked = False 
    End If 
   
    If indexOBJ = 4 Then 
        mnuObjFlowers.Checked = True 
    Else 
        mnuObjFlowers.Checked = False 
    End If 
   
    If indexOBJ = 5 Then 
        mnuObjRose.Checked = True 
    Else 
        mnuObjRose.Checked = False 
    End If 
   
    If indexOBJ = 6 Then 
        mnuObjSoccerBall.Checked = True 
    Else 
        mnuObjSoccerBall.Checked = False 
    End If 
   
    If indexOBJ = 7 Then 
        mnuObjCar.Checked = True 
    Else 
        mnuObjCar.Checked = False 
    End If 
   
    If index3DS = 1 Then 
        mnu3dsSkell.Checked = True 
    Else 
        mnu3dsSkell.Checked = False 
    End If 
     
    If index3DS = 2 Then 
        mnu3dsHubble.Checked = True 
    Else 
        mnu3dsHubble.Checked = False 
    End If 
     
    If index3DS = 3 Then 
        mnu3dsIcon.Checked = True 
    Else 
        mnu3dsIcon.Checked = False 
    End If 
     
    If index3DS = 4 Then 
        mnu3dsMachine1.Checked = True 
    Else 
        mnu3dsMachine1.Checked = False 
    End If 
     
    If index3DS = 5 Then 
        mnu3dsMachine2.Checked = True 
    Else 
        mnu3dsMachine2.Checked = False 
    End If 
     
    If index3DS = 6 Then 
        mnu3dsMachine3.Checked = True 
    Else 
        mnu3dsMachine3.Checked = False 
    End If 
     
End Sub 
 
Private Sub mnuSolidModel_Click() 
    If draw_mode = SOLID Then Exit Sub 
     
    m_pModelOBJ.SetDrawMode SOLID 
    m_pModel3DS.SetDrawMode SOLID 
    draw_mode = SOLID 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnuWireModel_Click() 
    If draw_mode = WIRE Then Exit Sub 
     
    m_pModelOBJ.SetDrawMode WIRE 
    m_pModel3DS.SetDrawMode WIRE 
    draw_mode = WIRE 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnuObjF16_Click() 
    If indexOBJ = 1 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\f-16.obj") 
    indexOBJ = 1 
    UpdateMenu 
    AppView.Run 
End Sub 
Private Sub mnuObjMan_Click() 
    If indexOBJ = 2 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\al.obj") 
    indexOBJ = 2 
    UpdateMenu 
    AppView.Run 
End Sub 
 
Private Sub mnuObjCastle_Click() 
    If indexOBJ = 3 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\castle.obj") 
    indexOBJ = 3 
    UpdateMenu 
    AppView.Run 
End Sub 
Private Sub mnuObjFlowers_Click() 
    If indexOBJ = 4 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\flowers.obj") 
    indexOBJ = 4 
    UpdateMenu 
    AppView.Run 
End Sub 
Private Sub mnuObjRose_Click() 
    If indexOBJ = 5 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\rose+vase.obj") 
    indexOBJ = 5 
    UpdateMenu 
    AppView.Run 
End Sub 
Private Sub mnuObjSoccerBall_Click() 
    If indexOBJ = 6 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\soccerball.obj") 
    indexOBJ = 6 
    UpdateMenu 
    AppView.Run 
End Sub 
Private Sub mnuObjCar_Click() 
    If indexOBJ = 7 Then Exit Sub 
     
    m_pModelOBJ.LoadModel ("..\..\..\Data\ModelOBJ\porsche.obj") 
    indexOBJ = 7 
    UpdateMenu 
    AppView.Run 
End Sub 
 
Private Sub mnu3dsSkell_Click() 
    If index3DS = 1 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\skell.bmf") 
    index3DS = 1 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnu3dsHubble_Click() 
    If index3DS = 2 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\hubble.bmf") 
    index3DS = 2 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnu3dsIcon_Click() 
    If index3DS = 3 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\anhk.bmf") 
    index3DS = 3 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnu3dsMachine1_Click() 
    If index3DS = 4 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\tie-in.bmf") 
    index3DS = 4 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnu3dsMachine2_Click() 
    If index3DS = 5 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\ywing.bmf") 
    index3DS = 5 
    UpdateMenu 
    AppView.Run 
 
End Sub 
Private Sub mnu3dsMachine3_Click() 
    If index3DS = 6 Then Exit Sub 
     
    m_pModel3DS.LoadModel ("..\..\..\Data\Model3DS-BMF\atat.bmf") 
    index3DS = 6 
    UpdateMenu 
    AppView.Run 
 
End Sub 
 
Private Sub EditClearColor() 
    Dim red As Single, green As Single, blue As Single, alpha As Single 
    AppView.GetClearColor red, green, blue, alpha 
     
    Dim dialog As New CommonDialog 
    Dim flag As Long 
     
    flag = dialog.EditColorDialog("Edit Background Color", red, green, blue) 
    If flag Then 
        AppView.SetClearColor red, green, blue, alpha 
        AppView.Run 
    End If 
      
End Sub 
 
Private Sub EditDirLight() 
    Dim dialog As New CommonDialog 
    Dim flag As Long 
 
    flag = dialog.EditDirLightDialog("Edit DirLight", m_pLight0) 
    If flag Then AppView.Run 
 
End Sub 
 
 
Private Sub tbApp_ButtonClick(ByVal Button As MSComctlLib.Button) 
 
Select Case Button.Key 
    Case "ClearColor" 
                EditClearColor 
    Case "DirLight" 
                EditDirLight 
End Select 
 
End Sub 
 
Private Sub tbStandard_ButtonClick(ByVal Button As MSComctlLib.Button) 
 
Select Case Button.Key 
    Case "Animate" 
                AppView.OnToggleAnimate 
    Case "Select" 
                AppView.OnMouseSelect 
    Case "TranslateXY" 
                AppView.OnMouseTranslateXY 
    Case "TranslateXZ" 
                AppView.OnMouseTranslateXZ 
    Case "Trackball" 
                AppView.OnMouseRotate 
    Case "RotateLR" 
                AppView.OnMouseRotateLeftRight 
    Case "RotateUD" 
                AppView.OnMouseRotateUpDown 
    Case "RotateCW" 
                AppView.OnMouseRotateCWCCW 
    Case "ScaleUp" 
                AppView.OnScaleUp 
    Case "ScaleDown" 
                AppView.OnScaleDown 
    Case "ZoomOut" 
                AppView.OnZoomOut 
    Case "ZoomIn" 
                AppView.OnZoomIn 
    Case "Perspective" 
                AppView.OnPerspective 
    Case "Ortho" 
                AppView.OnOrtho 
    Case "Reset" 
                AppView.OnReset 
                 
End Select 
     
    If AppView.IsAnimateEnabled() Then 
        tbStandard.Buttons("Animate").Value = tbrPressed 
    Else 
        tbStandard.Buttons("Animate").Value = tbrUnpressed 
    End If 
     
    Dim interaction As EnumMouseInteraction 
    interaction = AppView.MouseInteractionType 
     
    If interaction <> MOUSE_SELECT Then 
        tbStandard.Buttons("Select").Value = tbrUnpressed 
    End If 
         
    If interaction <> MOUSE_TRANSLATE_XY Then 
        tbStandard.Buttons("TranslateXY").Value = tbrUnpressed 
    End If 
         
    If interaction <> MOUSE_TRANSLATE_XZ Then 
        tbStandard.Buttons("TranslateXZ").Value = tbrUnpressed 
    End If 
         
    If interaction <> MOUSE_ROTATE Then 
        tbStandard.Buttons("Trackball").Value = tbrUnpressed 
    End If 
                 
    If interaction <> MOUSE_ROTATE_LEFT_RIGHT Then 
        tbStandard.Buttons("RotateLR").Value = tbrUnpressed 
    End If 
                 
    If interaction <> MOUSE_ROTATE_UP_DOWN Then 
        tbStandard.Buttons("RotateUD").Value = tbrUnpressed 
    End If 
         
    If interaction <> MOUSE_ROTATE_CW_CCW Then 
        tbStandard.Buttons("RotateCW").Value = tbrUnpressed 
    End If 
         
    If AppView.ProjectionMode = PERSPECTIVE Then 
        tbStandard.Buttons("Perspective").Value = tbrPressed 
        tbStandard.Buttons("Ortho").Value = tbrUnpressed 
    Else 
        tbStandard.Buttons("Perspective").Value = tbrUnpressed 
        tbStandard.Buttons("Ortho").Value = tbrPressed 
    End If 
 
End Sub 
 
Private Sub tbDetailed_ButtonClick(ByVal Button As MSComctlLib.Button) 
 
Select Case Button.Key 
    Case "TranslateXP" 
                AppView.OnTranslateXP 
    Case "TranslateYP" 
                AppView.OnTranslateYP 
    Case "TranslateZP" 
                AppView.OnTranslateZP 
    Case "TranslateXN" 
                AppView.OnTranslateXN 
    Case "TranslateYN" 
                AppView.OnTranslateYN 
    Case "TranslateZN" 
                AppView.OnTranslateZN 
     
    Case "RotateXP" 
                AppView.OnRotateXP 
    Case "RotateYP" 
                AppView.OnRotateYP 
    Case "RotateZP" 
                AppView.OnRotateZP 
    Case "RotateXN" 
                AppView.OnRotateXN 
    Case "RotateYN" 
                AppView.OnRotateYN 
    Case "RotateZN" 
                AppView.OnRotateZN 
                 
    Case "ScaleXP" 
                AppView.OnScaleXP 
    Case "ScaleYP" 
                AppView.OnScaleYP 
    Case "ScaleZP" 
                AppView.OnScaleZP 
    Case "ScaleXN" 
                AppView.OnScaleXN 
    Case "ScaleYN" 
                AppView.OnScaleYN 
    Case "ScaleZN" 
                AppView.OnScaleZN 
                 
End Select 
 
End Sub