Horde3D http://horde3d.org/forums/ |
|
[solved] Recommended way to load geometry from memory? http://horde3d.org/forums/viewtopic.php?f=2&t=950 |
Page 1 of 1 |
Author: | craigomatic [ 20.09.2009, 12:30 ] | ||
Post subject: | [solved] Recommended way to load geometry from memory? | ||
Hi all, we've just begun development using this terrific engine and I have some questions regarding the best way to load content from memory. I'm using the .NET wrapper and I've attempted to load the attached box in the following way: Code: //insert a null terminator into the xml byte stream MemoryStream ms = _LoadEmbeddedResource() // ms.Position = ms.Length -1; ms.WriteByte((byte)'\0'); //insert null terminator byte[] bytes = ms.ToArray(); resId = h3d.addResource((int)h3d.H3DResTypes.SceneGraph, resourceName, 0); h3d.loadResource(resId, bytes, bytes.Length); int node = h3d.addNodes(h3d.H3DRootNode, resId); The result of which is a screen without my boxes and a log that looks like this: Quote: 0.000 Initializing GL2 backend using OpenGL driver '3.0.0' by 'NVIDIA Corporation' on 'GeForce 8400M GS/PCI/SSE2' 0.020 Loading resource 'pipelines/forward.pipeline.xml' 0.020 Loading resource 'overlays/font.material.xml' 0.020 Loading resource 'overlays/panel.material.xml' 0.020 Loading resource 'pipelines/globalSettings.material.xml' 0.021 Loading resource 'shaders/overlay.shader' 0.021 ---- C O M P I L I N G . S H A D E R . shaders/overlay.shader@OVERLAY[0] ---- 0.027 Loading resource 'overlays/font.tga' 0.048 Loading resource 'textures/common/white.tga' 0.049 Loading resource 'textures/ambientMap.dds' 4.366 Loading resource 'box.scene.xml' If I store my content on disk and load using Horde3DUtils.loadResourcesFromDisk, all works as expected and I can see the boxes. It seems to pick up the missing shaders, materials, etc automatically: Quote: 0.000 Initializing GL2 backend using OpenGL driver '3.0.0' by 'NVIDIA Corporation' on 'GeForce 8400M GS/PCI/SSE2' 0.019 Loading resource 'pipelines/forward.pipeline.xml' 0.019 Loading resource 'overlays/font.material.xml' 0.019 Loading resource 'overlays/panel.material.xml' 0.020 Loading resource 'pipelines/globalSettings.material.xml' 0.020 Loading resource 'shaders/overlay.shader' 0.020 ---- C O M P I L I N G . S H A D E R . shaders/overlay.shader@OVERLAY[0] ---- 0.025 Loading resource 'overlays/font.tga' 0.045 Loading resource 'textures/common/white.tga' 0.046 Loading resource 'textures/ambientMap.dds' 10.602 Loading resource 'models/box/box.scene.xml' 10.602 Loading resource 'models/box/box.geo' 10.603 Loading resource 'models/box/box.material.xml' 10.603 Loading resource 'shaders/model.shader' 10.603 Loading resource 'shaders/utilityLib/vertCommon.glsl' 10.604 Loading resource 'shaders/utilityLib/vertSkinning.glsl' 10.604 ---- C O M P I L I N G . S H A D E R . shaders/model.shader@SHADOWMAP[0] ---- 10.610 Loading resource 'shaders/utilityLib/fragDeferredWrite.glsl' 10.610 ---- C O M P I L I N G . S H A D E R . shaders/model.shader@ATTRIBPASS[0] ---- 10.615 Loading resource 'shaders/utilityLib/fragLighting.glsl' 10.615 ---- C O M P I L I N G . S H A D E R . shaders/model.shader@LIGHTING[0] ---- 10.630 ---- C O M P I L I N G . S H A D E R . shaders/model.shader@AMBIENT[0] ---- I've tried various incarnations of my code including manual loading of the material and geometry using similar code to the above, but I can't quite get it correct
|
Author: | marciano [ 20.09.2009, 19:47 ] |
Post subject: | Re: Recommended way to load geometry from memory? |
In Horde content is always loaded from memory, the loadResourcesFromDisk function is just a utility function which copies the files to memory. But it seems that in your own version you just load the scene graph resource and not the geometry and material resources. |
Author: | craigomatic [ 21.09.2009, 07:02 ] |
Post subject: | Re: Recommended way to load geometry from memory? |
Thanks for the reply marciano, I looked at my code again when I was less tired and realised I'd made a mistake with my null terminator which was causing the code files to load incorrectly All is working now! |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |