DiligentGraphics/DiligentCore

Add convenience cpp struct wrappers

TheMostDiligent opened this issue · 0 comments

Many structs (e.g. InputLayoutDesc) may contain variable number of elements. Using convenience cpp wrappers will simplify using them.

Example:

// DiligentCore.hpp

struct InputLayoutDescX
{
    InputLayoutDescX(const std::initializer_list<LayoutElement>&);
    InputLayoutDescX& Add(const LayoutElement& Elem)
   {
      Elements.push_back(Elem);
      Desc.NumElements = StaticCast<Uint32>(Elements.size());
      Desc.Elements = Elements.data();
      return *this;
   }

    InputLayoutDescX& Remove();
    operator const InputLayoutDesc&() const
   {
       return Desc;
   }

private:
    InputLayoutDesc            Desc;
    std::vector<LayoutElement> Elements;
};