I barely started using Irrlicht and I'm having an issue with managing meshes data.
I was trying to copy one mesh to the other one by appending ones mesh buffer to the others. But it looks like its not working.
I used CDynamicMeshBuffer::append( CDynamicMeshBuffer* _mbuff ). I digged thru Irrlicht source code and I was unable to find any implementation of this method. Is it purely virtual, future planned?
Code snipped:
Code: Select all
scene::IMesh* planeMesh = smgr->getGeometryCreator()->createPlaneMesh(core::dimension2df( TILE_SIZE, TILE_SIZE), core::dimension2d<u32>(1, 1), 0, core::dimension2df(1, 1) );
planeMesh->setHardwareMappingHint(scene::EHM_STREAM);
scene::SMesh* templateMesh = new scene::SMesh();
scene::CDynamicMeshBuffer* mybuf = 0;
if(!templateMesh->getMeshBufferCount()) {
printf("> Creating new dynamic mesh buffer.\n");
mybuf = new scene::CDynamicMeshBuffer(planeMesh->getMeshBuffer(0)->getVertexType(), planeMesh->getMeshBuffer(0)->getIndexType());
templateMesh->addMeshBuffer(mybuf);
}
scene::IMeshSceneNode* newNode = smgr->addMeshSceneNode(templateMesh);
newNode->setPosition(core::vector3df(240,0,250));
newNode->setMaterialTexture(0, driver->getTexture("./world.png"));
newNode->setMaterialFlag( video::EMF_BILINEAR_FILTER, false);
newNode->setMaterialFlag(video::EMF_LIGHTING, false);
newNode->setMaterialType(video::EMT_SOLID);
printf("\n> Vertex count in buffer: %i\n", templateMesh->getMeshBuffer(0)->getVertexCount() );
printf("> Merging with buffer containing: %i vertices\n", planeMesh->getMeshBuffer(0)->getVertexCount() );
mybuf->append(planeMesh->getMeshBuffer(0)); //NOT IMPLEMENTED??
//templateMesh->getMeshBuffer(0)->append( planeMesh->getMeshBuffer(0) ); //does not work either
templateMesh->getMeshBuffer(0)->setDirty();
printf("> Merged buffer vertex count: %i\n", templateMesh->getMeshBuffer(0)->getVertexCount() );- Irrlicht Engine version 1.8.0-alpha
Microsoft Windows 7 Professional Edition Service Pack 1 (Build 7601)
WGL_extensions: WGL_ARB_extensions_string WGL_ARB_pixel_format WGL_ATI_pixel_for
mat_float WGL_ARB_pixel_format_float WGL_ARB_multisample WGL_EXT_swap_control WG
L_EXT_swap_control_tear WGL_ARB_pbuffer WGL_ARB_render_texture WGL_ARB_make_curr
ent_read WGL_EXT_extensions_string WGL_ARB_buffer_region WGL_EXT_framebuffer_sRG
B WGL_ATI_render_texture_rectangle WGL_EXT_pixel_format_packed_float WGL_I3D_gen
lock WGL_NV_swap_group WGL_ARB_create_context WGL_AMD_gpu_association WGL_AMDX_g
pu_association WGL_ARB_create_context_profile WGL_NV_float_buffer
Pixel Format: 2
Using renderer: OpenGL 3.3.11318
ATI Radeon HD 3600 Series: ATI Technologies Inc.
OpenGL driver version is 1.2 or better.
Free texture memory (kB): 219320
Free VBO memory (kB): 219320
Free render buffer memory (kB): 219320
GLSL version: 3.3
Could not load sprite bank because the file does not exist: #DefaultFont
> Creating new dynamic mesh buffer.
Loaded texture: C:/.../visual studio 2010/Projects/IrrHello/Irr
Hello/world.png
> Vertex count in buffer: 0
> Merging with buffer containing: 4 vertices
> Merged buffer vertex count: 0
Resizing window (1280 720)
Thanks in advance.