CreateLine3D()

Syntax

Result = CreateLine3D(#Mesh, x, y, z, Color, x2, y2, z2, Color2)
Description
Create a new 3D line mesh. The line is a wireframe object which can be used to ease debugging. To change the line position, just create it again.

Parameters

#Mesh The number to identify the new mesh. #PB_Any can be used to auto-generate this number.
x, y, z The first point coordinate of the line, in world units.
Color The color to be used by the first point. RGB() can be used to get a valid color.
x2, y2, z2 The second point coordinate of the line, in world units.
Color2 The color to be used by the second point. If this color is different than the color set for the first point, then a gradient between this two colors will be created. RGB() can be used to get a valid color.

Return value

Returns nonzero if the mesh was created successfully and zero if there was an error. If #PB_Any was used as the #Mesh parameter then the new generated number is returned on success.

Example

  InitEngine3D() 
  InitSprite() 
  
  OpenWindow(0, 0, 0, 640, 480, "Line3D example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0)
  
  ; Light
  CreateLight(#PB_Any, RGB(25, 25, 180), -5, 10, 5, #PB_Light_Point)
  
  ; Camera
  CreateCamera(0, 0, 0, 100, 100)
  MoveCamera(0, 2, 1, 3, #PB_Absolute | #PB_Local)
  CameraLookAt(0, 0, 0, 0)
  
  ; Create the line and attach it to the scene
  CreateLine3D(0, 0, 0, 0, RGB(255, 0, 0), 1, 1, 1, RGB(0, 0, 255))
  CreateEntity(0, MeshID(0), #PB_Material_None)
  
  Repeat
    RenderWorld()
    FlipBuffers()
  Until WaitWindowEvent(1) = #PB_Event_CloseWindow

See Also

FreeMesh(), CreateSphere(), CreateMesh(), CreateCube(), CreatePlane(), CreateCylinder()

Supported OS

All

<- CreateIcoSphere() - Mesh Index - CreateMesh() ->