fIsFront proc uses edi esi lpV1:dword,lpV2:dword,lpV3:dword,lpSourceVertex:dword
LOCAL DVert:VERTEX
LOCAL q:qword
LOCAL AB:VERTEX
LOCAL CB:VERTEX
LOCAL facenormal:VERTEX
invoke Vec_Sub,addr DVert,lpSourceVertex,lpV1
invoke Vec_Sub,addr AB, lpV2, lpV1
invoke Vec_Sub,addr CB, lpV2, lpV3
invoke Vec_CrossProduct,addr facenormal,addr CB,addr AB
invoke Vec_DotProduct,addr DVert,addr facenormal
; fstp q
; FCMP q,FP4(0.)
ret
fIsFront endp ; Return Value at St(0)
This code is much more accurate than the last one. Not just that, it also able to determine the front face dynamically.