This is the code that is used to manipulate the image. I apologise for lack of comments
Private Sub SetupItemModelDisplay()
Dim winX As Integer = itemModelViewPictureBox.Width
Dim winY As Integer = itemModelViewPictureBox.Height
Dim eldHandle As Integer = oDBDisplay.GetHWND
oDBDisplay.OverrideHWND(Me.itemModelViewPictureBox.Handle.ToInt32())
oDBDisplay.SetDisplayMode(winX, winY, 32)
ShowWindowAsync(eldHandle, 0)
oDBCamera.BackdropOn()
_modelUpdateTimer.Interval = 100
_modelUpdateTimer.Enabled = True
End Sub
Private Sub _modelUpdateTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles _modelUpdateTimer.Tick
_modelUpdateTimer.Enabled = False
If oDBP.LoopGDK = True Then
oDBCore.Sync()
End If
_modelUpdateTimer.Enabled = True
End Sub
Private Sub itemModelViewPictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles itemModelViewPictureBox.MouseMove
If mediaStore.ContainsKey(STR_ItemGenModel) = True Then
Select Case e.Button
Case Windows.Forms.MouseButtons.Left
If _itemModelRotateX = -1 Then
_itemModelRotateX = e.X
_itemModelRotateY = e.Y
Else
Dim diffX As Integer = _itemModelRotateX - e.X
Dim diffY As Integer = _itemModelRotateY - e.Y
_itemModelRotateX = e.X
_itemModelRotateY = e.Y
If RotateObject(STR_ItemGenModel, diffY * _rotateMlt, diffX * _rotateMlt, 0, True) = False Then
MessageBox.Show("Ooops failed to rotate object")
End If
End If
Case Windows.Forms.MouseButtons.Right
If _itemModelMoveX = -1 Then
_itemModelMoveX = e.X
_itemModelMoveY = e.Y
Else
Dim diffX As Integer = _itemModelMoveX - e.X
Dim diffY As Integer = _itemModelMoveY - e.Y
diffX = diffX - (2 * diffX)
_itemModelMoveX = e.X
_itemModelMoveY = e.Y
If PositionObject(STR_ItemGenModel, diffX * _positionMlt, diffY * _positionMlt, 0, True) = False Then
MessageBox.Show("Ooops failed to position object")
End If
End If
Case Windows.Forms.MouseButtons.None
_itemModelRotateX = -1
_itemModelRotateY = -1
_itemModelMoveX = -1
_itemModelMoveY = -1
End Select
End If
End Sub
Public Function RotateObject(ByVal ID As String, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal reletive As Boolean) As Boolean
If mediaStore.ContainsKey(ID) = True Then
Dim model As TyranntModel = CType(mediaStore(ID), TyranntModel)
If model.IsLoaded Then
RotateObject(model.ID, x, y, z, reletive)
Return True
Else
Return False
End If
Else
Return False
End If
End Function
Public Sub RotateObject(ByVal ID As Integer, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal reletive As Boolean)
If reletive = True Then
SyncLock oDB3D
oDB3D.RotateObject(ID, oDB3D.ObjectAngleX(ID) + x, oDB3D.ObjectAngleY(ID) + y, oDB3D.ObjectAngleZ(ID) + z)
End SyncLock
Else
SyncLock oDB3D
oDB3D.RotateObject(ID, x, y, z)
End SyncLock
End If
End Sub
Public Function PositionObject(ByVal ID As String, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal reletive As Boolean) As Boolean
If mediaStore.ContainsKey(ID) = True Then
Dim model As TyranntModel = CType(mediaStore(ID), TyranntModel)
If model.IsLoaded Then
If reletive = True Then
oDB3D.PositionObject(model.ID, oDB3D.ObjectPositionX(model.ID) + x, oDB3D.ObjectPositionY(model.ID) + y, oDB3D.ObjectPositionZ(model.ID) + z)
Else
oDB3D.PositionObject(model.ID, x, y, z)
End If
Return True
Else
Return False
End If
Else
Return False
End If
End Function
Public Sub PositionObject(ByVal ID As Integer, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal reletive As Boolean)
If reletive = True Then
oDB3D.PositionObject(ID, oDB3D.ObjectPositionX(ID) + x, oDB3D.ObjectPositionY(ID) + y, oDB3D.ObjectPositionZ(ID) + z)
Else
oDB3D.PositionObject(ID, x, y, z)
End If
End Sub
----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"