mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-08 14:48:15 +03:00
DwFaceLight
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
|
||||
#include "graphics.hpp"
|
||||
#include "../graphics/face_light.hpp"
|
||||
#include "../graphics/light.hpp"
|
||||
#include "graphics/background_color.hpp"
|
||||
#include "graphics/face_light.hpp"
|
||||
#include "graphics/fog.hpp"
|
||||
#include "graphics/glitter.hpp"
|
||||
#include "graphics/post_process.hpp"
|
||||
@@ -44,11 +44,11 @@ classes_data graphics_classes[] = {
|
||||
{
|
||||
"Face Light##Graphics",
|
||||
CLASSES_IN_CONTEXT_MENU,
|
||||
graphics_face_light_init,
|
||||
graphics_face_light_imgui,
|
||||
graphics_face_light_dispose,
|
||||
(classes_init_func)dw_face_light_init,
|
||||
CLASSES_DATA_NO_FUNC,
|
||||
CLASSES_DATA_NO_FUNC,
|
||||
{
|
||||
(class_flags)(CLASS_DISPOSED | CLASS_HIDDEN),
|
||||
CLASS_DW,
|
||||
false,
|
||||
CLASS_DATA_NO_DATA,
|
||||
},
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "face_light.hpp"
|
||||
#include "../../../KKdLib/vec.hpp"
|
||||
#include "../../../CRE/clear_color.hpp"
|
||||
#include "../../imgui_helper.hpp"
|
||||
|
||||
extern int32_t width;
|
||||
extern int32_t height;
|
||||
|
||||
static const char* graphics_face_light_window_title = "Face Light##Graphics";
|
||||
|
||||
bool graphics_face_light_init(class_data* data, render_context* rctx) {
|
||||
graphics_face_light_dispose(data);
|
||||
data->data = rctx;
|
||||
return true;
|
||||
}
|
||||
|
||||
void graphics_face_light_imgui(class_data* data) {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImFont* font = ImGui::GetFont();
|
||||
|
||||
float_t w = min_def((float_t)width, 200.0f);
|
||||
float_t h = min_def((float_t)height, 84.0f);
|
||||
|
||||
ImGui::SetNextWindowPos({ 0, 0 }, ImGuiCond_Appearing);
|
||||
ImGui::SetNextWindowSize({ w, h }, ImGuiCond_Always);
|
||||
|
||||
ImGuiWindowFlags window_flags = 0;
|
||||
window_flags |= ImGuiWindowFlags_NoResize;
|
||||
|
||||
data->imgui_focus = false;
|
||||
bool open = data->flags & CLASS_HIDDEN ? false : true;
|
||||
bool collapsed = !ImGui::Begin(graphics_face_light_window_title, &open, window_flags);
|
||||
if (!open) {
|
||||
enum_or(data->flags, CLASS_HIDE);
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
else if (collapsed) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
render_context* rctx = (render_context*)data->data;
|
||||
if (!rctx) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
face* face = &rctx->face;
|
||||
|
||||
w = ImGui::GetContentRegionAvailWidth();
|
||||
if (ImGui::ButtonEnterKeyPressed("Reset", { w, 0.0f }))
|
||||
light_param_data_storage_data_set_stage(
|
||||
light_param_data_storage_data_get_stage_index(), LIGHT_PARAM_DATA_STORAGE_FACE);
|
||||
|
||||
ImGui::GetContentRegionAvailSetNextItemWidth();
|
||||
float_t strength = face->get_offset();
|
||||
if (ImGui::ColumnSliderFloatButton("Strength",
|
||||
&strength, 0.25f, 0.0f, 10.0f, 1.0f, "%5.2f", 0))
|
||||
face->set_offset(strength);
|
||||
|
||||
data->imgui_focus |= ImGui::IsWindowFocused();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool graphics_face_light_dispose(class_data* data) {
|
||||
data->data = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../KKdLib/default.hpp"
|
||||
#include "../../classes.hpp"
|
||||
|
||||
extern bool graphics_face_light_init(class_data* data, render_context* rctx);
|
||||
extern void graphics_face_light_imgui(class_data* data);
|
||||
extern bool graphics_face_light_dispose(class_data* data);
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "face_light.hpp"
|
||||
#include "../../CRE/light_param/face.hpp"
|
||||
#include "../../CRE/light_param.hpp"
|
||||
#include "../../CRE/render_context.hpp"
|
||||
|
||||
extern render_context* rctx_ptr;
|
||||
|
||||
class DwFaceLight : public dw::Shell {
|
||||
public:
|
||||
class SliderSelectionListener : public dw::SelectionAdapter {
|
||||
public:
|
||||
SliderSelectionListener();
|
||||
virtual ~SliderSelectionListener() override;
|
||||
|
||||
virtual void Callback(dw::SelectionListener::CallbackData* data) override;
|
||||
};
|
||||
|
||||
dw::Button* set_for_each_cut_button;
|
||||
face face_data;
|
||||
dw::Slider* strength;
|
||||
//int64_t field_1B0;
|
||||
//int64_t field_1B8;
|
||||
bool set_for_each_cut;
|
||||
|
||||
DwFaceLight();
|
||||
virtual ~DwFaceLight() override;
|
||||
virtual void Draw() override;
|
||||
|
||||
virtual void Hide() override;
|
||||
|
||||
void FaceDataGet();
|
||||
|
||||
static void ResetCallback(dw::Widget* data);
|
||||
static void SetForEachPvCutCallback(dw::Widget* data);
|
||||
};
|
||||
|
||||
DwFaceLight* dw_face_light;
|
||||
DwFaceLight::SliderSelectionListener dw_face_light_slider_selection_listener;
|
||||
|
||||
void dw_face_light_init(dw::Widget* data) {
|
||||
if (!dw_face_light) {
|
||||
dw_face_light = new DwFaceLight;
|
||||
dw_face_light->sub_1402F38B0();
|
||||
}
|
||||
else
|
||||
dw_face_light->Disp();
|
||||
}
|
||||
|
||||
DwFaceLight::SliderSelectionListener::SliderSelectionListener() {
|
||||
|
||||
}
|
||||
|
||||
DwFaceLight::SliderSelectionListener::~SliderSelectionListener() {
|
||||
|
||||
}
|
||||
|
||||
void DwFaceLight::SliderSelectionListener::Callback(dw::SelectionListener::CallbackData* data) {
|
||||
dw::Slider* slider = dynamic_cast<dw::Slider*>(data->widget);
|
||||
if (slider)
|
||||
((face*)slider->callback_data.v64)->offset = slider->scroll_bar->value;
|
||||
}
|
||||
|
||||
DwFaceLight::DwFaceLight() {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
stage_database* aft_stage_data = &aft_data->data_ft.stage_data;
|
||||
|
||||
FaceDataGet();
|
||||
|
||||
SetText("FACE LIGHT");
|
||||
|
||||
dw::Button* reset = new dw::Button(this, dw::FLAG_8);
|
||||
reset->SetText("RESET");
|
||||
reset->callback = DwFaceLight::ResetCallback;
|
||||
|
||||
#if DW_TRANSLATE
|
||||
const char* set_for_each_cut_text = "Set for each PV cut";
|
||||
const char* strength_text = "Strength";
|
||||
#else
|
||||
const char* set_for_each_cut_text = "PVのカットごとに設定";
|
||||
const char* strength_text = "強さ";
|
||||
#endif
|
||||
|
||||
set_for_each_cut_button = new dw::Button(this, dw::CHECKBOX);
|
||||
set_for_each_cut_button->SetText(set_for_each_cut_text);
|
||||
set_for_each_cut_button->SetValue(set_for_each_cut);
|
||||
set_for_each_cut_button->callback_data.i64 = 0i64;
|
||||
set_for_each_cut_button->callback = DwFaceLight::SetForEachPvCutCallback;
|
||||
|
||||
strength = dw::Slider::Create(this, (dw::Flags)(dw::FLAG_800
|
||||
| dw::HORIZONTAL), 0.0f, 0.0f, 128.0f, 20.0f, strength_text);
|
||||
strength->SetParams(face_data.offset, 0.0f, 10.0f, 1.0f, 0.25f, 1.0f);
|
||||
strength->callback_data.v64 = &face_data;
|
||||
strength->format = "%5.2f";
|
||||
strength->AddSelectionListener(&dw_face_light_slider_selection_listener);
|
||||
|
||||
UpdateLayout();
|
||||
}
|
||||
|
||||
DwFaceLight::~DwFaceLight() {
|
||||
|
||||
}
|
||||
|
||||
void DwFaceLight::Draw() {
|
||||
strength->SetValue(face_data.offset);
|
||||
rctx_ptr->face = face_data;
|
||||
dw::Shell::Draw();
|
||||
}
|
||||
|
||||
void DwFaceLight::Hide() {
|
||||
SetDisp();
|
||||
}
|
||||
|
||||
void DwFaceLight::FaceDataGet() {
|
||||
face_data = rctx_ptr->face;
|
||||
}
|
||||
|
||||
void DwFaceLight::ResetCallback(dw::Widget* data) {
|
||||
rctx_ptr->face = {};
|
||||
}
|
||||
|
||||
void DwFaceLight::SetForEachPvCutCallback(dw::Widget* data) {
|
||||
dw::Button* button = dynamic_cast<dw::Button*>(data);
|
||||
if (button)
|
||||
dw_face_light->set_for_each_cut = button->value;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../KKdLib/default.hpp"
|
||||
#include "../dw.hpp"
|
||||
|
||||
extern void dw_face_light_init(dw::Widget* data = 0);
|
||||
Reference in New Issue
Block a user