Shape editor

Blitz3D Forums/Blitz3D Programming/Shape editor

Also, the triangle will not be lit by your light because

1) The vertices do not have any normals
2) The directional light you created is not pointing at the triangle

To fix this I gave each vertex a normal which pointed up and changed the light to a point light then moved it above the triangle.

This must be alot to take in but stick with it! ;)

; Sets 3D graphics mode
Graphics3D 640,480,16,0
SetBuffer BackBuffer()

camera=CreateCamera()
light=CreateLight(2); create a point light, this sends light in all directions
PositionEntity (camera, 0,1,-4)
PositionEntity light,0,100,0 ;move light above the triangle

;Create a mesh
water_mesh = CreateMesh()
;create a surface and attach to mesh
water_surface = CreateSurface(water_mesh)
;create 3 vertex
AddVertex(water_surface, 0,0,0):VertexNormal(water_surface,0,0,1,0) ;vertex 0 and normal
AddVertex(water_surface, 0,0,1):VertexNormal(water_surface,1,0,1,0) ;vertex 1 and normal
AddVertex(water_surface, 1,0,1):VertexNormal(water_surface,2,0,1,0) ;vertex 2 and normal

water_triangle = AddTriangle(water_surface, 0,1,2)

brush=CreateBrush(120,120,5)

PaintMesh(water_mesh, brush)


While Not KeyDown( 1 )
	RenderWorld
	Flip
Wend

End