[Fix]Porting code B3D To BlitzMax?

BlitzMax Forums/BlitzMax Programming/[Fix]Porting code B3D To BlitzMax?

Yue(Posted 2016) [#1]
Hello, someone with experience and who wants to help us carry this code to BlitzMax , try the exporter but has not worked.




RustyKristi(Posted 2016) [#2]
Here's a compiled successfully version and I created a new thread with that project title to make it more specific. It just doesn't work (crashes) but it builds successfully.

http://www.blitzbasic.com/Community/posts.php?topic=106376

I disabled the password in PakMaker to make it simple. The contents of the "DATA.PAK" pakfile is just the camel.b3d in openb3d/b3d sample.

Maybe someone can pick it up and check out some incompatibilities presented here.

I'm guessing the peek and poke stuff but still I'm not that yet familiar with advanced b3d methods.

Included are converted sources with some slight modifications to get it to build, the terapack packer program, camel.b3d and data.pak file.


Yue(Posted 2016) [#3]
=)

"Hi John "Yue",

Thanks for getting in touch. Sadly I don't have much spare time these days :)!

Fortunately I ported the TeraPack to blitzmax a while back. Should still work, I've uploaded the files you need (the packer needs .NET), just use the stream identifier pak::

Download here: https://s3.amazonaws.com/EFNL/Packmaker.zip

Regards,

Lee Page
TeraBit Software"


RustyKristi(Posted 2016) [#4]
That's great. I did test it in minib3d and it works great. With OpenB3D it has loading issues, maybe it is more C++ oriented than mini.


Yue(Posted 2016) [#5]
To me it does not work , not if you do not use tell me if this correct ?.

Import  xorsteam.xors3d 
Include "Tipos/TGraphics3D.bmx"
Include "Tipos/TCamara.bmx"
Include "Tipos/TCubo.bmx"
 


Global PakStreams:PakStream = New PakStream
Global PakGlobals:TPakGlobal = New TPakGlobal

Include "Includes/TeraPak.bmx"
PakInit("DATA.PAK", $3F97DA40, $72D3B8C2)


ConfigEngine()

' Objetos.
'----------------
oG3D:TGraphics3D = TGraphics3D.Init()
xAppTitle ( nombreAPP:String )	

oCamara:TCamara = TCamara.Init()
xCameraClsColor ( oCamara.camara, 255,133,74,0 )

oCubo:TCubo = TCubo.Init()
xPositionEntity oCubo.cubo:Int, 0, 0, 10
xCreateLight()

Robot = xLoadMesh("pak::Robot.b3d")

Print Robot

While Not xKeyDown(xKEY_ESCAPE:Int)

   xTurnEntity(robot:Int,1,1,1)
   xUpdateWorld()
   xRenderWorld()
   InfoDebug()
   xFlip()
   
   If (xKeyDown(xKEY_UP:Int)) End 

  
Wend
' Liberando memoria.
'----------------------

oCamara.DeInit()
oCubo.DeInit()

oG3D.DeInit()
xDeInit()


'xFreeEntity ( cubo:Int)
'xFlushKeys()




RustyKristi(Posted 2016) [#6]
With minib3d, this works with a few modifications but fails with OpenB3d and I don't know about Xors3d because I don't have it.

I still have problems as well as I'm working on OpenB3D and not minib3d.


Yue(Posted 2016) [#7]
"pak::Music\Fireworks.wav"


not understand this, no where it defines " pak ::. nor how it works .... you can read the package, but the model is not stored in the variable.


RustyKristi(Posted 2016) [#8]
The new Packmaker that Lee provided which you have shared, supports directory structures. You can see the tool now with the "+" icon.

That's why in that example "Music/Firework.wav", it should work.


Yue(Posted 2016) [#9]
xPackFile* xMountPackFile  ( const char *  path,  
  const char *  mountpoint = "",  
  const char *  password = ""  
 )   

Mounts a zip file as a part of the file system and returns its handle. 

Use a zip file as a pack of your resources. Use of packs allows to compress the resources and to encrypt them with a password. Once mounted pack file becomes visible for the engine as a part of the file system. The second parameter is a mount point which is the location in the file system structure where a mounted pack file appears.

When you load some media, the engine searches that media in the mounted pack files first. For instance, the pack was mounted by using following

xMountPackFile("textures.zip", "textures\", "super_password");

Since now a pack file "textures.zip" is seen as a "textures\" directory.

If you load some texture by using

xLoadTexture("textures\something.dds");

the engine will try to load a texture "something.dds" from the pack mounted before since its mount point is "textures\". If there isn't such texture in the pack, the engine will try to load it from the disk using the path "textures\something.dds".

Such system allows you to develop and release your applications with ease. During development use loading from the disk. Before release pack your media and mount the packs using proper mount points.

Note:
: You can only read from packs (i.e. xReadFile(), xFileType() and xFileSize(), etc) You can't create, delete or change files in the packs. 
Parameters:
path A path to the pack file.  
mountpoint Mount point of the pack file.  
password A password of the pack file 



Xoros3D for blitzmax support pack zip resource...


Yue(Posted 2016) [#10]
Fixed to save a mesh BlitzMax in a resource file encryption, the secret is to change the name d ela mesh, for example if the mesh is called Robot.b3d, the name would robot.jpg, and ready to function very well.