#include <unordered_map>
#include <vector>
#include <memory>
#include <GLES3/gl3.h>
#include "../GLShader/GLShader.h"
#include "../GLTexture/GLTexture.h"

class GLRenderData {
public:
    // 常量指针指向 GLShader 对象
    std::shared_ptr<GLShader> shader;
    // 存储整数类型的统一变量
    std::unordered_map<std::string, GLint> uniformsInteger;
    // 存储浮点数类型的统一变量
    std::unordered_map<std::string, GLfloat> uniformsFloat;
    // 存储整数缓冲区类型的统一变量
    std::unordered_map<std::string, std::vector<GLint>> uniformsIntBuffer;
    // 存储浮点数缓冲区类型的统一变量
    std::unordered_map<std::string, std::vector<GLfloat>> uniformsFloatBuffer;
    // 存储纹理对象
    std::unordered_map<std::string, std::shared_ptr<GLTexture>> textures;
    // 宽度
    GLint width;
    // 高度
    GLint height;
    // 帧缓冲区对象 ID
    GLint fboId;
    // 上下文子对象列表
    std::vector<std::shared_ptr<GLRenderData>> contextChildren;
    // 子对象列表
    std::vector<std::shared_ptr<GLRenderData>> children;

    GLRenderData(){}
    // 构造函数
    GLRenderData(
        const std::shared_ptr<GLShader>& shader,
        const std::unordered_map<std::string, GLint>& uniformsInteger,
        const std::unordered_map<std::string, GLfloat>& uniformsFloat,
        const std::unordered_map<std::string, std::vector<GLint>>& uniformsIntBuffer,
        const std::unordered_map<std::string, std::vector<GLfloat>>& uniformsFloatBuffer,
        const std::unordered_map<std::string, std::shared_ptr<GLTexture>>& textures,
        GLint width,
        GLint height,
        GLint fboId,
        const std::vector<std::shared_ptr<GLRenderData>>& contextChildren,
        const std::vector<std::shared_ptr<GLRenderData>>& children
    ) : shader(shader),
        uniformsInteger(uniformsInteger),
        uniformsFloat(uniformsFloat),
        uniformsIntBuffer(uniformsIntBuffer),
        uniformsFloatBuffer(uniformsFloatBuffer),
        textures(textures),
        width(width),
        height(height),
        fboId(fboId),
        contextChildren(contextChildren),
        children(children) {}
    
    ~GLRenderData(){}
};