class hiro::modules::MeshResource

Overview

Resource that allows visualization of a cogs::Mesh structure. More…

#include <MeshResource.h>

class MeshResource: public hiro::Resource {
public:
    // structs

    struct DataRecord;

    // construction

    MeshResource(const std::string& name, const cogs::Mesh& mesh);

    // methods

    uint32_t GetFaceCount() const;
    const cogs::MaterialModel* GetMaterial() const;
    virtual hiro::PGadget CreateGadget();
    uint32_t GetPointCount() const;
    const hiro::draw::PMeshRenderer& GetRenderer() const;
    const glm::vec3& GetCenterOfMass() const;
    const glm::vec3& GetCameraPos() const;
    bool IsUvMappingAvailable() const;
    bool IsColoringAvailable() const;
    const std::vector<cogs::Color3f>& GetColoringOption(const size_t id) const;
    const std::vector<std::string>& GetColoringOptionNames() const;
    bool IsFDataAvailable() const;
    const hiro::modules::MeshResource::DataRecord& GetFDataOption(const size_t id) const;
    const std::vector<std::string>& GetFDataOptionNames() const;
    std::string GetSpaceId() const;
    std::optional<utils::SpaceDefinition> GetSpace() const;

protected:
    // fields

    uint32_t face_count_ { 0u };
    uint32_t point_count_ { 0u };
    std::unique_ptr<cogs::MaterialModel> material_;
    bool is_uv_mapping_available_;
    glm::vec3 center_of_mass_;
    glm::vec3 camera_pos_;
    std::vector<std::vector<cogs::Color3f>> coloring_options_;
    std::vector<std::string> coloring_option_names_;
    std::vector<hiro::modules::MeshResource::DataRecord> fdata_options_;
    std::vector<std::string> fdata_option_names_;
    std::optional<utils::SpaceDefinition> space_;
    hiro::draw::PMeshRenderer renderer_;

    // methods

    void StoreNeededData(const cogs::Mesh& mesh);
    void CalculateCenterOfMass(const cogs::Mesh& mesh);
};

Inherited Members

public:
    // fields

    const hiro::ResourceId ID;

    // methods

    virtual hiro::PGadget CreateGadget() = 0;
    void ResetGadgets();
    virtual void Update(float delta_time);

protected:
    // methods

    void DrawOnNextUpdate() const;

Detailed Documentation

Resource that allows visualization of a cogs::Mesh structure.

Construction

MeshResource(const std::string& name, const cogs::Mesh& mesh)

Constructor of mesh resource.

Parameters:

name

The name of the mesh.

mesh

Input mesh data.

Methods

uint32_t GetFaceCount() const

Returns number of faces.

const cogs::MaterialModel* GetMaterial() const

Returns material assigned to mesh.

virtual hiro::PGadget CreateGadget()

Creates Gadget for this Resource object.

uint32_t GetPointCount() const

Returns number of points.

const hiro::draw::PMeshRenderer& GetRenderer() const

Returns a PointCloudObject pointer.

const glm::vec3& GetCenterOfMass() const

Returns calculated center of mass.

const glm::vec3& GetCameraPos() const

Returns camera position based on center of mass.

bool IsUvMappingAvailable() const

Returns if uvs are available for a mesh.

bool IsColoringAvailable() const

Returns if coloring options for points are available.

const std::vector<cogs::Color3f>& GetColoringOption(const size_t id) const

Returns current coloring option. It returns available RGB color values for one point with given id.

Parameters:

id

id of the given point

const std::vector<std::string>& GetColoringOptionNames() const

Returns names of coloring properties.

bool IsFDataAvailable() const

Returns if float data for points is available.

const hiro::modules::MeshResource::DataRecord& GetFDataOption(const size_t id) const

Returns a DataRecord value for point. It returns available DataRecord value for one point with given id.

Parameters:

id

id of the given point

const std::vector<std::string>& GetFDataOptionNames() const

Returns names of float data properties.

std::string GetSpaceId() const

Returns string id of point space.

std::optional<utils::SpaceDefinition> GetSpace() const

Returns point space if defined.