Results 1 to 5 of 5

Thread: Loading dae file from memory

  1. #1
    Junior Member
    Join Date
    Aug 2006
    Posts
    3

    Loading dae file from memory

    Hello everybody,

    When loading dae file from memory, I need to provide a name:

    dae->load("file://./test.dae", memoryBlock);

    But I found that the name must be the exact location of the dae file, otherwize the getElement() function of daeURI objects will always return NULL.

    If the dae is streamed from network, do I need to save the stream to a file in order to load it correctly? Is there any better way to load dae from memory?

    Thanks!

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    The scheme can only be used for absolute URI. ('file:' and 'http:' are schemes)

    You will have to construct the absolute URI in your application from where the file is supposed to be located. The DOM can help with this, since it has an API to set the base URI for the document, that will subsequently be appended to the parameter passed in the load() API, forming the absolute URI.

    BTW, "file://./test.dae" is an invalid URI. It lacks the host part, it should be using "///" which is the same as "//localhost/". But it is still not a relative path, basically the "./" will be ignored.


    If the dae is streamed from network, do I need to save the stream to a file in order to load it correctly? Is there any better way to load dae from memory?
    The COLLADA DOM should support the 'http:' scheme, since it is built in libXML2.

  3. #3
    Junior Member
    Join Date
    Aug 2006
    Posts
    3
    Thank you! remi.

    I found that I don't need to provide the exact location. It works if the scheme and the file extension are correct. Thanks!

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    Mannam,

    Can you please post an example of what you mean when you say it works?

    Thanks.

  5. #5
    Junior Member
    Join Date
    Aug 2006
    Posts
    3
    For the following case, the extension is not supported, daeURI fails,

    dae->load("file:///test.abc", memoryBlock);

    but if I use valid scheme and extension,

    dae->load("file:///test.dae", memoryBlock);

    daeURI works even the file test.dae does not exist.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •