|
|
Nicolas Calimet <pov### [at] freefr> wrote...
> Well, after more trials in this particular situation of mesh2 object (with
> as many textures as vertices for example), it seems possible to
drastically reduce
> the memory cost when copying the object. I was expecting to do better as I
was
> saying in my previous post, but it crashed in some common situations. At
least the
> following seems to work even with complex textures.
>
> Replace this line in Copy_Mesh:
> New->Textures[i] = Copy_Textures(((MESH *)Object)->Textures[i]);
> by:
> New->Textures[i] = Copy_Texture_Pointer(((MESH *)Object)->Textures[i]);
>
> No need of another Textures->References since it's already handled this
way. In my
> test-case of 800,000 triangles it may save a few hundred megabytes ;-)
>
> Maybe not the end of this story ?
Unfortunately, no. While this does work for solid colors, it will not work
for any other kinds of textures, because of transformation problems.
( More extensive changes would be necessary to make it work. I had been
working on that (in a more general sense for all objects, not just meshes),
but it was taking too much effort so I moved on to "more important" things.
Feel free to keep working on it, though :-) One quick-hack solution would
be to check and see if the texture is a solid color with no normal, and if
so, just copy the texture pointer. That should work correctly in all
situations and will save you much memory for your particular use.
-Nathan
Post a reply to this message
|
|