Page 1 of 1

How to use MeshVertex in PB 570b1

Posted: Thu May 31, 2018 3:00 pm
by applePi
- Added: BuildMeshManualLod(), BuildMeshLod(), MeshVertex(),
CreateDataMesh()

How to use MeshVertex ?
Thanks

Re: How to use MeshVertex in PB 570b1

Posted: Thu May 31, 2018 3:04 pm
by Fred
MeshVertex() is an all-in-one function to define a vertex, instead of using MeshVertexPosition, MeshVertexColor, MeshVertexNormal
and MeshVertexTextureCoordinate

Re: How to use MeshVertex in PB 570b1

Posted: Tue Jul 10, 2018 4:40 pm
by DK_PETER
Any chance for a small example?
Edit:
There is something wrong with the number of parameters.
TIA

Re: How to use MeshVertex in PB 570b1

Posted: Wed Jul 11, 2018 11:24 am
by Fred
You are right, it will be fixed with in the next beta

Re: How to use MeshVertex in PB 570b1

Posted: Wed Jul 11, 2018 2:20 pm
by DK_PETER
@Fred
Thanks ;-)

;Basic Example without knowing what the last parameter does. :-)

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

ExamineDesktops()
OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), "MeshVertex", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0))
CreateCamera(0, 0, 0, 100, 100)

CreateMesh(0)  ;just testing
MeshVertex( 0.5,   0, -0.5,   0,   1,   0,   0,   1,   0, 0.5)
MeshVertex(-0.5,   0, -0.5,   1,   1,   0,   0,   1,   0, 0.5)
MeshVertex( 0.5,   0,  0.5,   0,   0,   0,   0,   1,   0, 0.5)
MeshVertex(-0.5,   0,  0.5,   1,   0,   0,   0,   1,   0, 0.5)
MeshVertex( 0.5,   0, -0.5,   0,   1,   0,   0,   1,   0, 0.5)
MeshVertex(-0.5,   0, -0.5,   1,   1,   0,   0,   1,   0, 0.5)
MeshVertex( 0.5,   0,  0.5,   0,   0,   0,   0,   1,   0, 0.5)
MeshVertex(-0.5,   0,  0.5,   1,   0,   0,   0,   1,   0, 0.5)
MeshVertex( 0.5,   0, -0.5,   0,   1,   0,   0,   1,   0, 0.5)
FinishMesh(#True)

CreateTexture(0, 60, 60)
StartDrawing(TextureOutput(0)) 
FrontColor($333333) : BackColor($FFFFFF)
DrawingMode(#PB_2DDrawing_Gradient)
BoxedGradient(0, 0, 60, 60)
Box(0, 0, 60, 60) 
StopDrawing()
CreateMaterial(0, TextureID(0)) : MaterialCullingMode(0, #PB_Material_NoCulling)
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, -5)

Repeat
  
  Repeat
    ev = WindowEvent()
  Until  ev = 0
  RotateEntity(0, 0.2, 0.2, 0.2, #PB_Relative)
  RenderWorld()
  
  FlipBuffers()
  ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)