Ok, here is a rough thing. I think sswift did something similar?
Arrow keys to move camera. press "1" to generate the outline.
Graphics3D 800,600
SetBuffer BackBuffer()
Global piv = CreatePivot()
Global camera = CreateCamera(piv)
PositionEntity camera,0,0,-10
light = CreateLight()
Global cube = Createtorus(5,1,10,5)
CameraClsColor camera,200,200,200
While Not KeyHit(1)
If KeyHit(2) Then
outline_mesh = create_outline(cube)
UpdateNormals cube
End If
If KeyDown(200) Then RotateEntity piv,EntityPitch(piv)+1,EntityYaw(piv),0
If KeyDown(208) Then RotateEntity piv,EntityPitch(piv)-1,EntityYaw(piv),0
If KeyDown(203) Then RotateEntity piv,EntityPitch(piv),EntityYaw(piv)+1,0
If KeyDown(205) Then RotateEntity piv,EntityPitch(piv),EntityYaw(piv)-1,0
UpdateWorld
RenderWorld
Flip
Wend
End
Function create_outline(entity)
Local outline = CopyMesh(entity,entity)
Local surf = GetSurface(entity,1)
Local verts = CountVertices(surf)
Local dest_surf = GetSurface(outline,1)
Local x#,y#,z#
For loop = 0 To verts-1
x = VertexX(surf,loop) + (VertexNX(surf,loop)*0.1)
y = VertexY(surf,loop) + (VertexNY(surf,loop)*0.1)
z = VertexZ(surf,loop) + (VertexNZ(surf,loop)*0.1)
VertexCoords dest_surf,loop,x,y,z
Next
EntityColor outline,100,100,100
EntityFX outline,1
FlipMesh outline
Return outline
End Function
Function CreateTorus(torrad#,torwidth#,segments,sides,parent=0)
torusmesh=CreateMesh(parent)
surf=CreateSurface(torusmesh)
FATSTEP#=360.0/sides
DEGSTEP#=360.0/segments
radius#=0
x#=0
y#=0
z#=0
fat#=0
Repeat
radius = torrad + (torwidth)*Sin(fat)
deg#=0
z=torwidth*Cos(fat)
Repeat
x=radius*Cos(deg)
y=radius*Sin(deg)
AddVertex surf,x,y,z,x,y,z
deg=deg+DEGSTEP
Until deg>=360
fat=fat+FATSTEP
Until fat>=360
For vert=0 To segments*sides-1
v0=vert
v1=vert+segments
v2=vert+1
v3=vert+1+segments
If v1>=(segments*sides) Then v1=v1-(segments*sides)
If v2>=(segments*sides) Then v2=v2-(segments*sides)
If v3>=(segments*sides) Then v3=v3-(segments*sides)
AddTriangle surf,v0,v1,v2
AddTriangle surf,v1,v3,v2
Next
UpdateNormals torusmesh
Return torusmesh
End Function
Credit to BODYPRINT for the CreateTorus() function. Very simple to work. It works good on a mesh that is a closed mesh, as it uses vertex normals to project the outline. So, make sure there's no cracks :o)