mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
Implement DrawGraph.CopyRotateX,CopyRotateXUseAmap
Used in Tsuma Shibori.
This commit is contained in:
@@ -130,6 +130,8 @@ void gfx_fill_amap_over_border(Texture *dst, int x, int y, int w, int h, int alp
|
||||
void gfx_fill_amap_under_border(Texture *dst, int x, int y, int w, int h, int alpha, int border);
|
||||
void gfx_copy_rotate_y(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag);
|
||||
void gfx_copy_rotate_y_use_amap(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag);
|
||||
void gfx_copy_rotate_x(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag);
|
||||
void gfx_copy_rotate_x_use_amap(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag);
|
||||
void gfx_copy_width_blur(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int blur);
|
||||
void gfx_copy_height_blur(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int blur);
|
||||
void gfx_copy_amap_width_blur(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int blur);
|
||||
|
||||
+39
@@ -565,6 +565,45 @@ void gfx_copy_rotate_y_use_amap(Texture *dst, Texture *front, Texture *back, int
|
||||
copy_rotate_y(dst, front, back, sx, sy, w, h, rot, mag, &hitbox_shader.s);
|
||||
}
|
||||
|
||||
static void copy_rotate_x(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag, Shader *shader)
|
||||
{
|
||||
Texture *src = front;
|
||||
float flip_y = 1.0;
|
||||
rot = 360.0 - rot;
|
||||
if (rot > 90.0 && rot <= 270.0) {
|
||||
src = back;
|
||||
flip_y = -1.0;
|
||||
}
|
||||
|
||||
|
||||
gfx_fill_amap(dst, 0, 0, dst->w, dst->h, 0);
|
||||
|
||||
mat4 mw_transform = GLM_MAT4_IDENTITY_INIT;
|
||||
glm_rotate_x(mw_transform, rot * (M_PI/180.0), mw_transform);
|
||||
glm_scale(mw_transform, (vec3){ src->w * mag, src->h * mag * flip_y, 0 });
|
||||
glm_translate(mw_transform, (vec3){ -0.5, -0.5, 0});
|
||||
|
||||
mat4 proj_transform;
|
||||
float fov = 22.5 * (M_PI / 180.0);
|
||||
// calculate the camera distance such that the height at the pivot is unchanged
|
||||
float cam_off = ((float)dst->h * 0.5) / tanf(fov * 0.5);
|
||||
glm_perspective(fov, (float)dst->w / dst->h, 0.1, cam_off + w * mag, proj_transform);
|
||||
glm_translate(proj_transform, (vec3){ 0, 0, -cam_off });
|
||||
|
||||
struct copy_data data = ROTATE_DATA(dst, sx, sy, w, h);
|
||||
run_draw_shader(shader, dst, src, mw_transform, proj_transform, &data);
|
||||
}
|
||||
|
||||
void gfx_copy_rotate_x(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag)
|
||||
{
|
||||
copy_rotate_x(dst, front, back, sx, sy, w, h, rot, mag, &hitbox_noblend_shader.s);
|
||||
}
|
||||
|
||||
void gfx_copy_rotate_x_use_amap(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag)
|
||||
{
|
||||
copy_rotate_x(dst, front, back, sx, sy, w, h, rot, mag, &hitbox_shader.s);
|
||||
}
|
||||
|
||||
void gfx_copy_reverse_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h)
|
||||
{
|
||||
mat4 mw_transform = MAT4(
|
||||
|
||||
+13
-4
@@ -271,8 +271,17 @@ static void DrawGraph_CopyRotateYUseAMap(int write, int dst, int src, int sx, in
|
||||
//void DrawGraph_CopyRotateYFixR(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateYFixLUseAMap(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateYFixRUseAMap(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateX(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateXUseAMap(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
|
||||
static void DrawGraph_CopyRotateX(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag)
|
||||
{
|
||||
gfx_copy_rotate_x(DTEX(write), STEX(dst), STEX(src), sx, sy, w, h, rot, mag);
|
||||
}
|
||||
|
||||
static void DrawGraph_CopyRotateXUseAMap(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag)
|
||||
{
|
||||
gfx_copy_rotate_x_use_amap(DTEX(write), STEX(dst), STEX(src), sx, sy, w, h, rot, mag);
|
||||
}
|
||||
|
||||
//void DrawGraph_CopyRotateXFixU(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateXFixD(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
//void DrawGraph_CopyRotateXFixUUseAMap(int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
@@ -397,8 +406,8 @@ HLL_LIBRARY(DrawGraph,
|
||||
//HLL_EXPORT(CopyRotateYFixR, DrawGraph_CopyRotateYFixR),
|
||||
//HLL_EXPORT(CopyRotateYFixLUseAMap, DrawGraph_CopyRotateYFixLUseAMap),
|
||||
//HLL_EXPORT(CopyRotateYFixRUseAMap, DrawGraph_CopyRotateYFixRUseAMap),
|
||||
//HLL_EXPORT(CopyRotateX, DrawGraph_CopyRotateX),
|
||||
//HLL_EXPORT(CopyRotateXUseAMap, DrawGraph_CopyRotateXUseAMap),
|
||||
HLL_EXPORT(CopyRotateX, DrawGraph_CopyRotateX),
|
||||
HLL_EXPORT(CopyRotateXUseAMap, DrawGraph_CopyRotateXUseAMap),
|
||||
//HLL_EXPORT(CopyRotateXFixU, DrawGraph_CopyRotateXFixU),
|
||||
//HLL_EXPORT(CopyRotateXFixD, DrawGraph_CopyRotateXFixD),
|
||||
//HLL_EXPORT(CopyRotateXFixUUseAMap, DrawGraph_CopyRotateXFixUUseAMap),
|
||||
|
||||
Reference in New Issue
Block a user