It is currently Thu May 28, 2020 6:43 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Undocumented function EntityMesh()
PostPosted: Sun Mar 31, 2019 2:25 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 853
Location: Denmark
Hi
What is the purpose of
Code:
EntityMesh(#Entity, MeshID)
?

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented function EntityMesh()
PostPosted: Sun Mar 31, 2019 5:01 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6177
Location: Wales, UK
Hi DK_PETER

Referenced here:
https://github.com/SicroAtGit/PureBasic-CodeArchiv-Rebirth/blob/master/Gadget/ScintillaGadget/ScintillaText/PBFunctionList.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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented function EntityMesh()
PostPosted: Sun Mar 31, 2019 6:21 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 853
Location: Denmark
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:
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)

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented function EntityMesh()
PostPosted: Thu Mar 12, 2020 12:42 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 853
Location: Denmark
Is EntityMesh a deactivated and redundant function?

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented function EntityMesh()
PostPosted: Thu Mar 12, 2020 1:44 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1404
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:
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented function EntityMesh()
PostPosted: Thu Mar 12, 2020 2:02 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 853
Location: Denmark
@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.

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye