Re: [2/5] d3dx9: Implement D3DXMESHOPT_COMPACT for ID3DXMesh::OptimizeInplace.
May 8, 2011
7:17 p.m.
2011/5/6 Dylan Smith <dylan.ah.smith(a)gmail.com>: ... > + new_vertex_buffer_size = This->numvertices; ... > + new_vertex_buffer_size *= vertex_size; > + hr = IDirect3DDevice9_CreateVertexBuffer(This->device, new_vertex_buffer_size, > + vertex_desc.Usage, This->fvf, vertex_desc.Pool, &vertex_buffer, NULL); ... + for (i = 0; i < new_num_vertices; i++) + CopyMemory(new_vertices + i * vertex_size, orig_vertices + vertex_remap_ptr[i] * vertex_size, vertex_size); Is this correct, i.e. should the new vertex buffer be big as much as the old one? I expected it to be just big enough to keep all the remaining vertices (new_num_vertices). Maybe this is so to match some native behavior?
May 2011
7:24 p.m.
New subject: [2/5] d3dx9: Implement D3DXMESHOPT_COMPACT for ID3DXMesh::OptimizeInplace.
On Sun, May 8, 2011 at 3:17 PM, Matteo Bruni <matteo.mystral(a)gmail.com>wrote: > 2011/5/6 Dylan Smith <dylan.ah.smith(a)gmail.com>: > > ... > > + new_vertex_buffer_size = This->numvertices; > ... > > + new_vertex_buffer_size *= vertex_size; > > + hr = IDirect3DDevice9_CreateVertexBuffer(This->device, > new_vertex_buffer_size, > > + vertex_desc.Usage, This->fvf, vertex_desc.Pool, > &vertex_buffer, NULL); > ... > + for (i = 0; i < new_num_vertices; i++) > + CopyMemory(new_vertices + i * vertex_size, orig_vertices > + vertex_remap_ptr[i] * vertex_size, vertex_size); > > Is this correct, i.e. should the new vertex buffer be big as much as > the old one? I expected it to be just big enough to keep all the > remaining vertices (new_num_vertices). Maybe this is so to match some > native behavior? > Ya, I was just trying to match the native behaviour.
5436
Age (days ago)
5436
Last active (days ago)
1 comments
2 participants
participants (2)
-
Dylan Smith -
Matteo Bruni