3d cube zoom in and out ,i get ,adding a picture i can figure out
hey
what i have is a 3d cube that i can spin with a bmp picture on it ,but when i make the box grow in size the picture stays the same size,
whats the best way to do this ive just started out trying 3d objects using pure vb ?
thanks
atatched file is what im using to learn from psc
Re: 3d cube zoom in and out ,i get ,adding a picture i can figure out
hey i dont know witch methed is best to use to add mesh to a dominoe.
im having a problem with the iloadmesh part could use some pointers
thanks
Code:
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Dim varVertexS(1 To 10000) As AVERTEX
Dim varVertexD(1 To 10000) As AVERTEX
Dim varXbuffer(1 To 10000) As Long
Dim varYbuffer(1 To 10000) As Long
Dim varZbuffer(1 To 10000) As Long
Dim varRedbuffer(1 To 10000) As Long
Dim varGreenbuffer(1 To 10000) As Long
Dim varBluebuffer(1 To 10000) As Long
Public PX
Public Py
Public Pz
Public Sub iLoadMesh()
Dim varX
Dim varY
varY = 1
For i = 1 To 10000
varX = varX + 1 'Move marker forward
varRedbuffer(i) = frmMain.picColorbuffer.Point(varX, varY) And 255
varGreenbuffer(i) = (frmMain.picColorbuffer.Point(varX, varY) And 65280) / 256
varBluebuffer(i) = (frmMain.picColorbuffer.Point(varX, varY) And 16711680) / 65535
If varX <= 15 Then
varVertexS(i).AVX = 0 - (15 - varX)
End If
If varX > 50 Then
varVertexS(i).AVX = varX - 50
End If
If varY <= 50 Then
varVertexS(i).AVY = 50 - varY
End If
If varY > 50 Then
varVertexS(i).AVY = -(varY - 50)
End If
varVertexS(i).AVZ = 15
If varX = 100 Then varY = varY + 1: varX = 0
DoEvents
Next i
End Sub
Public Sub iDraw(hdc As Long)
For i = 1 To 10000
SetPixel hdc, varVertexD(i).AVX, varVertexD(i).AVY, RGB(varRedbuffer(i), varGreenbuffer(i), varBluebuffer(i))
Next i
x:
End Sub
Public Sub iSpin()
Dim varXradians As Double
Dim varYradians As Double
Dim varZradians As Double
varXradians = -((frmMain.SrlX.Value + PX) * pi / 180)
varYradians = ((frmMain.SrlY.Value + Py) * pi / 180)
varZradians = ((frmMain.SrlZ.Value + Pz) * pi / 180)
For i = 1 To 10000
varVertexD(i) = RotateX(varVertexS(i), varXradians)
varVertexD(i) = RotateY(varVertexD(i), varYradians)
varVertexD(i) = RotateZ(varVertexD(i), varZradians)
Next i
For i = 1 To 10000
varVertexD(i).AVX = varVertexD(i).AVX + frmMain.picBuffer.ScaleWidth \ 2
varVertexD(i).AVY = varVertexD(i).AVY + frmMain.picBuffer.ScaleHeight \ 2
Next i
End Sub