ICT290 / src / engine / object.h
object.h
Raw
#pragma once
#include "modelManager.h"

/**
 * @struct Object
 * @brief Contains all the information for a game world object and updates the
 * associated model with the information it is provided by the scene.
 *
 * @author Chase Percy
 *
 */
struct Object {
    std::string name;  /// The name of the object, doesn't have to be unique.
    std::shared_ptr<Model> model{nullptr};  /// The model the object represents
    glm::vec3 location{0, 0, 0};            /// The location of the object
    glm::vec3 rotation{1, 1, 1};            /// The orientation of the object
    glm::vec3 scale{1, 1, 1};               /// The scale of the object

    Object() = default;

    ~Object() = default;

    /**
     * Object constructor for objects that have no model.
     * @param name_ Name of the object, std::move is used so local string will
     * be emptied after.
     * @param location_ The current location of the object.
     * @param rotation_ The current rotation of the object
     * @param scale_ The current scale of the object.
     */
    Object(std::string name_,
           glm::vec3 location_,
           glm::vec3 rotation_,
           glm::vec3 scale_);

    /**
     * Object constructor for objects that have a model.
     * @param name_ Name of the object, std::move is used so local string will
     * be emptied after.
     * * @param model_ Name of the model to be associated with the object.
     * std::move is used.
     * @param location_ The current location of the object.
     * @param rotation_ The current rotation of the object
     * @param scale_ The current scale of the object.
     */
    Object(std::string name_,
           std::shared_ptr<Model>& modelName,
           glm::vec3 location_,
           glm::vec3 rotation_,
           glm::vec3 scale_);

    /**
     * An object updates all its parameters then passes the model if it has one
     * to be drawn in the same location as the object itself.
     */
    void draw() const;
};