Content


NTL
Core
CVertexArray

CVertexArray


Implements basic vertex array functionality.

You can find more information in comments below. Overrided methods can be found in corresponding base interface.

class CVertexArray :public virtual IVertexArray, public CReleasable
{
protected:
    std::vector<CVertex*> m_aVertices;
    std::vector<CPolygon*> m_aPolygons;
    std::vector<Vec1f> m_aVec1f[8];
    std::vector<Vec2f> m_aVec2f[8];
    std::vector<Vec3f> m_aVec3f[8];
    std::vector<Vec4f> m_aVec4f[8];
    std::vector<Vec1i> m_aVec1i[8];
    std::vector<Vec2i> m_aVec2i[8];
    std::vector<Vec3i> m_aVec3i[8];
    std::vector<Vec4i> m_aVec4i[8];
    int m_iLastRenderedPrimitives;

    static const int PRIMITIVE_NONE{ 0 };
    static const int PRIMITIVE_POINT{ 1 };
    static const int PRIMITIVE_LINE{ 2 };
    static const int PRIMITIVE_WIRE{ 3 };
    static const int PRIMITIVE_POLYGON{ 4 };

    CVertexArray(IReleasableListener *listener, const VertexFormat &format);
    CVertexArray(IReleasableListener *listener, const VertexFormat &format, const size_t vertex_count);
    CVertexArray(IReleasableListener *listener, const VertexFormat &format, const size_t polygon_count, const size_t polygon_size);

    CVertexArray(const CVertexArray&) = default;
    CVertexArray(CVertexArray&&) = default;
    CVertexArray &operator=(const CVertexArray&) = default;
    CVertexArray &operator=(CVertexArray&&) = default;

    void BeforeRelease() override;

    static bool CheckFormat(const VertexFormat &format);
public:
    // IVertexArray getters
    size_t getVertexCount() const override;
    IVertex *getVertex(const size_t index) override;
    size_t getPolygonCount() const override;
    IPolygon *getPolygon(const size_t index) override;
    const Vec1f *getVec1f(const byte coord_index, const size_t index) const override;
    const Vec2f *getVec2f(const byte coord_index, const size_t index) const override;
    const Vec3f *getVec3f(const byte coord_index, const size_t index) const override;
    const Vec4f *getVec4f(const byte coord_index, const size_t index) const override;
    const Vec1i *getVec1i(const byte coord_index, const size_t index) const override;
    const Vec2i *getVec2i(const byte coord_index, const size_t index) const override;
    const Vec3i *getVec3i(const byte coord_index, const size_t index) const override;
    const Vec4i *getVec4i(const byte coord_index, const size_t index) const override;
    const Vec1f *getVec1fArray(const byte coord_index) const override;
    const Vec2f *getVec2fArray(const byte coord_index) const override;
    const Vec3f *getVec3fArray(const byte coord_index) const override;
    const Vec4f *getVec4fArray(const byte coord_index) const override;
    const Vec1i *getVec1iArray(const byte coord_index) const override;
    const Vec2i *getVec2iArray(const byte coord_index) const override;
    const Vec3i *getVec3iArray(const byte coord_index) const override;
    const Vec4i *getVec4iArray(const byte coord_index) const override;

    // IVertexArray setters
    bool setVertexCount(const size_t value) override;
    bool setPolygonCount(const size_t value) override;
    bool setPolygonCount(const size_t count, const size_t size) override;
    bool setVec1f(const byte coord_index, const size_t index, const Vec1f &value) override;
    bool setVec2f(const byte coord_index, const size_t index, const Vec2f &value) override;
    bool setVec3f(const byte coord_index, const size_t index, const Vec3f &value) override;
    bool setVec4f(const byte coord_index, const size_t index, const Vec4f &value) override;
    bool setVec1f(const byte coord_index, const size_t index, const Vec1f &value, const float relative_tolerance) override;
    bool setVec2f(const byte coord_index, const size_t index, const Vec2f &value, const float relative_tolerance) override;
    bool setVec3f(const byte coord_index, const size_t index, const Vec3f &value, const float relative_tolerance) override;
    bool setVec4f(const byte coord_index, const size_t index, const Vec4f &value, const float relative_tolerance) override;
    bool setVec1f(const size_t index, const Vec1f &value) override;
    bool setVec2f(const size_t index, const Vec2f &value) override;
    bool setVec3f(const size_t index, const Vec3f &value) override;
    bool setVec4f(const size_t index, const Vec4f &value) override;
    bool setVec1f(const size_t index, const Vec1f &value, const float relative_tolerance) override;
    bool setVec2f(const size_t index, const Vec2f &value, const float relative_tolerance) override;
    bool setVec3f(const size_t index, const Vec3f &value, const float relative_tolerance) override;
    bool setVec4f(const size_t index, const Vec4f &value, const float relative_tolerance) override;
    bool setVec1i(const byte coord_index, const size_t index, const Vec1i &value) override;
    bool setVec2i(const byte coord_index, const size_t index, const Vec2i &value) override;
    bool setVec3i(const byte coord_index, const size_t index, const Vec3i &value) override;
    bool setVec4i(const byte coord_index, const size_t index, const Vec4i &value) override;
    bool setVec1i(const byte coord_index, const size_t index, const Vec1i &value, const float relative_tolerance) override;
    bool setVec2i(const byte coord_index, const size_t index, const Vec2i &value, const float relative_tolerance) override;
    bool setVec3i(const byte coord_index, const size_t index, const Vec3i &value, const float relative_tolerance) override;
    bool setVec4i(const byte coord_index, const size_t index, const Vec4i &value, const float relative_tolerance) override;
    bool setVec1i(const size_t index, const Vec1i &value) override;
    bool setVec2i(const size_t index, const Vec2i &value) override;
    bool setVec3i(const size_t index, const Vec3i &value) override;
    bool setVec4i(const size_t index, const Vec4i &value) override;
    bool setVec1i(const size_t index, const Vec1i &value, const float relative_tolerance) override;
    bool setVec2i(const size_t index, const Vec2i &value, const float relative_tolerance) override;
    bool setVec3i(const size_t index, const Vec3i &value, const float relative_tolerance) override;
    bool setVec4i(const size_t index, const Vec4i &value, const float relative_tolerance) override;

    // IVertexArray vertices
    IVertex *AddVertex(IPolygon *polygon = nullptr) override;
    IVertex *AddVertex(const size_t before, IPolygon *polygon = nullptr) override;
    bool DeleteVertex(const size_t index) override;
    bool DeleteVertex(IVertex *vertex) override;
    bool DeleteVertices() override;

    // IVertexArray polygons
    IPolygon *AddPolygon() override;
    IPolygon *AddPolygon(const size_t before) override;
    bool DeletePolygon(const size_t index) override;
    bool DeletePolygon(IPolygon *value) override;
    bool DeletePolygons() override;

    // IVertexArray helpers
    bool Clear() override;
};
Namespace: nitisa
Include: Nitisa/Core/VertexArray.h