class hiro::modules::GeometryGadget

Overview

Gadget that renders geometry using hiro::draw::GeometryRenderer. More…

#include <GeometryGadget.h>

class GeometryGadget: public hiro::Gadget {
public:
    // construction

    GeometryGadget(const hiro::Resource* res, const hiro::draw::PGeometryRenderer& renderer);
    GeometryGadget(const hiro::Resource* res, const hiro::draw::PGeometryRenderer& renderer, const hiro::draw::PGeometryStyle& style_);

    // methods

    virtual void Initialize();
    virtual void GenerateGui(hiro::GuiGenerator& gui);

protected:
    // methods

    hiro::draw::PGeometryStyle GetStyle();
    virtual bool ReadFromStream(std::istream& str);
    virtual void WriteToStream(std::ostream& str) const;
    void AddGuiRenderMode(hiro::GuiGenerator& gui);
    void AddGuiMaterialOptions(hiro::GuiGenerator& gui);
    void AddGuiCullBackFacning(hiro::GuiGenerator& gui);
    void AddGuiColorSource(hiro::GuiGenerator& gui);
    void AddGuiDisplayNormals(hiro::GuiGenerator& gui);
    void AddGuiWireParameters(hiro::GuiGenerator& gui);
};

Inherited Members

public:
    // fields

    const hiro::ResourceId RESOURCE_ID;

    // methods

    virtual void Initialize();
    virtual void Terminate();
    virtual void GenerateGui(hiro::GuiGenerator& gui);
    virtual void Update(const float time_delta);
    virtual bool FocusCamera(glm::vec3& focus_point, glm::vec3& cam_position) const;
    virtual hiro::EventStatus KeyPressed(hiro::Key key, const hiro::ModKeys& mods, hiro::EventStatus status);
    virtual hiro::EventStatus KeyReleased(hiro::Key key, const hiro::ModKeys& mods, hiro::EventStatus status);
    virtual hiro::EventStatus MouseButtonPressed(hiro::MouseButton button, const hiro::ModKeys& mods, hiro::EventStatus status);
    virtual hiro::EventStatus MouseButtonReleased(hiro::MouseButton button, const hiro::ModKeys& mods, hiro::EventStatus status);
    virtual hiro::EventStatus MouseWheel(float offset, hiro::EventStatus status);
    virtual hiro::EventStatus MouseMoved(float x, float y, hiro::EventStatus status);
    virtual hiro::EventStatus ViewResized(uint32_t width, uint32_t height, hiro::EventStatus status);
    virtual void RenderTexts(hiro::draw::TextRenderer& t_renderer);
    hiro::Camera* GetCamera() const;
    virtual int32_t AddRenderer(const hiro::draw::PRenderer& renderer, const hiro::draw::PStyle& style, uint8_t layer = 0u) const;
    virtual void RemoveRenderer(int32_t renderer_id) const;
    hiro::draw::ProjectionParams GetProjectionParams() const;

    template <typename UnitType = Resource>
    const UnitType* GetResource() const;

    void SetViewarea(hiro::Viewarea* viewarea);
    bool SaveState() const;
    void SetNearFar(float near, float far) const;

protected:
    // methods

    void LoadState();
    virtual bool ReadFromStream(std::istream& str);
    virtual void WriteToStream(std::ostream& str) const;
    void DrawOnNextUpdate() const;
    uint32_t GetViewAreaId() const;
    static bool ReadStateVersion(std::istream& str, uint32_t expected_version);
    static void WriteStateVersion(std::ostream& str, uint32_t version);

Detailed Documentation

Gadget that renders geometry using hiro::draw::GeometryRenderer.

Methods

virtual void Initialize()

Function invoked right after object creation to set up all properties.

virtual void GenerateGui(hiro::GuiGenerator& gui)

Function invoked right after object initialization to define gui.

virtual bool ReadFromStream(std::istream& str)

Override this method to read custom state from auto save stream.

This method is not designed to be called by user directly, it is called automatically by the system. Must be consistent with WriteToStream counterpart method.

virtual void WriteToStream(std::ostream& str) const

Override this method to write custom state to auto save stream.

This method is not designed to be called by user directly, it is called automatically by the system. Must be consistent with ReadFromStream counterpart method.