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