I noticed that all triangles have a flag "IsInverted" which is used to flip orientation and causes special-case-handling at many places.
If you want to flip a triangle which is made up by the vertices v1,v2,v3, you can simply change the order of the vertices, for example v1,v3,v2.
In
Culling_Visible you don't need to normalize viewpos and viewposnormal.
You can also simplify the computation for ViewPosNormal:
ViewPosNormal.x = Tri.Vertex(1).Viewpos.y*Tri.Vertex(2).Viewpos.z - Tri.Vertex(1).Viewpos.z*Tri.Vertex(2).Viewpos.y
ViewPosNormal.y = Tri.Vertex(1).Viewpos.z*Tri.Vertex(2).Viewpos.x - Tri.Vertex(1).Viewpos.x*Tri.Vertex(2).Viewpos.z
ViewPosNormal.z = Tri.Vertex(1).Viewpos.x*Tri.Vertex(2).Viewpos.y - Tri.Vertex(1).Viewpos.y*Tri.Vertex(2).Viewpos.x
A better way is to test culling in object-space, but I guess that's a bit too far out at the moment.
Objects with higher tesselation won't benefit much from perspective interpolation.
For rather small triangles (and those with small delta-z) you can use linear interpolation.
Try to separate your vertex-data from the triangles. At the moment you're still transforming 6 times as many vertices as would be required.
Also try to do as few transformations on your vertices as absolutely necessary.
Actually there's no need to touch vertices in
Rotate_Object.
Just build a rotation-matrix, multiply it with the camera-matrix and do the complete transform (with a single matrix) in
RotateViewPos (already mentioned
here).
When calculating lighting (where you require .pos3d) you can transform the lights into camera-space (or object-space).
You can generally speed up vector-normalization (extensively used in the lighting-calculation) with the method described
here.
Since the specular exponent is constant, you can find an lower bound for (N*H) so that (N*H)^e<EPS.
You're now storing an id of the material in your triangle-structure. It's more efficient to do it the other way round:
In your material-structure store a list of pointers to all meshes which got this material applied.
This way you save the (rather complex) test which material is currently active for every triangle.
You might consider upgrading to fbc 0.2 and use command-line parameter "-fpu sse" to gain ~5fps.
The more I look at freebasic's asm-output, the more I think this will become a good opportunity for you to learn assembler
