I found this code which works perfectly within B3D but converted to BMAX the lines aren't as nice anymore.
Any ideas why?
Any ideas why?
Import sidesign.minib3d Function createline(x1:Float, y1:Float, z1:Float, x2:Float, y2:Float, z2:Float, mesh = 0) If mesh = 0 Then mesh=CreateMesh() EntityFX(MESH, 1 + 4 + 16) surf = CreateSurface(MESH) verts = 0 AddVertex surf,x1#,y1#,z1#,0,0 Else surf = GetSurface(mesh,1) verts = CountVertices(surf)-1 End If 'AddVertex surf, x1:Float, y1:Float, z1:Float, 0, 0 ' or maybe change this to something like: AddVertex surf, x1:Float + 0.001, y1:Float + 0.001, z1:Float + 0.001, 0, 0 AddVertex surf,x2#,y2#,z2#,1,0 AddTriangle surf,verts,verts+2,verts+1 Return mesh End Function ' --- set graphics Graphics3D 640, 480, 32, 2 'SetBuffer(BackBuffer()) ' --- create scene setup camPiv = CreatePivot() camera = CreateCamera(camPiv) PositionEntity(camera, 0,0,-10) light=CreateLight(2) PositionEntity(light,4,10,0) LightRange(light,10) ' --- create test cube cube=CreateCube() ScaleMesh(cube, 2,1,1) EntityAlpha(cube, 0.5) cube2=CreateCube() ScaleMesh(cube2, 1.8,0.8,0.8) ' --- create lines lines = createLine(2,1,1, 1,2,1) lines = createLine(1,2,1, 0,2.3,1, lines) lines = createLine(0,2.3,1, -1,2,1, lines) lines = createLine(-1,2,1, -2,1,1, lines) EntityColor(lines, 255,0,0) ' okay, this is a bit cheating and very wrong/memory leak prone and shouldn't be used this way (because freeEntity(lines) will only free the last line) ' but i wanted To make more than one Line ' and not bother with typing even more hide- and showentity or rewriting the createline function:) ' ' yes, i am lazy ;) lines = createLine(2,1,-1, 1,2,-1) lines = createLine(1,2,-1, 0,2.3,-1, lines) lines = createLine(0,2.3,-1, -1,2,-1, lines) lines = createLine(-1,2,-1, -2,1,-1, lines) EntityColor(lines, 255,0,0) lines = createLine(-3,1,1, 3,1,1) EntityColor(lines, 255,0,0) lines = createLine(-5,1,-1, 4,1,-1) EntityColor(lines, 255,0,0) lines = createLine(-4,-1,1, 3,-1,1) EntityColor(lines, 255,0,0) lines = createLine(-3,-1,-1, 5,-1,-1) EntityColor(lines, 255,0,0) TurnEntity(campiv, 35,35,35) While Not KeyDown(KEY_ESCAPE) ' --- camera controls 'scrollwheel = MouseZSpeed() If MouseDown(1) Then TurnEntity(camPiv, MouseYSpeed(),-MouseXSpeed(),0) Else If scrollwheel <> 0 Then MoveEntity(camera, 0,0,scrollwheel*3) Else dummy = MouseYSpeed() dummy = MouseXSpeed() 'dummy = MouseZSpeed() ' prevent mousepeed blips. End If ' --- rendering CameraClsMode(CAMERA, 1, 1) Wireframe(0) HideEntity(lines) ShowEntity(cube) ShowEntity(cube2) RenderWorld() CameraClsMode(CAMERA, 0, 0) Wireframe(1) ShowEntity(lines) HideEntity(cube) HideEntity(cube2) RenderWorld() Flip() Wend End