Function


mgkObjInit

Initializes an object.

Syntax

#include <mgk/Obj.h>
void mgkObjInit( MgkObj *obj_ptr, const u32 module_index );

Description

Initializes an object. An object is associated with the module specified by module_index.

See Also

MgkObj

mgkObjLoad

Loads an object.

Syntax

#include <mgk/Obj.h>
int mgkObjLoad( MgkObj *obj_ptr,
                const u32 rom_start_addr,
                const u32 rom_end_addr )

Description

Loads an object.

mgkObjUnload

Destroys the object that has been loaded.

Syntax

#include <mgk/Obj.h>
void mgkObjUnload( MgkObj *obj_ptr )

Description

Destroys the object that has been loaded.

mgkObjCreateCamera

Generates camera object.

Syntax

#include <mgk/Obj.h>
void mgkObjCreateCamera( MgkObj *obj_ptr,
                         const float fov_y,
                         const float aspect_ratio,
                         const float clip_near,
                         const float clip_far )

Description

Generates camera object. Camera itself is considered an object.

mgkObjSetAnim

Sets animation to an object

Syntax

#include <mgk/Obj.h>
void mgkObjSetAnim( MgkObj *obj_ptr, const s32 anim_index )

Description

Sets animation to an object

mgkObjPlayAnim

Starts to play an animation.

Syntax

#include <mgk/Obj.h>
void mgkObjPlayAnim( MgkObj *obj_ptr,
                     const float start,
                     const float end,
                     const float pitch,
                     const int loop )

Description

Starts to play an animation.

mgkObjMove

Moves an object horizontally.

Syntax

#include <mgk/Obj.h>
void mgkObjMove( MgkObj *obj_ptr,
                 const float x, const float y, const float z )

Description

Moves an object horizontally.

mgkObjRotate

Rotates an object

Syntax

#include <mgk/Obj.h>
void mgkObjRotate( MgkObj *obj_ptr, const int mode,
                   const float x, const float y, const float z )

Description

Rotates an object Choose modes from the following

mgkObjLookAt

Negative direction on z axis of an object should point to x_at, y_at, z_at.

Syntax

#include <mgk/Obj.h>
void mgkObjLookAt( MgkObj *obj_ptr,
                   const float x, const float y, const float z,
                   const float x_at, const float y_at, const float z_at,
                   const float x_up, const float y_up, const float z_up )

Description

Negative direction on z axis of an object should point to x_at, y_at, z_at. In this case, the coordinate of the object moves to x, y, and z. The positive direction on y axis should point to x_up, y_up, z_up.

mgkObjScale

Gives scale to an object

Syntax

#include <mgk/Obj.h>
void mgkObjScale( MgkObj *obj_ptr,
                  const float x, const float y, const float z )

Description

Gives scale to an object

Structure



MgkObj


#include <mgk/Obj.h>

typedef struct _MgkObj
{
    MvmVector3f         scale;
    MvmVector3f         rotation;
    MvmVector3f         translation;
    MvmVector3f         at;
    MvmVector3f         up;
    int                 rotation_mode;

    u32                 module_index;
    u32                 *camera_mask_ptr;

    u32                 anim_start_frame;
    float               *anim_index_ptr;
    float               *anim_time_ptr;
    float               anim_pitch;
    float               anim_start;
    float               anim_length;
    int                 anim_loop;

    void                *user_data;
} MgkObj;