World Editor Copyentity vs Loadmesh

Blitz3D Forums/Blitz3D Beginners Area/World Editor Copyentity vs Loadmesh

Aussie(Posted 2013) [#1]
Hey everyone, so i am progressing through my world editor & am thinking about how i want to load everything within the editor & how to load everything into a game after i have exported the scene. How do others do it & what are the pros & cons of Copyentity & Loadmesh within an editor & loading an exported scene?
I know loading speed would be affected, being slower with Loadmesh & Lightmesh has problems with Copyentity.
Anything else?


Zethrax(Posted 2013) [#2]
You should obviously try to minimize loading as much as possible to speed up the loading time and reduce wear and tear on the user's hard drive. Where possible, load the mesh once and then use CopyEntity to instance it or CopyMesh ( http://www.blitzbasic.com/b3ddocs/command.php?name=copymesh&ref=goto ) to create a new copy of the mesh.

Where you have near identical meshes that you want to keep as individual entities (for effective visibility culling, etc) with some data that is different (UV data for light-mapping, etc) then it's probably best to make them into a compound model (consisting of a parent with a hierarchy of children) and load them with LoadAnimMesh ( http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimMesh&ref=goto ). This way the level, etc that these entities are part of can be stored and loaded as a single file, which should be more efficient to load.


RemiD(Posted 2013) [#3]
loadmesh >> when you want to load a static mesh without joints and without influences of some joints over some vertices

loadanimmesh >> when you want to load a skinned mesh with joints and with influences of some joints over some vertices (not necessarily, the joints can also be used as pivots)

copymesh >> when you want to copy a static mesh an be able to alter its surfaces, its vertices, without altering the source mesh.

copyentity >> when you want to copy a static mesh or a skinned mesh, but if you alter its surfaces, its vertices, it will alter the source mesh.


Gabriel(Posted 2013) [#4]
loadanimmesh >> when you want to load a skinned mesh with joints and with influences of some joints over some vertices (not necessarily, the joints can also be used as pivots)

Not only skinned models. If your model has any kind of hierarchy that you need to retain - as scenes/levels usually do - you should still use LoadAnimMesh.


Aussie(Posted 2013) [#5]
Thanks all, very helpful in making decisions on how to handle it now. :)


Aussie(Posted 2013) [#6]
Ok, I think i am going to change the way i create new entities in my world editor now.
Instead of loading an entity every time i want to place one in a level/scene i think i will pre load them & then copy them. Just have a couple of questions.
If using multiple meshs of the same mesh loaded through loadanimmesh, should each mesh be loaded individually when loaded into a game or is copymesh ok if i don't want to alter the copied animmesh in the game?

I am thinking the best way to do this would be to load the source meshes into a type then have a GUI window setup for selecting each source & making a copy of it for the editor

something like
Type Scource_entity
     Field File_path
     Field Mesh_type (static, dynamic, anim)
     Field Mesh
     Field Name
End type

File_path = C:\programfiles\blitz3d\mystuff\editor\media\models\whatever.b3d

Mesh_type = Select Mesh_type
     Case "static"
             Mesh = loadmesh
     Case "dynamic"
             Mesh = loadmesh
     Case "anim"
             Mesh = loadanimmesh
end select

Name = whatever.b3d

My question with this is, is there a way to trim down a string so that File_path would end up
File_path = \media\models\whatever.b3d ?
& i could then use the same thing to return the name so it would be
Name = whatever.b3d

That way when i make a game it doesn't matter if the file is in the same place on someone else's hard drive as long as the content is in the same folder.


RemiD(Posted 2013) [#7]

If using multiple meshs of the same mesh loaded through loadanimmesh, should each mesh be loaded individually when loaded into a game or is copymesh ok if i don't want to alter the copied animmesh in the game?


If you don't plan to alter the surfaces of the animated mesh, then you can use copyentity to have this animated mesh several times in your world.
You can animate each copied animated mesh with different animations.
But you can't modify its surfaces or its textures or it will affect the source mesh and consequently all copied meshes.

You can't use copymesh for an animated mesh, it must be copyentity.
Copymesh only duplicates the surfaces, the vertices, the triangles.


Aussie(Posted 2013) [#8]
Thanks for that RemiD.
Can anyone help with the trimming down of strings?

I should have said that i use a variable for the file path string along with a file selector, so it's not just a manually entered string. I would like to know if it is possible to find the third or however many \'s from the right hand side of the string then cut the rest of the string out so instead of the string being
C:\programfiles\blitz3d\mystuff\editor\media\models\whatever.b3d
it would become
\media\models\whatever.b3d


dynaman(Posted 2013) [#9]
> Can anyone help with the trimming down of strings?
The code archives, file section is where you want to look. I think this post is what you need.

http://www.blitzbasic.com/codearcs/codearcs.php?code=2073


Aussie(Posted 2013) [#10]
Thanks for that dynaman. :)