fishbowl/engine/include/fishbone/draw.h

71 lines
1.7 KiB
C
Raw Normal View History

2026-06-01 13:50:35 +09:00
#ifndef __FISHBOWL_DRAW_H__
#define __FISHBOWL_DRAW_H__
#include <fishbone/pre.h>
namespace fishbone {
class Texture;
class Mesh;
class Renderer;
2026-06-05 21:43:30 +09:00
}; // namespace fishbone
2026-06-01 13:50:35 +09:00
2026-06-05 21:43:30 +09:00
#include <fishbone/window.h>
#include <fishbone/meshldr.h>
2026-06-06 01:04:29 +09:00
#include <fishbone/textureldr.h>
2026-06-01 13:50:35 +09:00
namespace fishbone {
class Texture {
2026-06-06 01:04:29 +09:00
void init(fishbone::Renderer* renderer, unsigned char* rgba, int width, int height);
2026-06-01 13:50:35 +09:00
struct Impl;
Impl* impl;
2026-06-05 21:43:30 +09:00
public:
2026-06-06 01:04:29 +09:00
Texture(fishbone::Renderer* renderer, unsigned char* rgba, int width, int height) {
this->init(renderer, rgba, width, height);
}
Texture(fishbone::Renderer* renderer, fishbone::TextureData* data) {
this->init(renderer, data->rgba, data->width, data->height);
}
2026-06-01 13:50:35 +09:00
~Texture();
2026-06-06 01:04:29 +09:00
void use();
2026-06-01 13:50:35 +09:00
};
class Mesh {
2026-06-05 21:43:30 +09:00
void init(fishbone::Renderer* renderer, std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals);
2026-06-01 13:50:35 +09:00
struct Impl;
Impl* impl;
2026-06-05 21:43:30 +09:00
public:
Mesh(fishbone::Renderer* renderer, std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals) {
this->init(renderer, vertices, texcoords, normals);
}
Mesh(fishbone::Renderer* renderer, fishbone::MeshData* data) {
this->init(renderer, data->vertices, data->texcoords, data->normals);
}
2026-06-01 13:50:35 +09:00
~Mesh();
2026-06-01 14:23:48 +09:00
void draw();
2026-06-06 01:04:29 +09:00
void draw(struct fishbone::Vector3 pos);
void draw(struct fishbone::Vector3 pos, struct fishbone::Vector3 rot);
fishbone::Texture* texture;
2026-06-01 13:50:35 +09:00
};
class Renderer {
struct Impl;
Impl* impl;
2026-06-05 21:43:30 +09:00
public:
Renderer(fishbone::Window* window);
2026-06-01 13:50:35 +09:00
~Renderer();
2026-06-06 01:04:29 +09:00
void prepare();
2026-06-01 13:50:35 +09:00
};
2026-06-06 01:04:29 +09:00
static float maxDistance = 64;
2026-06-05 21:43:30 +09:00
}; // namespace fishbone
2026-06-01 13:50:35 +09:00
#endif