Undocumented function EntityMesh()

Everything related to 3D programming
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Undocumented function EntityMesh()

Post by DK_PETER »

Hi
What is the purpose of

Code: Select all

EntityMesh(#Entity, MeshID)
?
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.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Undocumented function EntityMesh()

Post by IdeasVacuum »

Hi DK_PETER

Referenced here:
https://github.com/SicroAtGit/PureBasic ... onList.txt

It says:
EntityMesh (#Entity, MeshID) - Change the #Entity mesh with the new one.

...but I'm not sure the description is correct - if it is correct, then surely the function name could be better, to suggest it's purpose.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Undocumented function EntityMesh()

Post by DK_PETER »

Hi IdeasVacuum

That was my initial thought. But unless I'm missing a step somewhere or my interpretation of
what the function should do is wrong, I can't seem to get it working.
It might not work at all and completely redundant. :)

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

OpenWindow(0, 0, 0, 800, 600, "EntityMesh", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 5)
CreateLight(0, $FF00FF, -2, -3, 0)
CreateSphere(0, 2) ;Mesh 0
CreateCube(1, 2)   ; Mesh 1
CreateTexture(0, 512, 512)
StartDrawing(TextureOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient)
FrontColor($00005200) : BackColor($FF005200)
For y = 0 To 512 Step 16
  For x = 0 To 512 Step 16
    BoxedGradient(x, y, 512, 4)
    Box(0, y, 512, 4)
  Next x
Next y
StopDrawing()
CreateMaterial(0, TextureID(0))
MaterialBlendingMode(0, #PB_Material_Add)
MaterialCullingMode(0, #PB_Material_NoCulling)
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0) ; Entity 0
ScaleMaterial(0, 0.5, 0.5)

Repeat
  Repeat : ev = WindowEvent() : Until  ev = 0
  
  ExamineKeyboard()
  
  If KeyboardReleased(#PB_Key_F1)
    EntityMesh(0, MeshID(1))
    Debug "Swap mesh in entity with Cube"
  ElseIf KeyboardReleased(#PB_Key_F2)
    EntityMesh(0, MeshID(0))
    Debug "Swap mesh in entity with Sphere"
  EndIf
  
  RenderWorld()

  FlipBuffers()
  
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.
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Undocumented function EntityMesh()

Post by DK_PETER »

Is EntityMesh a deactivated and redundant function?
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.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Undocumented function EntityMesh()

Post by applePi »

Hi DK_PETER
i believe it is a forgotten not working function, should be removed
we can replace it with something like this in your above code

Code: Select all

If KeyboardReleased(#PB_Key_F1)
    ;EntityMesh(0, MeshID(1))
    FreeEntity(0)
    CreateEntity(0, MeshID(1), MaterialID(0), 0, 0, 0) ;
    Debug "Swap mesh in entity with Cube"
  ElseIf KeyboardReleased(#PB_Key_F2)
    ;EntityMesh(0, MeshID(0))
    FreeEntity(0)
    CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0) ;
    Debug "Swap mesh in entity with Sphere"
  EndIf
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Undocumented function EntityMesh()

Post by DK_PETER »

@applePi
I do think this is a forgotten or redundant function and is easily substituted
by freeing and creating the entity again.
It should be removed/hidden unless we can use it.
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