Author Topic: AirBall!!!!!  (Read 2231 times)

Evolution

  • PGP
  • Posts: 1
AirBall!!!!!
« on: October 26, 2007, 11:04:21 AM »
We need some airball! Also Woodsball!!!  :-X

FourthX

  • Developer
  • 68 Carbine
  • Posts: 260
Re: AirBall!!!!!
« Reply #1 on: October 26, 2007, 11:43:04 AM »
K, go ahead and program a LOD model system for DP and I'll make those maps for ya!

FtX

Eiii

  • Autococker
  • Posts: 4595
Re: AirBall!!!!!
« Reply #2 on: October 26, 2007, 01:11:55 PM »
No!!!

WarWulf

  • Autococker
  • Posts: 539
Re: AirBall!!!!!
« Reply #3 on: October 26, 2007, 04:18:53 PM »
im sure you can port some of my code out of here ;)

;Lod Mesh
;WarWUlf Inc...


Graphics3D 640,480
SetBuffer BackBuffer()
lit=CreateLight()

cam=CreateCamera()
CameraRange cam,1,1000
PositionEntity cam,0,0,-100

;Load in mesh and texture
mesh=LoadMesh("dolphin.x")

tex=LoadTexture("dolphin.bmp")
EntityTexture mesh,tex
ScaleMesh mesh,.2,.2,.2

Get_Data(mesh)                  ;Store mesh inforamtion
;mesh=Create_New_Mesh(mesh,1)      ;Reduce mesh by 1 triangle
;WireFrame True
While Not KeyDown(1)
   TurnEntity mesh,0,1,0

   If KeyDown(57) Then
      mesh=Create_New_Mesh(mesh,1)   ; Reduce mesh by 1 triangle
      EntityTexture mesh,tex
   End If
   tri_s=CountTriangles(GetSurface(mesh,CountSurfaces(mesh)))
   UpdateWorld
   RenderWorld
   Text 0,0,"Lod Mesh. WarWulf is a Sexy beast
   Text 0,16,"Press space to reduce triangles in mesh"
   Text 0,32,"Current triangle count="+tri_s
   Flip
Wend

FreeEntity cam
EndGraphics
End

Type vert
   Field x#
   Field y#
   Field z#
   Field u#
   Field v#
   Field oindex
   Field index
   Field nindex
   Field use
   Field cost#
   Field nei.vert
End Type

Type tri
   Field ind[3]
   Field mv[2]
   Field index
   Field tcost#
   Field use
End Type

Function Get_Data(mesh)
   surf=GetSurface(mesh,CountSurfaces(mesh))
   For index=0 To CountVertices(surf)-1
      a.vert=New vert
      a\index=index
      a\oindex=index
      a\use=True
      a\cost=1000000
      a\x=VertexX(surf,index)
      a\y=VertexY(surf,index)
      a\z=VertexZ(surf,index)
      a\u=VertexU(surf,index)
      a\v=VertexV(surf,index)
   Next
   For index=0 To CountTriangles(surf)-1
      b.tri=New tri
      b\use=True
      For c=0 To 2
         b\ind[c]=TriangleVertex(surf,index,c)
      Next
      Get_Tri_Cost#(b)
      cnt=cnt+1
      b\index=index
   Next
   
End Function

Function Find_Vert.vert(index)
   For a.vert=Each vert
      If a\index=index Then Return a
   Next
   Return Null
End Function

Function Create_New_Mesh(mesh,red)
   For it=1 To red
      del.tri=Get_Lowest_Cost_Tri()
      If del<>Null Then
         del\use=False
         reindex_tris(del\ind[del\mv[0]],del\ind[del\mv[1]])
      End If
   Next
   ;find the lowest cost (used vert)
   rol#=EntityRoll(mesh)
   pit#=EntityPitch(mesh)
   yaw#=EntityYaw(mesh)
   px#=EntityX(mesh,True)
   py#=EntityY(mesh,True)
   pz#=EntityZ(mesh,True)

   surf=GetSurface(mesh,1)
   ClearSurface surf,False,True

   For b.tri=Each tri
      If b\use=True Then
         AddTriangle surf,b\ind[0],b\ind[1],b\ind[2]
      End If
   Next
   UpdateNormals mesh
   RotateEntity mesh,pit,yaw,rol
   PositionEntity mesh,px,py,pz
   Return mesh
End Function

Function Get_Lowest_Cost_Tri.tri()
   cost#=100000
   pnt.tri=Null
   For a.tri=Each tri
      If a\use=True Then
         If a\tcost<cost Then
            cost=a\tcost
            pnt.tri=a
         End If
      End If
   Next
   Return pnt.tri
End Function

Function ReIndex_Tris(oldtri,newtri)
   For a.tri=Each tri
      p=0
      If a\ind[0]=oldtri Then a\ind[0]=newtri:p=1
      If a\ind[1]=oldtri Then a\ind[1]=newtri:p=1
      If a\ind[2]=oldtri Then a\ind[2]=newtri:p=1
      If p=1 Then Get_Tri_Cost(a)
   Next
End Function

Function Get_Tri_Cost#(a.tri)
   v0.vert=Find_Vert(a\ind[0])
   v1.vert=Find_Vert(a\ind[1])
   v2.vert=Find_Vert(a\ind[2])
   x0#=v0\x:y0#=v0\y:z0#=v0\z
   x1#=v1\x:y1#=v1\y:z1#=v1\z
   x2#=v2\x:y2#=v2\y:z2#=v2\z
   coord0#=Sqr((x0-x1)^2+(y0-y1)^2+(z0-z1)^2)
   coord1#=Sqr((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
   coord2#=Sqr((x2-x0)^2+(y2-y0)^2+(z2-z0)^2)
   
   If coord0<coord1 And coord0<coord2 Then p=0
   If coord1<coord0 And coord1<coord2 Then p=1
   If coord2<coord0 And coord2<coord1 Then p=2
   Select p
      Case 0
         a\mv[0]=1:a\mv[1]=0
      Case 1
         a\mv[0]=2:a\mv[1]=1
      Case 2
         a\mv[0]=0:a\mv[1]=2
   End Select
   a\tcost=coord1+coord2+coord3
   Return a\tcost
End Function

Garrett

  • Autococker
  • Posts: 1372
Re: AirBall!!!!!
« Reply #4 on: October 26, 2007, 05:11:29 PM »
what does that program do and what was it wrote in?

y00tz

  • Autococker
  • Posts: 2742
Re: AirBall!!!!!
« Reply #5 on: October 26, 2007, 11:50:56 PM »
Looks like Basic, I don't know, has DirectX tendencies, is it BlitzBasic Wulf?

WarWulf

  • Autococker
  • Posts: 539
Re: AirBall!!!!!
« Reply #6 on: October 27, 2007, 12:39:38 AM »
close its blitz3d part of the blitzbasic family and its a loding system, which means it has a function to reduce poly count on meshes\models ;)

Garrett

  • Autococker
  • Posts: 1372
Re: AirBall!!!!!
« Reply #7 on: October 27, 2007, 09:17:25 AM »
Does that language port to C? 

ViciouZ

  • Map Committee
  • Autococker
  • Posts: 2227
Re: AirBall!!!!!
« Reply #8 on: October 27, 2007, 02:37:34 PM »
Nothing easily just slides from one language to the next, ever. Unless the languages are similar types of BASIC. So basically, no.

Garrett

  • Autococker
  • Posts: 1372
Re: AirBall!!!!!
« Reply #9 on: October 27, 2007, 04:31:43 PM »
How would he be able to implement it into the game then?