How to use MeshVertex in PB 570b1

Everything related to 3D programming
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

How to use MeshVertex in PB 570b1

Post by applePi »

- Added: BuildMeshManualLod(), BuildMeshLod(), MeshVertex(),
CreateDataMesh()

How to use MeshVertex ?
Thanks
Fred
Administrator
Administrator
Posts: 16681
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How to use MeshVertex in PB 570b1

Post by Fred »

MeshVertex() is an all-in-one function to define a vertex, instead of using MeshVertexPosition, MeshVertexColor, MeshVertexNormal
and MeshVertexTextureCoordinate
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: How to use MeshVertex in PB 570b1

Post by DK_PETER »

Any chance for a small example?
Edit:
There is something wrong with the number of parameters.
TIA
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Fred
Administrator
Administrator
Posts: 16681
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How to use MeshVertex in PB 570b1

Post by Fred »

You are right, it will be fixed with in the next beta
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: How to use MeshVertex in PB 570b1

Post 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)

Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Post Reply