Task Effect

This commit is contained in:
korenkonder
2023-12-09 01:03:13 +03:00
parent 2fe2a2862a
commit 3ee9c642f6
11 changed files with 1863 additions and 12 deletions
+4
View File
@@ -250,6 +250,7 @@ del "$(SolutionDir)bin\$(TargetName).lib"</Command>
<ClCompile Include="camera.cpp" />
<ClCompile Include="color.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="file_handler.cpp" />
<ClCompile Include="mdl\disp_manager.cpp" />
<ClCompile Include="mdl\draw_object.cpp" />
<ClCompile Include="Glitter\glitter.cpp" />
@@ -281,6 +282,7 @@ del "$(SolutionDir)bin\$(TargetName).lib"</Command>
<ClCompile Include="sprite.cpp" />
<ClCompile Include="stage.cpp" />
<ClCompile Include="stage_param.cpp" />
<ClCompile Include="task_effect.cpp" />
<ClCompile Include="texture.cpp" />
<ClCompile Include="uniform.cpp" />
<ClCompile Include="hook.cpp" />
@@ -293,6 +295,7 @@ del "$(SolutionDir)bin\$(TargetName).lib"</Command>
<ClInclude Include="auth_3d.hpp" />
<ClInclude Include="camera.hpp" />
<ClInclude Include="color.hpp" />
<ClInclude Include="file_handler.hpp" />
<ClInclude Include="mdl\disp_manager.hpp" />
<ClInclude Include="mdl\draw_object.hpp" />
<ClInclude Include="gl.hpp" />
@@ -324,6 +327,7 @@ del "$(SolutionDir)bin\$(TargetName).lib"</Command>
<ClInclude Include="sprite.hpp" />
<ClInclude Include="stage.hpp" />
<ClInclude Include="stage_param.hpp" />
<ClInclude Include="task_effect.hpp" />
<ClInclude Include="texture.hpp" />
<ClInclude Include="types.hpp" />
<ClInclude Include="uniform.hpp" />
+5
View File
@@ -81,6 +81,11 @@ HOOK(void, FASTCALL, camera_update, 0x00000001401F8970) {
camera_data->fast_change = false;
}
void camera_struct::get_view_point(vec4& value) {
*(vec3*)&value = view_point;
value.w = 0.0f;
}
void camera_struct::update_data() {
implOfcamera_data_update_projection();
camera_struct__update_view(camera_data);
+2
View File
@@ -50,6 +50,8 @@ struct camera_struct {
bool fast_change_hist1;
int32_t field_22C;
void get_view_point(vec4& value);
static void update_data();
};
+60
View File
@@ -0,0 +1,60 @@
/*
by korenkonder
GitHub/GitLab: korenkonder
*/
#include <thread>
#include "../KKdLib/io/file_stream.hpp"
#include "../KKdLib/hash.hpp"
#include "file_handler.hpp"
#include <sys/stat.h>
void p_file_handler::call_free_callback() {
static void(FASTCALL * p_file_handler__call_free_callback)(p_file_handler * pfhndl)
= (void(FASTCALL*)(p_file_handler * pfhndl))0x0000000140181F30;
p_file_handler__call_free_callback(this);
}
bool p_file_handler::check_not_ready() {
static bool(FASTCALL * p_file_handler__check_not_ready)(p_file_handler * pfhndl)
= (bool(FASTCALL*)(p_file_handler * pfhndl))0x0000000140183340;
return p_file_handler__check_not_ready(this);
}
const void* p_file_handler::get_data() {
static const void* (FASTCALL * p_file_handler__get_data)(p_file_handler * pfhndl)
= (const void* (FASTCALL*)(p_file_handler * pfhndl))0x0000000140182EA0;
return p_file_handler__get_data(this);
}
ssize_t p_file_handler::get_size() {
static ssize_t(FASTCALL * p_file_handler__get_size)(p_file_handler * pfhndl)
= (ssize_t(FASTCALL*)(p_file_handler * pfhndl))0x0000000140183250;
return p_file_handler__get_size(this);
}
bool p_file_handler::read_file(const char* farc_path, const char* file_path, int32_t heap_malloc_type, bool cache) {
static bool (FASTCALL * p_file_handler__read_file)(p_file_handler * pfhndl, const char* farc_path,
const char* file_path, int32_t heap_malloc_type, bool cache)
= (bool (FASTCALL*)(p_file_handler * pfhndl, const char* farc_path,
const char* file_path, int32_t heap_malloc_type, bool cache))0x0000000140183430;
return p_file_handler__read_file(this, farc_path, file_path, heap_malloc_type, cache);
}
void p_file_handler::read_now() {
static void (FASTCALL * p_file_handler__read_now)(p_file_handler * pfhndl)
= (void (FASTCALL*)(p_file_handler * pfhndl))0x00000001401841F0;
p_file_handler__read_now(this);
}
void p_file_handler::reset() {
static void (FASTCALL * p_file_handler__reset)(p_file_handler * pfhndl)
= (void (FASTCALL*)(p_file_handler * pfhndl))0x0000000140182CA0;
p_file_handler__reset(this);
}
void p_file_handler::set_callback_data(int32_t index, PFNFILEHANDLERCALLBACK* func, void* data) {
static void (FASTCALL * p_file_handler__set_callback_data)(p_file_handler * pfhndl, int32_t index, PFNFILEHANDLERCALLBACK func, void* data)
= (void (FASTCALL*)(p_file_handler * pfhndl, int32_t index, PFNFILEHANDLERCALLBACK func, void* data))0x0000000140183F40;
p_file_handler__set_callback_data(this, index, func, data);
}
+35
View File
@@ -0,0 +1,35 @@
/*
by korenkonder
GitHub/GitLab: korenkonder
*/
#pragma once
#include <deque>
#include <list>
#include <mutex>
#include <string>
#include <thread>
#include "../KKdLib/default.hpp"
#include "../KKdLib/farc.hpp"
typedef void (PFNFILEHANDLERCALLBACK)(void*, const void*);
struct file_handler_callback_func {
PFNFILEHANDLERCALLBACK* func;
void* data;
bool ready;
};
struct p_file_handler {
struct file_handler* ptr;
void call_free_callback();
bool check_not_ready();
const void* get_data();
ssize_t get_size();
bool read_file(const char* farc_path, const char* file_path, int32_t heap_malloc_type, bool cache);
void read_now();
void reset();
void set_callback_data(int32_t index, PFNFILEHANDLERCALLBACK* func, void* data);
};
+2
View File
@@ -12,6 +12,7 @@
#include "shader_glsl_ft.hpp"
#include "sprite.hpp"
#include "stage.hpp"
#include "task_effect.hpp"
#include "texture.hpp"
#include <Helpers.h>
@@ -25,6 +26,7 @@ HOOK(int32_t, FASTCALL, data_init, 0x0000000140192FF0) {
rob_patch();
sprite_patch();
stage_patch();
task_effect_patch();
Glitter::Patch();
rctx = new render_context;
+21 -10
View File
@@ -17,6 +17,7 @@
#include "shader_glsl_ft.hpp"
#include "sprite.hpp"
#include "stage_param.hpp"
#include "task_effect.hpp"
#include "texture.hpp"
#include <Helpers.h>
@@ -153,6 +154,16 @@ namespace rndr {
}
void RenderManager::render_all() {
static const GLfloat color_clear[] = { 0.0f, 0.0f, 0.0f, 0.0f };
static const GLfloat depth_clear = 1.0f;
static const GLint stencil_clear = 0;
gl_state_bind_framebuffer(0);
gl_state_set_depth_mask(GL_TRUE);
glClearBufferfv(GL_COLOR, 0, color_clear);
glClearDepthf(depth_clear);
gl_state_set_depth_mask(GL_FALSE);
static const int32_t ibl_texture_index[] = {
9, 10, 11, 12, 13
};
@@ -721,7 +732,7 @@ namespace rndr {
pass_3d_contour();
render->draw_lens_flare();
//star_catalog_draw();
star_catalog_draw();
draw_pass_3d_translucent(
draw_pass_3d[DRAW_PASS_3D_OPAQUE],
@@ -731,10 +742,10 @@ namespace rndr {
mdl::OBJ_TYPE_TRANSPARENT_ALPHA_ORDER_3,
mdl::OBJ_TYPE_TRANSLUCENT_ALPHA_ORDER_3);
//snow_particle_draw();
//rain_particle_draw();
//leaf_particle_draw();
//particle_draw();
snow_particle_draw();
rain_particle_draw();
leaf_particle_draw();
particle_draw();
gl_state_disable_depth_test();
gl_state_set_color_mask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
@@ -1012,7 +1023,7 @@ void draw_pass_set_camera() {
mat4_transpose(&camera_data->projection_matrix, &rctx->proj_mat);
mat4_transpose(&camera_data->view_projection_matrix, &rctx->vp_mat);
rctx->obj_scene.set_projection_view(rctx->view_mat, rctx->proj_mat);
*(vec3*)&rctx->obj_scene.g_view_position = camera_data->view_point;
camera_data->get_view_point(rctx->obj_scene.g_view_position);
rctx->obj_scene.g_view_position.w = 0.0f;
float_t max_distance = camera_data->max_distance;
@@ -1292,10 +1303,10 @@ static void draw_pass_shadow_esm_filter(RenderTexture* dst, RenderTexture* buf,
}
static bool draw_pass_shadow_litproj() {
if (!*stage_param_data_litproj_current)
if (!stage_param_data_litproj_current)
return false;
texture* tex = texture_handler_get_texture((*stage_param_data_litproj_current)->tex_id);
texture* tex = texture_handler_get_texture(stage_param_data_litproj_current->tex_id);
if (!tex)
return false;
@@ -1321,7 +1332,7 @@ static bool draw_pass_shadow_litproj() {
}
static bool draw_pass_shadow_litproj_set() {
if (!*stage_param_data_litproj_current)
if (!stage_param_data_litproj_current)
return 0;
static const vec4 color_clear = 1.0f;
@@ -1781,5 +1792,5 @@ static void blur_filter_apply(RenderTexture* dst, RenderTexture* src,
rctx->filter_scene_ubo.Bind(0);
rctx->imgfilter_batch_ubo.Bind(1);
gl_state_active_bind_texture_2d(0, src->GetColorTex());
//shaders_ft.draw_arrays(GL_TRIANGLE_STRIP, (GLint)(filter * 4LL), 4);
shaders_ft.draw_arrays(GL_TRIANGLE_STRIP, (GLint)(filter * 4LL), 4);
}
+49 -1
View File
@@ -5,4 +5,52 @@
#include "stage_param.hpp"
stage_param_data_litproj** stage_param_data_litproj_current = (stage_param_data_litproj**)0x0000000141194D80;
stage_param_data_litproj*& stage_param_data_litproj_current = *(stage_param_data_litproj**)0x0000000141194D80;
double_t stage_param_data_star_utc::to_julian_date() const {
int64_t year = this->year;
int64_t month = this->month;
if (month == 1 || month == 2) {
year--;
month += 12;
}
return (double_t)(day + year / 400 + (int64_t)((double_t)year * 365.25)
- (int32_t)((double_t)(month - 2) * -30.59) - year / 100)
+ 1721088.5
+ (double_t)hour * (1.0 / 24.0)
+ (double_t)minute * (1.0 / 1440.0)
+ (double_t)second * (1.0 / 86400.0);
}
void stage_param_data_star::get_mat(mat4& mat, const float_t observer_north_latitude,
const float_t observer_east_longitude, const stage_param_data_star_utc& utc, const float_t rotation_y) {
double_t v7 = (utc.to_julian_date() - 2440000.5) * 1.0027379094 + 0.671262;
mat3 rot_y;
mat3_rotate_y((float_t)(v7 - (double_t)(int64_t)v7) * (float_t)(M_PI * 2.0) + observer_east_longitude, &rot_y);
float_t latitude_sin = sinf(observer_north_latitude);
float_t latitude_cos = cosf(observer_north_latitude) * 0.99664718f;
vec3 x_axis = { 0.0f, latitude_cos, -latitude_sin };
mat3_transform_vector(&rot_y, &x_axis, &x_axis);
vec3 y_axis = { 0.0f, latitude_sin, latitude_cos };
mat3_transform_vector(&rot_y, &y_axis, &y_axis);
vec3 z_axis = { 1.0f, 0.0f, 0.0f };
mat3_transform_vector(&rot_y, &z_axis, &z_axis);
x_axis = vec3::normalize(x_axis);
y_axis = vec3::normalize(y_axis);
float_t rot_y_sin = sinf(rotation_y);
float_t rot_y_cos = cosf(rotation_y);
mat4 temp = mat4_identity;
*(vec3*)&temp.row0 = x_axis * -rot_y_sin + z_axis * rot_y_cos;
*(vec3*)&temp.row1 = y_axis;
*(vec3*)&temp.row2 = x_axis * -rot_y_cos + z_axis * -rot_y_sin;
mat4_transpose(&temp, &mat);
}
+6 -1
View File
@@ -144,6 +144,8 @@ struct stage_param_data_star_utc {
int32_t hour;
int32_t minute;
float_t second;
double_t to_julian_date() const;
};
static_assert(sizeof(stage_param_data_star_utc) == 0x18, "\"stage_param_data_star_utc\" struct should have a size of 0x18");
@@ -165,8 +167,11 @@ struct stage_param_data_star {
float_t observer_north_latitude_deg;
float_t observer_east_longitude_deg;
stage_param_data_star_modifiers modifiers[2];
static void get_mat(mat4& mat, const float_t observer_north_latitude,
const float_t observer_east_longitude, const stage_param_data_star_utc& utc, const float_t rotation_y);
};
static_assert(sizeof(stage_param_data_star) == 0x50, "\"stage_param_data_star\" struct should have a size of 0x50");
extern stage_param_data_litproj** stage_param_data_litproj_current;
extern stage_param_data_litproj*& stage_param_data_litproj_current;
File diff suppressed because it is too large Load Diff
+58
View File
@@ -0,0 +1,58 @@
/*
by korenkonder
GitHub/GitLab: korenkonder
*/
#pragma once
#include "../KKdLib/default.hpp"
#include "../KKdLib/vec.hpp"
#include "../KKdLib/mat.hpp"
#include "../KKdLib/vec.hpp"
#include "gl_shader_storage_buffer.hpp"
#include "gl_uniform_buffer.hpp"
#include "rob/rob.hpp"
#include "render_texture.hpp"
#include "stage.hpp"
#include "stage_param.hpp"
enum TaskEffectType {
TASK_EFFECT_INVALID = -1,
TASK_EFFECT_AUTH_3D = 0x00,
TASK_EFFECT_TYPE_1 = 0x01,
TASK_EFFECT_LEAF = 0x02,
TASK_EFFECT_TYPE_3 = 0x03,
TASK_EFFECT_SNOW = 0x04,
TASK_EFFECT_TYPE_5 = 0x05,
TASK_EFFECT_RIPPLE = 0x06,
TASK_EFFECT_RAIN = 0x07,
TASK_EFFECT_TYPE_8 = 0x08,
TASK_EFFECT_TYPE_9 = 0x09,
TASK_EFFECT_TYPE_10 = 0x0A,
TASK_EFFECT_TYPE_11 = 0x0B,
TASK_EFFECT_SPLASH = 0x0C,
TASK_EFFECT_TYPE_13 = 0x0D,
TASK_EFFECT_FOG_ANIM = 0x0E,
TASK_EFFECT_TYPE_15 = 0x0F,
TASK_EFFECT_FOG_RING = 0x10,
TASK_EFFECT_TYPE_17 = 0x11,
TASK_EFFECT_PARTICLE = 0x12,
TASK_EFFECT_LITPROJ = 0x13,
TASK_EFFECT_STAR = 0x14,
};
struct particle_init_data {
float_t field_0;
float_t field_4;
float_t field_8;
vec3 trans;
float_t scale_y;
};
extern void leaf_particle_draw();
extern void rain_particle_draw();
extern void particle_draw();
extern void snow_particle_draw();
extern void star_catalog_draw();
extern void task_effect_patch();