VB Code:
For i = 0 To UBound(Step(StepNum).CameraKeyPoint)
'Draw the marker
If editingTargetNr = i Then
drawMarker Step(StepNum).CameraKeyPoint(i).Keypoint, 0
drawMarker Step(StepNum).TargetKeyPoint(i).Keypoint, 2
Else
drawMarker Step(StepNum).CameraKeyPoint(i).Keypoint, 1
drawMarker Step(StepNum).TargetKeyPoint(i).Keypoint, 1
End If
'Reset transformations
D3DXMatrixIdentity matWorld
D3DDevice.SetTransform D3DTS_WORLD, matWorld
'Get viewport and stuff
D3DDevice.GetViewport vp
D3DDevice.GetTransform D3DTS_PROJECTION, matProj
D3DDevice.GetTransform D3DTS_VIEW, matView
D3DDevice.GetTransform D3DTS_WORLD, matWorld
'Get screencoordinate of first point
v = Step(StepNum).CameraKeyPoint(i).Keypoint
D3DXVec3Project v, v, vp, matProj, matView, matWorld
DrawText MainFont, 100, 50, 120, 200, Int(v.X) & " " & Int(v.Y), 0, &HFFFFFFFF
DrawText MainFont, 120, 50, 140, 200, Int(vp.X) & " " & Int(vp.Y), 0, &HFFFFFFFF
whiteLine(0) = CreateTLVertex(v.X, v.Y, 0, 1, D3DColorARGB(255, 255, 255, 255), 0, 0, 0)
'Get the second
v = Step(StepNum).TargetKeyPoint(i).Keypoint
D3DXVec3Project v, v, vp, matProj, matView, matWorld
whiteLine(1) = CreateTLVertex(v.X, v.Y, 0, 1, D3DColorARGB(255, 255, 255, 255), 0, 0, 0)
'Draw a line between them
D3DDevice.SetVertexShader FVF
D3DDevice.SetTexture 0, texWhite
D3DDevice.DrawPrimitiveUP D3DPT_LINELIST, 1, whiteLine(0), Len(whiteLine(0))
Next