vertex in view

Blitz3D Forums/Blitz3D Programming/vertex in view

dmaz(Posted 2004) [#1]
Anybody know of a quick way to calculate if a vertex is in view of the camera?


Beaker(Posted 2004) [#2]
Put a pivot where the vert is and then do an EntityInView().


Bot Builder(Posted 2004) [#3]
You'll have to do it like this: (clarification of beakers method)

TFormPoint VertexX(surf,i),VertexY(surf,i),VertexZ(surf,i),entity,0
PositionEntity Pivot,TformedX(),TformedY(),TformedZ()
If EntityInView(Pivot,Camera) Then
;Yadda Yadda



dmaz(Posted 2004) [#4]
Thanks guys, exactly what I needed.


N(Posted 2004) [#5]
The way I do it (which is, as far as I'm concerned, far more accurate when it comes down to a point in space):

TFormPoint VertexX(Surface,Index),VertexY(Surface,Index),VertexZ(Surface,Index),Mesh,0
CameraProject Camera,TFormedX(),TFormedY(),TFormedZ()

Visible = True

If ProjectedZ() <= 0 Then
     Visible = False
Else
     PX = ProjectedX()
     If PX < -4 Or PX > GraphicsWidth()+4 Then
          Visible = False
     Else
          PY = ProjectedY()
          If PY < -4 Or PY > GraphicsHeight()+4 Then
               Visible = False
          EndIf
     EndIf
EndIf



dmaz(Posted 2004) [#6]
Thanks Noel, I forgot all about Projected_.