Horde3D
http://horde3d.org/forums/

To much memory consumption when cloning a geometry resource
http://horde3d.org/forums/viewtopic.php?f=3&t=940
Page 1 of 1

Author:  Volker [ 08.09.2009, 21:46 ]
Post subject:  To much memory consumption when cloning a geometry resource

There's a bug in Beta4, when cloning a geometry resource. In this case the cloned geometry data block is to big.

The following patch fixes this issue:

Code:
Index: egGeometry.cpp
===================================================================
--- egGeometry.cpp   (revision 188)
+++ egGeometry.cpp   (working copy)
@@ -59,9 +59,9 @@
 
    // Make a deep copy of the data
    res->_indexData = new char[_indexCount * _16BitIndices ? 2 : 4];
-   res->_vertPosData = new Vec3f[_vertCount * sizeof( Vec3f )];
-   res->_vertTanData = new Vec3f[_vertCount * sizeof( Vec3f ) * 3];
-   res->_vertStaticData = new VertexDataStatic[_vertCount * sizeof( VertexDataStatic )];
+   res->_vertPosData = new Vec3f[_vertCount];
+   res->_vertTanData = new Vec3f[_vertCount * 3];
+   res->_vertStaticData = new VertexDataStatic[_vertCount];
    memcpy( res->_indexData, _indexData, _indexCount * _16BitIndices ? 2 : 4 );
    memcpy( res->_vertPosData, _vertPosData, _vertCount * sizeof( Vec3f ) );
    memcpy( res->_vertTanData, _vertTanData, _vertCount * sizeof( Vec3f ) * 3 );

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/