DirectX8 Getting Transformed Vertices
Just incase GameDev and my Hotmail account are inactive cause of server issues (like today), I'm gonna make a backup of my code for obtaining transformed vertices in DirectX8, which is rare and hard to find:
VB Code:
D3DXMatrixIdentity Transformation_Matrix(0)
Temp_Vertex.X = Vertex_List(0).X: Temp_Vertex.Y = Vertex_List(0).Y: Temp_Vertex.Z = Vertex_List(0).Z: Temp_Vertex.W = 1
D3DXMatrixMultiply Transformation_Matrix(0), World_Transformation_Matrix, Camera_Transformation_Matrix
D3DXMatrixMultiplyByVertex Transformation_Vertex(0), Transformation_Matrix(0), Temp_Vertex
And also, I'm gonna need this C++ guru's crappy VB attempt yet working (after I fix it) "Test if vertex is within viewing frustrum" code:
VB Code:
Sub cullVertexToViewFrustum(ByRef MatViewProj as D3DXMATRIX, x As Float, y As Float, z As Float) As Boolean
Dim p As D3DXPLANE
'left plane
p.a=MatViewProj.m(0,3)+MatViewProj.m(0,0)
p.b=MatViewProj.m(1,3)+MatViewProj.m(1,0)
p.c=MatViewProj.m(2,3)+MatViewProj.m(2,0)
p.d=MatViewProj.m(3,3)+MatViewProj.m(3,0)
D3DXPlaneNormalize p,p
If ((p.a*x)+(p.b*y)+(p.c*z)+p.d)<=0
Return True
'right plane
p.a=MatViewProj.m(0,3)-MatViewProj.m(0,0)
p.b=MatViewProj.m(1,3)-MatViewProj.m(1,0)
p.c=MatViewProj.m(2,3)-MatViewProj.m(2,0)
p.d=MatViewProj.m(3,3)-MatViewProj.m(3,0)
D3DXPlaneNormalize p,p
If ((p.a*x)+(p.b*y)+(p.c*z)+p.d)<=0
Return True
'top plane
p.a=MatViewProj.m(0,3)-MatViewProj.m(0,1)
p.b=MatViewProj.m(1,3)-MatViewProj.m(1,1)
p.c=MatViewProj.m(2,3)-MatViewProj.m(2,1)
p.d=MatViewProj.m(3,3)-MatViewProj.m(3,1)
D3DXPlaneNormalize p,p
If ((p.a*x)+(p.b*y)+(p.c*z)+p.d)<=0
Return True
'bottom plane
p.a=MatViewProj.m(0,3)+MatViewProj.m(0,1)
p.b=MatViewProj.m(1,3)+MatViewProj.m(1,1)
p.c=MatViewProj.m(2,3)+MatViewProj.m(2,1)
p.d=MatViewProj.m(3,3)+MatViewProj.m(3,1)
D3DXPlaneNormalize p,p
If ((p.a*x)+(p.b*y)+(p.c*z)+p.d)<=0
Return True
Return False
End Sub
Re: DirectX8 Getting Transformed Vertices
You could always post this in your Private Calendar if you want. No explainations needed. :)
Re: DirectX8 Getting Transformed Vertices
Re: DirectX8 Getting Transformed Vertices
Why not get a Gmail account & then you can store all your data in there.
Contact me if you need an invite
Re: DirectX8 Getting Transformed Vertices
Quote:
Originally Posted by shirazamod
Why not get a Gmail account & then you can store all your data in there?
Cause I'm too lazy. :bigyello:
Re: DirectX8 Getting Transformed Vertices
Quote:
Originally Posted by Jacob Roman
Private Calendar? :ehh:
Private Calendar