Jump to content

LoadModel, Sound, Mesh, Texture from memory


wh1sp3r
 Share

Recommended Posts

It will be good to load model from array. I can use C function to load file into array and call command LoadObjectFromArray( char* array, int parameters) ... etc

 

why is it good ? because we can have own loading mechanism, multithreaded :) loading from memory is fast enough in realtime (i think) :)

  • Upvote 1

-= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=-

Website: http://www.flamewarestudios.com

Link to comment
Share on other sites

  • 4 months later...

I agree with this, and honestly it should be as easy as copying the memory from one thread to another.

 

This must be possible. If someone knew how to sniff around memory they should be able to figure out the structures of these entities and be able to get this going. I would assume one you knew the memory structures of say a Mesh and all the related memory structures needed around it, you would be able to copy that memory from one thread to another.

  • Upvote 1
Link to comment
Share on other sites

I wanted to suggest this a while ago (Dec '09 sort of time) but I also spotted some complications. When a model is loaded, say "something.gmf" the engine searches for:

something.gmf

something.phy

something.mat

somethingLODx.gmf

 

How would this be done with memory? You would have to provide a memory address for at least the first three of those.

How would it handle LOD meshes? The only realistic way I could think of was the ability to add them with separate function calls later on

Example:

TModel Something = LoadModel("Something.gmf");
AddModelLOD(Something,2,"SomethingLOD2.gmf");

 

Without something like that, you would have to make the engine aware of how many pointers you want to pass.

 

Then there's mat file issue. How would you specify the texture being in memory? You simply cannot know where your texture is going to be allocated.

 

I mean I would be in favour of packing everything into a single (encrypted) binary file that you can decrypt once it's in memory. The file would say how many LOD meshes there were, how many textures there were, and would list the size of each mesh / physics file, so you could know how many bytes to skip when loading of portion of the overall model.

 

But simply saying you want to load from memory, I don't think is a very good idea unless you could describe ..how.. you want to load from memory.

 

I was thinking about this again recently, because I was thinking about writing a short tutorial about quick, simple encryption. But I soon realised that there is no practical use for it in Leadwerks, because you have to load the decrypted files from the hard disk. Anyone being concerned enough to want to encrypt their assets in the first place will know that the the second their decrypted files hit the hard disk, they're vulnerable.

 

 

Edit: I should add the the issues I listed mostly only apply to LoadModel. Loading an individual texture / sound from memory should be relatively straight forward.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Ideally, it would be nice if we could get a pointer for any loaded entity. Some kind of function like, GetEntityPointer() so we have the memory address to start with. Then if we could get a detailed description of the memory structure for each entity. If we had that we should be able to do some cool things. You could get the entity for texture and/or material on a loaded model. Then from that you could call this GetEntityPointer() method to get the memory location of it. Then use that types memory layout to copy it.

 

There has to be a way to get this information, with some kind of memory sniffer and some trial and error.

Link to comment
Share on other sites

i would LOVE to be able to load a texture from memory. I want to create a 3d slideshow using photos from a folder. Currently i can't load .jpg, .bmp etc. as a texture. ( or at least not that i am aware of ) The .dds converter tool is just too slow.

AMD Phenom II X6 Black Edition, 8GB, 120 GB SSD, 2TB HDD, nVidia GTX 570 1.2GB, Win 7 x64

Intel Core i5, 4GB, 120GB SSD, NVidia 360M 1GB, Win 7 x64

Link to comment
Share on other sites

As I'm thinking about this, and messing around with memory sniffers, I think one would have to someone add the TEntity value that gets normally returned, to some kind of list on the main thread. I assume the main thread has a list of these that point to the internal storage so it can act on the data. Not sure how one could do that.

Link to comment
Share on other sites

The handles exposed in the DLL are actually memory pointers, integers.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...