I'm trying to expand a Mesh with a function i found, but the result is totally weird!
Instead of actually making the mesh bigger it seems to stretch it really odd...
Here's the code i'm using:
Import sidesign.minib3d
Graphics3D 640,480,32
Local Cam:TCamera=createCamera()
PositionEntity Cam,0,0,-10
Local ent:TMesh = createCube()
updateNormals ent
MeshExpand(ent,3)
While Not KeyDown(KEY_ESCAPE)
UpdateWorld
RenderWorld
Flip
Wend
Function MeshExpand(MESH:TMesh,am#)
For k=1 To countSurfaces(MESH)
surf=getSurface(MESH,k)
For Index=0 To CountVertices(surf)-1
newx#=VertexX(surf,Index)+VertexNX(surf,Index)*am
newy#=VertexY(surf,Index)+VertexNY(surf,Index)*am
newz#=VertexZ(surf,Index)+VertexNZ(surf,Index)*am
VertexCoords surf,Index,newx,newy,newz
Next
Next
End Function
(I can't use ScaleMesh since it doesn't work the same way)
Instead of actually making the mesh bigger it seems to stretch it really odd...
Here's the code i'm using:
Import sidesign.minib3d
Graphics3D 640,480,32
Local Cam:TCamera=createCamera()
PositionEntity Cam,0,0,-10
Local ent:TMesh = createCube()
updateNormals ent
MeshExpand(ent,3)
While Not KeyDown(KEY_ESCAPE)
UpdateWorld
RenderWorld
Flip
Wend
Function MeshExpand(MESH:TMesh,am#)
For k=1 To countSurfaces(MESH)
surf=getSurface(MESH,k)
For Index=0 To CountVertices(surf)-1
newx#=VertexX(surf,Index)+VertexNX(surf,Index)*am
newy#=VertexY(surf,Index)+VertexNY(surf,Index)*am
newz#=VertexZ(surf,Index)+VertexNZ(surf,Index)*am
VertexCoords surf,Index,newx,newy,newz
Next
Next
End Function
(I can't use ScaleMesh since it doesn't work the same way)