Calculating Normals Speed Tips

BlitzMax Forums/BlitzMax Programming/Calculating Normals Speed Tips

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yes, build an array:
Type SharedVert
field x:float,y:float,z:float
field nx:float,ny:float,nz:float
EndType
local sharedverts:TList = New TList
local VertReference:SharedVert[VertexCount]
For Every Vertex
  local found = false
  for sv:SharedVert = EachIn SharedVerts
    if vertex position = sv position
      found = true
      exit
    endif
  next 
  if found = false
   sv:SharedVert = new SharedVert
   sv position = vertex position
   sharedverts.addlast sv
  endif
  VertReference[vertexnumber] = sv
Next
ClearList SharedVerts
And then use the VertReference[] instead of searching through all the vertices for each triangle.