Prefab


// Contains one or more lights, cameras, static meshes, animated meshes and collision shapes. 
// Items on stack are referenced starting from -1 down.
class RVAPI Prefab
{
public:
    // Check if item exists at stack position [n]. 
    bool IsItem(int n) const;

    // Check if item name matches [name] at stack position [n].
    bool IsItemName(int n, wcstr name) const;

    // Check if item type matches [type] at stack position [n].
    bool IsItemType(int n, wcstr type) const;

    // Get item name at stack position [n].
    wcstr GetItemName(int n) const;

    // Get item type at stack position [n].
    wcstr GetItemType(int n) const;

    // Get local item position at stack position [n].
    const M4f &GetItemPos(int n) const;

    // Get item child count at stack position [n].
    uint GetItemChildCount(int n) const;

    // Add collision shape at stack position [n] to [body].
    void AddCollShape(int n, Body &body);

    // Push next item onto stack.
    void Push();

    // Pop item from stack.
    void Pop();

    // Open prefab file at [path] from data root, using [pos] as the base position.
    void Open(wcstr path, const M4f &pos = M4fIdent());

    // Close prefab file.
    void Close();

    // Constructor. Open prefab file at [path] from data root, using [pos] as the base position.
    Prefab(wcstr path, const M4f &pos = M4fIdent());

    // Constructor.
    Prefab();

    // Destructor.
    virtual ~Prefab();

private:
    byte wobj[256];
};