Saving Entities to File

Started by Amanda Dearheart, November 06, 2020, 04:26:45

Previous topic - Next topic

Amanda Dearheart

Is there anyway to save an entity and its properties(textures, vertices, surfaces, etc.) to file.
As the code I'm looking at is written in BlitzMax, anyone coding in BlitzMax may join in as well as Monkey coders and CerberusX coders.

Reason, there is a program called PlanetCreator on these forums written in BlitzMax that I want to use to create planets, and use the planets to import them to my sci-fi game.  I am planning to use Godot 3d to load the planets into, so I will need to have loaded in by Python.
Prepare to be assimilated !  Resistance is futile!

Matty

As pseudocode you want something like this:

Openfile to write
Write number of surfaces
For each surface write standard surface properties such as texture filename etc
For each surface write number of triangles and number of verts
Loop through each triangle
Loop through each triangle vertex and write vertex properties (xyz and uvw for each texture layer)

Close file.

On reading:

Open file for read.
Read number of surfaces
For each surface
Create surface load texture and apply properties
Read triangle and vertex count
Loop through triangles.
Create vertex.
Assign xyz and uvw for each vertex
Create triangle from vertices

Close file
Return mesh handle

Amanda Dearheart

What I meant was if any of the programs (Blitz3D, BlitzMax, or CerberusX) has any commands for saving entities.
BTW, thanks Matty.
Prepare to be assimilated !  Resistance is futile!

GrindalfGames

blitz3D does not have any commands for saving entities but there are some mesh exporters(*.x, *.3ds, *.b3d) in the code archives so you could sort one out yourself

RemiD

#4
QuoteIs there anyway to save an entity and its properties(textures, vertices, surfaces, etc.) to file.
blitz3d has all the commands necessary to save / load image, texture, mesh (with surfaces, vertices, triangles) but you need to write your own functions for custom file formats, or to load a rigged skinned mesh with animations. (i have posted an example here but i don't remember where...)
some examples which may help to write your own save/load texture / mesh functions :
https://www.syntaxbomb.com/index.php/topic,1962.msg2951.html
https://www.syntaxbomb.com/index.php/topic,1875.0.html

and for rigged skinned mesh with animations (with bones,  skinned vertices, vertices weights, animations, poses) you need to use the update v003 by bobysait.
see : https://mojolabs.nz/posts.php?topic=105408
an example on how to use :
(can't find the link but i have posted it somewhere on this forum... if you need an example send me a PM)