#pragma once

#include "texture.h"

struct texture2d_data : texture_data {
	void* data_ptr;
	virtual sg_image_data get_image_data() const override {
		const auto& pixel_info = sg_query_pixelformat(pixel_format);
		sg_image_data data{};
		data.subimage[0][0].ptr  = data_ptr;
		data.subimage[0][0].size = size.x() * size.y() * pixel_info.bytes_per_pixel;
		return data;
	}
};

/**
 * @class texture2d
 * @brief 渲染图像类
 *
 * 用于静态图片的渲染，提供创建和清除操作。
 */
class texture2d : public texture {
public:
	virtual void create(const texture_data& in_data) override;
	virtual void update(const sg_image_data& in_data) override;
	virtual void resize(const Eigen::Vector2i& in_size) override;
};
