Thanks, Stevie - sorry I forgot, it was quite a while ago.
I still can't get it to work, I even tried usign some texture flags, but that didn't help.
Here's what I have so far (I altered the camera position and range so that the image fills the viewport.)
I still can't get it to work, I even tried usign some texture flags, but that didn't help.
Here's what I have so far (I altered the camera position and range so that the image fills the viewport.)
Graphics3D 640,480,16,1 Global CAMERA = CreateCamera() CameraRange CAMERA,0.001,10 WireFrame 0 PositionEntity CAMERA, 0,0,-1.3 Const Radius# = 1.0 FLAT = MESHflat( Radius * Pi ,2,Radius , 16 ) : HideEntity FLAT TUBE = MESHtube( Radius,2,Radius , 16 ) : HideEntity TUBE Tubtext=LoadTexture("SoH%20Map2.jpg") brush=CreateBrush() BrushTexture brush,Tubtext PaintMesh Tube,brush VISIBLE = MESHflat( 1,1,1 , 16 ) PaintMesh FLAT,brush Dir# = 1.0 : TimeStep# = 0.0 While Not KeyDown(1) TimeStep = TimeStep + .01 * Dir If TimeStep >= 1.0 Dir = - 1 If TimeStep <= 0.0 Dir = 1.0 MESHmorph( VISIBLE , TUBE, FLAT , TimeStep ) RenderWorld() Flip Wend ;==================================================================================== ;==================================================================================== ;==================================================================================== Function MESHmorph( Source , Initial , Final , T# ) ss = GetSurface( Source , 1 ) is = GetSurface( Initial , 1 ) fs = GetSurface( Final , 1 ) For v = 0 To CountVertices( ss ) - 1 Nx# = VertexX( is, v ) + ( VertexX( fs , v ) - VertexX( is , v ) ) * T Ny# = VertexY( is, v ) + ( VertexY( fs , v ) - VertexY( is , v ) ) * T Nz# = VertexZ( is, v ) + ( VertexZ( fs , v ) - VertexZ( is , v ) ) * T VertexCoords ss, v , Nx, Ny, Nz Next End Function ;==================================================================================== ;==================================================================================== ;==================================================================================== Function MESHflat( Sx#, Sy#, Sz#, Segs = 8 ) Mesh = CreateMesh() s = CreateSurface( Mesh ) For l = 0 To Segs - 1 a0# = - Sx + 2.0 * Sx * Float( l ) / Float( Segs ) a1# = - Sx + 2.0 * Sx * Float ( l + 1 ) / Float( Segs ) v0 = AddVertex( s , a0 , Sy, Sz ,(l/Segs ),0) v1 = AddVertex( s , a1 , Sy, Sz,((l+1)/Segs ),0) v2 = AddVertex( s , a1 , -Sy, Sz,((l+1)/Segs),1 ) v3 = AddVertex( s , a0, -Sy, Sz , (l/Segs),1) AddTriangle s, v0, v1, v2 AddTriangle s, v2, v3, v0 Next Return Mesh End Function ;==================================================================================== ;==================================================================================== ;==================================================================================== Function MESHtube( Sx#, Sy#, Sz# , Segs = 8 ) Mesh = CreateMesh() s = CreateSurface( Mesh ) For l = 0 To Segs - 1 a0# = 90.0 + l * 360.0 / Float( Segs ) ;+90 important so starts at rear a1# = 90.0 + ( l + 1 ) * 360.0 / Float( Segs ) v0 = AddVertex( s , Sx * Cos( a0 ) , Sy , Sz * Sin( a0 ),(l/Segs ),0 ) v1 = AddVertex( s , Sx * Cos( a1 ) , Sy , Sz * Sin( a1 ) ,(l/Segs ),0) v2 = AddVertex( s , Sx * Cos( a1 ) , -Sy , Sz * Sin( a1 ),(l/Segs ),0 ) v3 = AddVertex( s , Sx * Cos( a0 ) , -Sy , Sz * Sin( a0 ),(l/Segs ),0 ) AddTriangle s, v0, v1, v2 AddTriangle s, v2, v3, v0 Next Return Mesh End Function