Click here to Skip to main content
15,892,199 members
Articles / Multimedia / OpenGL

Modified version of lib3ds reader of .3ds format

Rate me:
Please Sign up or sign in to vote.
4.78/5 (15 votes)
4 Oct 2012CPOL3 min read 42.8K   2.9K   23  
In this article I present version of lib3ds reader for C++ language
#ifndef ILIB3DS_STAGE_H
#define ILIB3DS_STAGE_H

#include "lib3ds_types/Lib3ds_Shadow_type.h"
#include "lib3ds_types/Lib3ds_Background_type.h"
#include "lib3ds_types/Lib3ds_Atmosphere_type.h"
#include "lib3ds_types/Lib3ds_Viewport_type.h"
#include "lib3ds_types/Lib3ds_Material_type.h"
#include "lib3ds_types/Lib3ds_Camera_type.h"
#include "lib3ds_types/Lib3ds_Light_type.h"
#include "lib3ds_types/Lib3ds_Mesh_type.h"
#include "lib3ds_types/Lib3ds_Node_type.h"

#include <QMap>
#include <QList>

class ILib3ds_stage
{
public:

    QString             name; // Name of stage
    unsigned            user_id;
    void*               user_ptr;
    unsigned            mesh_version; // Version of mesh
    unsigned            keyf_revision; // Version of keys of Animation    
    float               master_scale; // Main Scale for whole scage
    float               construction_plane[3];
    float               ambient[3];
    Lib3dsShadow        shadow; // Configuration of the shadow
    Lib3dsBackground    background; // Configuration of the background
    Lib3dsAtmosphere    atmosphere;
    Lib3dsViewport      viewport;
    Lib3dsViewport      viewport_keyf;
    int                 frames;
    int                 segment_from;
    int                 segment_to;
    int                 current_frame;
    int                 materials_size;
    int                 nmaterials;
    QMap<QString, Lib3dsMaterial> materials;
    int                 cameras_size;
    int                 ncameras;
    QMap<QString, Lib3dsCamera> cameras;
    int                 lights_size;
    int                 nlights;
    QMap<QString, Lib3dsLight> lights;
    int                 meshes_size;
    int                 nmeshes;
    QMap<QString, Lib3dsMesh> meshes;
    QList<Lib3dsNode> nodes;

    virtual void lib3ds_stage_eval(float t)=0;

    virtual void lib3ds_matrix_copy(float dest[4][4], float src[4][4])=0; // Function of coping of matrix

    virtual int lib3ds_matrix_inv(float m[4][4])=0; // Function of Inverting a matrix in place.

    virtual void lib3ds_stage_bounding_box_of_nodes(int include_meshes, int include_cameras,
                                            int include_lights, float bmin[3],
                                            float bmax[3], float matrix[4][4])=0;

    virtual void lib3ds_mesh_calculate_vertex_normals(Lib3dsMesh *mesh, float (*normals)[3])=0; // Function of Calculates the vertex normals corresponding to the smoothing group
};


#endif // ILIB3DS_STAGE_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions