On Fri, Sep 21, 2007 at 10:48:00AM +0100, development wrote:
> Hi everyone,
>       I've been trying to get vertex normals to work for sometime now, as
> the provided face ones seem a little flat. I noticed in he documentation a
> function called 
> void lib3ds_mesh_calculate_normals which is meant to calculate the vertex
> normals however I have no idea how to use this, I've searched google but to
> no avail. I could find only one example but this caused an error, it
> declared Lib3dsVector *normalL = malloc(3*sizeof(Lib3dsVector)*mesh->faces);
> in the function which isn't allowed in C (as far as I can see). Thanks

I haven't got the slightest clue as to which part of: "Lib3dsVector
*normalL = malloc(3*sizeof(Lib3dsVector)*mesh->faces);" you think is not
"allowed" in C ... Actually it's a perfectly reasonable C expression
(provided that Lib3dsVector is defined, which is by lib3ds).

Actually my old code resembles that a lot:

        normal_count = 3 * mesh->faces;
        if(!(normals = malloc(normal_count * sizeof *normals))) {
                fprintf(stderr, "memory allocation failed\n");
                lib3ds_file_free(file);
                return -1;
        }
        lib3ds_mesh_calculate_normals(mesh, normals);

-- 
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
lib3ds-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel

Reply via email to