Beispiel #1
0
void TabButtons()
{
	const char* tabs[] = {
			"Models",
			"Skins",
	};

	for (int i = 0; i < IM_ARRAYSIZE(tabs); i++)
	{
		int distance = i == page ? 0 : i > page ? i - page : page - i;

		ImGui::GetStyle().Colors[ImGuiCol_Button] = ImVec4(
				Settings::UI::mainColor.Color().Value.x - (distance * 0.06f),
				Settings::UI::mainColor.Color().Value.y - (distance * 0.06f),
				Settings::UI::mainColor.Color().Value.z - (distance * 0.06f),
				Settings::UI::mainColor.Color().Value.w
		);

		if (ImGui::Button(tabs[i], ImVec2(ImGui::GetWindowSize().x / IM_ARRAYSIZE(tabs) - 9, 0)))
			page = i;

		ImGui::GetStyle().Colors[ImGuiCol_Button] = Settings::UI::mainColor.Color();

		if (i < IM_ARRAYSIZE(tabs) - 1)
			ImGui::SameLine();
	}
}
// Functions
bool    ImGui_ImplOpenGL3_Init(const char* glsl_version)
{
    ImGuiIO& io = ImGui::GetIO();
    io.BackendRendererName = "imgui_impl_opengl3";

    // Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
#if defined(IMGUI_IMPL_OPENGL_ES2)
    if (glsl_version == NULL)
        glsl_version = "#version 100";
#elif defined(IMGUI_IMPL_OPENGL_ES3)
    if (glsl_version == NULL)
        glsl_version = "#version 300 es";
#else
    if (glsl_version == NULL)
        glsl_version = "#version 130";
#endif
    IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
    strcpy(g_GlslVersionString, glsl_version);
    strcat(g_GlslVersionString, "\n");

    // Make a dummy GL call (we don't actually need the result)
    // IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code.
    // Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
    GLint current_texture;
    glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);

    return true;
}
Beispiel #3
0
static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
{
    // Update buttons
    ImGuiIO& io = ImGui::GetIO();
    for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
    {
        // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
        io.MouseDown[i] = g_MouseJustPressed[i] || glfwGetMouseButton(g_Window, i) != 0;
        g_MouseJustPressed[i] = false;
    }

    // Update mouse position
    const ImVec2 mouse_pos_backup = io.MousePos;
    io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
    if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED))
    {
        if (io.WantSetMousePos)
        {
            glfwSetCursorPos(g_Window, (double)mouse_pos_backup.x, (double)mouse_pos_backup.y);
        }
        else
        {
            double mouse_x, mouse_y;
            glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
            io.MousePos = ImVec2((float)mouse_x, (float)mouse_y);
        }
    }
}
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
{
    if (g_PrevUserCallbackMousebutton != NULL)
        g_PrevUserCallbackMousebutton(window, button, action, mods);

    if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
        g_MouseJustPressed[button] = true;
}
Beispiel #5
0
void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y)
{
    //printf("key_up_func %d\n", key);
    ImGuiIO& io = ImGui::GetIO();
    if (key + 256 < IM_ARRAYSIZE(io.KeysDown))
        io.KeysDown[key + 256] = false;
    ImGui_ImplGLUT_UpdateKeyboardMods();
    (void)x; (void)y; // Unused
}
Beispiel #6
0
bool    ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks, const char* glsl_version)
{
	// Store GL version string so we can refer to it later in case we recreate shaders.
	if (glsl_version == NULL)
		glsl_version = "#version 150";
	IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersion));
	strcpy(g_GlslVersion, glsl_version);
	strcat(g_GlslVersion, "\n");
	return true;
}
Beispiel #7
0
void ImGui::RenderTextCentered(int x, int y, const ImVec4& color, const char* fmt, ...)
{
	va_list args;
	va_start(args, fmt);

	auto& g = *GImGui;
	const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);

	RenderTextOverlay(ImVec2((float)x, (float)y), color, ImGuiAlign_Center, g.TempBuffer, text_end);
}
Beispiel #8
0
void ImGui::RenderText(const ImVec2& pos, const ImVec4& color, const char* fmt, ...)
{
	va_list args;
	va_start(args, fmt);

	auto& g = *GImGui;
	const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);

	RenderTextOverlay(pos, color, ImGuiAlign_Left, g.TempBuffer, text_end);
}
Beispiel #9
0
// Functions
bool    ImGui_ImplOpenGL3_Init(const char* glsl_version)
{
    // Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
#ifdef USE_GL_ES3
    if (glsl_version == NULL)
        glsl_version = "#version 300 es";
#else
    if (glsl_version == NULL)
        glsl_version = "#version 130";
#endif
    IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
    strcpy(g_GlslVersionString, glsl_version);
    strcat(g_GlslVersionString, "\n");
    return true;
}
Beispiel #10
0
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
bool ImGui_ImplSDL2_ProcessEvent(SDL_Event* event)
{
    ImGuiIO& io = ImGui::GetIO();
    switch (event->type)
    {
    case SDL_MOUSEWHEEL:
        {
            if (event->wheel.x > 0) io.MouseWheelH += 1;
            if (event->wheel.x < 0) io.MouseWheelH -= 1;
            if (event->wheel.y > 0) io.MouseWheel += 1;
            if (event->wheel.y < 0) io.MouseWheel -= 1;
            return true;
        }
    case SDL_MOUSEBUTTONDOWN:
        {
            if (event->button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
            if (event->button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
            if (event->button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
            return true;
        }
    case SDL_TEXTINPUT:
        {
            io.AddInputCharactersUTF8(event->text.text);
            return true;
        }
    case SDL_KEYDOWN:
    case SDL_KEYUP:
        {
            int key = event->key.keysym.scancode;
            IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
            io.KeysDown[key] = (event->type == SDL_KEYDOWN);
            io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
            io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
            io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
            io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
            return true;
        }
    }
    return false;
}
Beispiel #11
0
static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR surface, int width, int height)
{
    wd->Surface = surface;

    // Check for WSI support
    VkBool32 res;
    vkGetPhysicalDeviceSurfaceSupportKHR(g_PhysicalDevice, g_QueueFamily, wd->Surface, &res);
    if (res != VK_TRUE)
    {
        fprintf(stderr, "Error no WSI support on physical device 0\n");
        exit(-1);
    }

    // Get Surface Format
    const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
    const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
    wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);

    // Get Present Mode
#ifdef IMGUI_UNLIMITED_FRAME_RATE
    VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
#else
    VkPresentModeKHR present_mode = VK_PRESENT_MODE_FIFO_KHR;
#endif
    wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_mode, 1);

    // Create SwapChain, RenderPass, Framebuffer, etc.
    ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
    ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, wd, g_Allocator, width, height);
}
Beispiel #12
0
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
{
    if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
        g_MouseJustPressed[button] = true;
}
Beispiel #13
0
    {
        for (int i = 0; i < Items.Size; i++)
        {
            free(Items[i]);
        }
        Items.clear();
        ScrollToBottom = true;
    }

    void AddLog(const char* fmt, ...) IM_PRINTFARGS(2)
    {
        char buf[1024];
        va_list args;
        va_start(args, fmt);
        vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
        buf[IM_ARRAYSIZE(buf)-1] = 0;
        va_end(args);
        Items.push_back(Strdup(buf));
        ScrollToBottom = true;
    }

    void Draw(const char* title, bool* p_open)
    {
        ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiSetCond_FirstUseEver);
        if (!ImGui::Begin(title, p_open))
        {
            ImGui::End();
            return;
        }

        if (ImGui::SmallButton("Clear"))
void ImGui_ImplSdlGL2_NewFrame(SDL_Window *window)
{
    if (!g_FontTexture)
        ImGui_ImplSdlGL2_CreateDeviceObjects();

    ImGuiIO& io = ImGui::GetIO();

    // Setup display size (every frame to accommodate for window resizing)
    int w, h;
    int display_w, display_h;
    SDL_GetWindowSize(window, &w, &h);
    SDL_GL_GetDrawableSize(window, &display_w, &display_h);
    io.DisplaySize = ImVec2((float)w, (float)h);
    io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0);

    // Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
    static Uint64 frequency = SDL_GetPerformanceFrequency();
    Uint64 current_time = SDL_GetPerformanceCounter();
    io.DeltaTime = g_Time > 0 ? (float)((double)(current_time - g_Time) / frequency) : (float)(1.0f / 60.0f);
    g_Time = current_time;

    // Setup mouse inputs (we already got mouse wheel, keyboard keys & characters from our event handler)
    int mx, my;
    Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
    io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
    io.MouseDown[0] = g_MousePressed[0] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0;  // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
    io.MouseDown[1] = g_MousePressed[1] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
    io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
    g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;

    // We need to use SDL_CaptureMouse() to easily retrieve mouse coordinates outside of the client area. This is only supported from SDL 2.0.4 (released Jan 2016)
#if (SDL_MAJOR_VERSION >= 2) && (SDL_MINOR_VERSION >= 0) && (SDL_PATCHLEVEL >= 4)   
    if ((SDL_GetWindowFlags(window) & (SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_MOUSE_CAPTURE)) != 0)
        io.MousePos = ImVec2((float)mx, (float)my);
    bool any_mouse_button_down = false;
    for (int n = 0; n < IM_ARRAYSIZE(io.MouseDown); n++)
        any_mouse_button_down |= io.MouseDown[n];
    if (any_mouse_button_down && (SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE) == 0)
        SDL_CaptureMouse(SDL_TRUE);
    if (!any_mouse_button_down && (SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE) != 0)
        SDL_CaptureMouse(SDL_FALSE);
#else
    if ((SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS) != 0)
        io.MousePos = ImVec2((float)mx, (float)my);
#endif

    // Update OS/hardware mouse cursor if imgui isn't drawing a software cursor
    ImGuiMouseCursor cursor = ImGui::GetMouseCursor();
    if (io.MouseDrawCursor || cursor == ImGuiMouseCursor_None)
    {
        SDL_ShowCursor(0);
    }
    else
    {
        SDL_SetCursor(g_MouseCursors[cursor] ? g_MouseCursors[cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
        SDL_ShowCursor(1);
    }

    // Start the frame. This call will update the io.WantCaptureMouse, io.WantCaptureKeyboard flag that you can use to dispatch inputs (or not) to your application.
    ImGui::NewFrame();
}
Beispiel #15
0
bool ImGui::InputTextM(const char* label, std::string& text)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)	
	bool ret = InputTextEx(label, &text[0], text.capacity(), ImVec2(0, 0), 0, 0, nullptr);
	return ret;
#else
	ImGuiWindow* window = GetCurrentWindow();
	if (window->SkipItems)
		return false;

	ImGuiContext& g = *GImGui;
	const ImGuiIO& io = g.IO;
	const ImGuiStyle& style = g.Style;
	//============================================
	const ImGuiID id = window->GetID(label);
	const ImVec2 label_size = CalcTextSize(label, NULL, true);
	ImVec2 size = CalcItemSize(ImVec2(0, 0), CalcItemWidth(), label_size.y + style.FramePadding.y*2.0f);
	const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
	const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f));
	//============================================
	ItemSize(total_bb, style.FramePadding.y);
	if (!ItemAdd(total_bb, &id))
		return false;

	const bool hovered = IsHovered(frame_bb, id);
	if (hovered)
	{
		SetHoveredID(id);
		g.MouseCursor = ImGuiMouseCursor_TextInput;
	}
	ImGuiTextEditState& edit_state = g.InputTextState;
	const bool user_clicked = hovered && io.MouseClicked[0];
	if (user_clicked)
	{
		if (g.ActiveId != id)
		{
			edit_state.CursorAnimReset();
		}
		SetActiveID(id, window);
		FocusWindow(window);
	}
	else if (io.MouseClicked[0])
	{
		// Release focus when we click outside
		if (g.ActiveId == id)
			SetActiveID(0, NULL);
	}

	if (g.ActiveId == id)
	{
		//window->DrawList->AddRectFilled(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_TextSelectedBg), style.FrameRounding);
		RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_TextSelectedBg), true, style.FrameRounding);
		ImRect frame_select(frame_bb);
		frame_select.Reduce(ImVec2(2, 2));
		RenderFrame(frame_select.Min, frame_select.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
	}else
	{
		RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
	}

	//============================================
	int w = snprintf(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s", text.c_str());
	int tempSize = IM_ARRAYSIZE(g.TempBuffer);
	g.TempBuffer[tempSize - 1] = 0;
	const char* text_end = g.TempBuffer + ((w == -1) ? tempSize : w);

	// Render Text
	const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size
	ImVec2 render_pos = frame_bb.Min + style.FramePadding;
	window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), g.TempBuffer, text_end, 0.0f, &clip_rect);

	if (label_size.x > 0)
		RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);

	return user_clicked;
#endif
}
Beispiel #16
0
void DialogShadertoy::render(bool* p_opened) {
    ImGui::SetNextWindowSize(ImVec2(400, 500), ImGuiSetCond_FirstUseEver);
    ImGui::SetNextWindowPos(ImVec2(200, 200), ImGuiSetCond_FirstUseEver);

    ImGui::Begin("Shadertoy.com", p_opened, ImGuiWindowFlags_ShowBorders);

    this->windowWidth = ImGui::GetWindowWidth();
    this->windowHeight = ImGui::GetWindowHeight();
    this->textureWidth = int(this->windowWidth - this->viewPaddingHorizontal);
    this->textureHeight = int(this->windowHeight - this->viewPaddingVertical);

    if (this->heightTopPanel < this->engineShadertoy->textureHeight || this->heightTopPanel > this->engineShadertoy->textureHeight)
        this->engineShadertoy->initFBO(
                    int(this->windowWidth),
                    int(this->heightTopPanel),
                    &this->vboTexture);

    this->engineShadertoy->renderToTexture(
            int(ImGui::GetIO().MousePos.x),
            int(ImGui::GetIO().MousePos.y),
            (SDL_GetTicks() / 1000.0f),
            &this->vboTexture
    );

// BEGIN preview
    ImGui::BeginChild("Preview", ImVec2(0, this->heightTopPanel), true);

    ImDrawList* draw_list = ImGui::GetWindowDrawList();
    ImVec2 offset = ImGui::GetCursorScreenPos() - this->scrolling;

    draw_list->ChannelsSetCurrent(0);
    ImVec2 bb_min = offset;
    ImVec2 bb_max = ImVec2(this->textureWidth, this->textureHeight) + offset;
    draw_list->AddImage(ImTextureID(intptr_t(this->vboTexture)), bb_min, bb_max);

    draw_list->ChannelsMerge();

    ImGui::EndChild();
// END preview

// BEGIN preview delimiter
    ImGui::GetIO().MouseDrawCursor = true;
    ImGui::PushStyleColor(ImGuiCol_Button, ImColor(89, 91, 94));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor(119, 122, 124));
    ImGui::PushStyleColor(ImGuiCol_Border, ImColor(0, 0, 0));
    ImGui::Button("###splitterGUI", ImVec2(-1, 6.0f));
    ImGui::PopStyleColor(3);
    if (ImGui::IsItemActive())
        this->heightTopPanel += ImGui::GetIO().MouseDelta.y;
    if (ImGui::IsItemHovered())
        ImGui::SetMouseCursor(3);
    else
        ImGui::GetIO().MouseDrawCursor = false;
// END preview delimiter

// BEGIN editor
    ImGui::BeginChild("Editor", ImVec2(0, 0), false);

// buttons
    if (ImGui::Button("COMPILE", ImVec2(ImGui::GetWindowWidth() * 0.85f, this->buttonCompileHeight)))
        this->compileShader();
    ImGui::SameLine();
    if (ImGui::Button("Paste", ImVec2(ImGui::GetWindowWidth() * 0.14f, this->buttonCompileHeight)))
        this->getFromClipboard();

// BEGIN textures
    ImGui::BeginChild("Options", ImVec2(this->widthTexturesPanel, 0), false);

    ImGui::Text("Examples");

    if (ImGui::Button("Artificial", ImVec2(-1.0f, 0.0f)))
        this->openExample(Settings::Instance()->appFolder() + "/shaders/stoy/4ljGW1.stoy");
    if (ImGui::IsItemHovered()) ImGui::SetTooltip("Artificial");

    if (ImGui::Button(" Combustible\nVoronoi Layers", ImVec2(-1.0f, 0.0f)))
        this->openExample(Settings::Instance()->appFolder() + "/shaders/stoy/4tlSzl.stoy");
    if (ImGui::IsItemHovered()) ImGui::SetTooltip("Combustible Voronoi Layers");

    if (ImGui::Button("Seascape", ImVec2(-1.0f, 0.0f)))
        this->openExample(Settings::Instance()->appFolder() + "/shaders/stoy/Ms2SD1.stoy");
    if (ImGui::IsItemHovered()) ImGui::SetTooltip("Seascape");

    if (ImGui::Button("Star Nest", ImVec2(-1.0f, 0.0f)))
        this->openExample(Settings::Instance()->appFolder() + "/shaders/stoy/XlfGRj.stoy");
    if (ImGui::IsItemHovered()) ImGui::SetTooltip("Star Nest");

    if (ImGui::Button("Sun Surface", ImVec2(-1.0f, 0.0f)))
        this->openExample(Settings::Instance()->appFolder() + "/shaders/stoy/XlSSzK.stoy");
    if (ImGui::IsItemHovered()) ImGui::SetTooltip("Sun Surface");

    ImGui::Separator();

    const char* textureImages[] = {
        " -- NONE -- ",
        "tex00.jpg", "tex01.jpg", "tex02.jpg", "tex03.jpg", "tex04.jpg", "tex05.jpg", "tex06.jpg", "tex07.jpg", "tex08.jpg", "tex09.jpg", "tex10.jpg",
        "tex11.jpg", "tex12.jpg", "tex13.jpg", "tex14.jpg", "tex15.jpg", "tex16.jpg", "tex17.jpg", "tex18.jpg", "tex19.jpg", "tex20.jpg"
    };

    const char* cubemapImages[] = {
        " -- NONE -- ",
        "cube00_0.jpg", "cube00_1.jpg", "cube00_2.jpg", "cube00_3.jpg",
        "cube00_4.jpg", "cube00_5.jpg", "cube01_0.png", "cube01_1.png", "cube01_2.png", "cube01_3.png", "cube01_4.png", "cube01_5.png",
        "cube02_0.jpg", "cube02_1.jpg", "cube02_2.jpg", "cube02_3.jpg", "cube02_4.jpg", "cube02_5.jpg", "cube03_0.png", "cube03_1.png",
        "cube03_2.png", "cube03_3.png", "cube03_4.png", "cube03_5.png", "cube04_0.png", "cube04_1.png", "cube04_2.png", "cube04_3.png",
        "cube04_4.png", "cube04_5.png", "cube05_0.png", "cube05_1.png", "cube05_2.png", "cube05_3.png", "cube05_4.png", "cube05_5.png"
    };

    ImGui::PushItemWidth(-1);
    ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 6));
    ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 100));

    ImGui::TextColored(ImColor(255.0f, 0.0f, 0.0f, 255.0f), "Channel #0");
    ImGui::Checkbox("Cubemap?##001", &this->channel0Cube);
    if (this->channel0Cube)
        ImGui::ListBox("##cubemap0", &this->cubemapImage0, cubemapImages, IM_ARRAYSIZE(cubemapImages), 3);
    else
        ImGui::ListBox("##texImage0", &this->texImage0, textureImages, IM_ARRAYSIZE(textureImages), 3);

    ImGui::Separator();

    ImGui::TextColored(ImColor(255.0f, 0.0f, 0.0f, 255.0f), "Channel #1");
    ImGui::Checkbox("Cubemap?##002", &this->channel1Cube);
    if (this->channel1Cube)
        ImGui::ListBox("##cubemap1", &this->cubemapImage1, cubemapImages, IM_ARRAYSIZE(cubemapImages), 3);
    else
        ImGui::ListBox("##texImage1", &this->texImage1, textureImages, IM_ARRAYSIZE(textureImages), 3);

    ImGui::Separator();

    ImGui::TextColored(ImColor(255.0f, 0.0f, 0.0f, 255.0f), "Channel #2");
    ImGui::Checkbox("Cubemap?##003", &this->channel2Cube);
    if (this->channel2Cube)
        ImGui::ListBox("##cubemap2", &this->cubemapImage2, cubemapImages, IM_ARRAYSIZE(cubemapImages), 3);
    else
        ImGui::ListBox("##texImage2", &this->texImage2, textureImages, IM_ARRAYSIZE(textureImages), 3);

    ImGui::Separator();

    ImGui::TextColored(ImColor(255.0f, 0.0f, 0.0f, 255.0f), "Channel #3");
    ImGui::Checkbox("Cubemap?##004", &this->channel3Cube);
    if (this->channel3Cube)
        ImGui::ListBox("##cubemap3", &this->cubemapImage3, cubemapImages, IM_ARRAYSIZE(cubemapImages), 3);
    else
        ImGui::ListBox("##texImage3", &this->texImage3, textureImages, IM_ARRAYSIZE(textureImages), 3);

    ImGui::PopStyleVar(2);

    if (this->texImage0 > 0) {
        this->engineShadertoy->iChannel0_CubeImage = "";
        this->engineShadertoy->iChannel0_Image = Settings::Instance()->appFolder() + "tex" + std::string((this->texImage0 < 10) ? "0" : "") + std::to_string(this->texImage0) + ".jpg";
        this->texImage0 = 0;
    }
    if (this->cubemapImage0 > 0) {
        this->engineShadertoy->iChannel0_Image = "";
        this->engineShadertoy->iChannel0_CubeImage = Settings::Instance()->appFolder() + cubemapImages[this->cubemapImage0];
        this->cubemapImage0 = 0;
    }

    if (this->texImage1 > 0) {
        this->engineShadertoy->iChannel1_CubeImage = "";
        this->engineShadertoy->iChannel1_Image = Settings::Instance()->appFolder() + "tex" + std::string((this->texImage1 < 10) ? "0" : "") + std::to_string(this->texImage1) + ".jpg";
        this->texImage1 = 0;
    }
    if (this->cubemapImage1 > 0) {
        this->engineShadertoy->iChannel1_Image = "";
        this->engineShadertoy->iChannel1_CubeImage = Settings::Instance()->appFolder() + cubemapImages[this->cubemapImage1];
        this->cubemapImage1 = 0;
    }

    if (this->texImage2 > 0) {
        this->engineShadertoy->iChannel2_CubeImage = "";
        this->engineShadertoy->iChannel2_Image = Settings::Instance()->appFolder() + "tex" + std::string((this->texImage2 < 10) ? "0" : "") + std::to_string(this->texImage2) + ".jpg";
        this->texImage2 = 0;
    }
    if (this->cubemapImage2 > 0) {
        this->engineShadertoy->iChannel2_Image = "";
        this->engineShadertoy->iChannel2_CubeImage = Settings::Instance()->appFolder() + cubemapImages[this->cubemapImage2];
        this->cubemapImage2 = 0;
    }

    if (this->texImage3 > 0) {
        this->engineShadertoy->iChannel3_CubeImage = "";
        this->engineShadertoy->iChannel3_Image = Settings::Instance()->appFolder() + "tex" + std::string((this->texImage3 < 10) ? "0" : "") + std::to_string(this->texImage3) + ".jpg";
        this->texImage3 = 0;
    }
    if (this->cubemapImage3 > 0) {
        this->engineShadertoy->iChannel3_Image = "";
        this->engineShadertoy->iChannel3_CubeImage = Settings::Instance()->appFolder() + cubemapImages[this->cubemapImage3];
        this->cubemapImage3 = 0;
    }

    ImGui::EndChild();

// BEGIN textures delimiter
    ImGui::SameLine();
    ImGui::GetIO().MouseDrawCursor = true;
    ImGui::PushStyleColor(ImGuiCol_Button, ImColor(89, 91, 94));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor(119, 122, 124));
    ImGui::PushStyleColor(ImGuiCol_Border, ImColor(0, 0, 0));
    ImGui::Button("###splitterGUI2", ImVec2(4.0f, -1));
    ImGui::PopStyleColor(3);
    if (ImGui::IsItemActive())
        this->widthTexturesPanel += ImGui::GetIO().MouseDelta.x;
    if (ImGui::IsItemHovered())
        ImGui::SetMouseCursor(4);
    else
        ImGui::GetIO().MouseDrawCursor = false;
    ImGui::SameLine();
// END textures delimiter

// BEGIN IDE
    ImGui::BeginChild("IDE", ImVec2(0.0f, 0.0f), false);
    int lines = static_cast<int>((ImGui::GetWindowHeight() - 4.0f) / ImGui::GetTextLineHeight());
    ImGui::InputTextMultiline("##source", this->shadertoyEditorText, IM_ARRAYSIZE(this->shadertoyEditorText), ImVec2(-1.0f, ImGui::GetTextLineHeight() * lines), ImGuiInputTextFlags_AllowTabInput);
    ImGui::EndChild();

// END editor
    ImGui::EndChild();

    if (ImGui::IsWindowHovered() && !ImGui::IsAnyItemActive() && ImGui::IsMouseDragging(2, 0.0f))
        this->scrolling = this->scrolling - ImGui::GetIO().MouseDelta;

    ImGui::End();
}
bool    ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks, const char* glsl_version)
{
    g_Window = window;

    // Store GL version string so we can refer to it later in case we recreate shaders.
    if (glsl_version == NULL)
        glsl_version = "#version 150";
    IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersion));
    strcpy(g_GlslVersion, glsl_version);
    strcat(g_GlslVersion, "\n");

    // Setup back-end capabilities flags
    ImGuiIO& io = ImGui::GetIO();
    io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors;   // We can honor GetMouseCursor() values (optional)
    io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos;    // We can honor io.WantSetMousePos requests (optional, rarely used)

    // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
    io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
    io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
    io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
    io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
    io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
    io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP;
    io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN;
    io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
    io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
    io.KeyMap[ImGuiKey_Insert] = GLFW_KEY_INSERT;
    io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
    io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
    io.KeyMap[ImGuiKey_Space] = GLFW_KEY_SPACE;
    io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
    io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
    io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
    io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
    io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
    io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
    io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
    io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;

    io.SetClipboardTextFn = ImGui_ImplGlfwGL3_SetClipboardText;
    io.GetClipboardTextFn = ImGui_ImplGlfwGL3_GetClipboardText;
    io.ClipboardUserData = g_Window;
#ifdef _WIN32
    io.ImeWindowHandle = glfwGetWin32Window(g_Window);
#endif

    // Load cursors
    // FIXME: GLFW doesn't expose suitable cursors for ResizeAll, ResizeNESW, ResizeNWSE. We revert to arrow cursor for those.
    g_MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
    g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);

    if (install_callbacks)
        ImGui_ImplGlfw_InstallCallbacks(window);

    return true;
}
Beispiel #18
0
static void SetupVulkan(const char** extensions, uint32_t extensions_count)
{
    VkResult err;

    // Create Vulkan Instance
    {
        VkInstanceCreateInfo create_info = {};
        create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
        create_info.enabledExtensionCount = extensions_count;
        create_info.ppEnabledExtensionNames = extensions;

#ifdef IMGUI_VULKAN_DEBUG_REPORT
        // Enabling multiple validation layers grouped as LunarG standard validation
        const char* layers[] = { "VK_LAYER_LUNARG_standard_validation" };
        create_info.enabledLayerCount = 1;
        create_info.ppEnabledLayerNames = layers;

        // Enable debug report extension (we need additional storage, so we duplicate the user array to add our new extension to it)
        const char** extensions_ext = (const char**)malloc(sizeof(const char*) * (extensions_count + 1));
        memcpy(extensions_ext, extensions, extensions_count * sizeof(const char*));
        extensions_ext[extensions_count] = "VK_EXT_debug_report";
        create_info.enabledExtensionCount = extensions_count + 1;
        create_info.ppEnabledExtensionNames = extensions_ext;

        // Create Vulkan Instance
        err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
        check_vk_result(err);
        free(extensions_ext);

        // Get the function pointer (required for any extensions)
        auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT");
        IM_ASSERT(vkCreateDebugReportCallbackEXT != NULL);

        // Setup the debug report callback
        VkDebugReportCallbackCreateInfoEXT debug_report_ci = {};
        debug_report_ci.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
        debug_report_ci.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
        debug_report_ci.pfnCallback = debug_report;
        debug_report_ci.pUserData = NULL;
        err = vkCreateDebugReportCallbackEXT(g_Instance, &debug_report_ci, g_Allocator, &g_DebugReport);
        check_vk_result(err);
#else
        // Create Vulkan Instance without any debug feature
        err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
        check_vk_result(err);
#endif
    }

    // Select GPU
    {
        uint32_t gpu_count;
        err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, NULL);
        check_vk_result(err);

        VkPhysicalDevice* gpus = (VkPhysicalDevice*)malloc(sizeof(VkPhysicalDevice) * gpu_count);
        err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, gpus);
        check_vk_result(err);

        // If a number >1 of GPUs got reported, you should find the best fit GPU for your purpose
        // e.g. VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU if available, or with the greatest memory available, etc.
        // for sake of simplicity we'll just take the first one, assuming it has a graphics queue family.
        g_PhysicalDevice = gpus[0];
        free(gpus);
    }

    // Select graphics queue family
    {
        uint32_t count;
        vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, NULL);
        VkQueueFamilyProperties* queues = (VkQueueFamilyProperties*)malloc(sizeof(VkQueueFamilyProperties) * count);
        vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, queues);
        for (uint32_t i = 0; i < count; i++)
            if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
            {
                g_QueueFamily = i;
                break;
            }
        free(queues);
        IM_ASSERT(g_QueueFamily != -1);
    }

    // Create Logical Device (with 1 queue)
    {
        int device_extension_count = 1;
        const char* device_extensions[] = { "VK_KHR_swapchain" };
        const float queue_priority[] = { 1.0f };
        VkDeviceQueueCreateInfo queue_info[1] = {};
        queue_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
        queue_info[0].queueFamilyIndex = g_QueueFamily;
        queue_info[0].queueCount = 1;
        queue_info[0].pQueuePriorities = queue_priority;
        VkDeviceCreateInfo create_info = {};
        create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
        create_info.queueCreateInfoCount = sizeof(queue_info) / sizeof(queue_info[0]);
        create_info.pQueueCreateInfos = queue_info;
        create_info.enabledExtensionCount = device_extension_count;
        create_info.ppEnabledExtensionNames = device_extensions;
        err = vkCreateDevice(g_PhysicalDevice, &create_info, g_Allocator, &g_Device);
        check_vk_result(err);
        vkGetDeviceQueue(g_Device, g_QueueFamily, 0, &g_Queue);
    }

    // Create Descriptor Pool
    {
        VkDescriptorPoolSize pool_sizes[] =
        {
            { VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
            { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
            { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
            { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
            { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
            { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
            { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
        };
        VkDescriptorPoolCreateInfo pool_info = {};
        pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
        pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
        pool_info.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes);
        pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
        pool_info.pPoolSizes = pool_sizes;
        err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
        check_vk_result(err);
    }
}
Beispiel #19
0
void HvH::RenderTab()
{
	const char* yTypes[] = {
			"SLOW SPIN", "FAST SPIN", "JITTER", "BACKJITTER", "SIDE", "BACKWARDS", "FORWARDS", "LEFT", "RIGHT", "STATIC", "STATIC JITTER", "STATIC SMALL JITTER", "LUA", "LUA2", "CASUALAA",// safe
			"LISP", "LISP SIDE", "LISP JITTER", "ANGEL BACKWARDS", "ANGEL INVERSE", "ANGEL SPIN", "LOWERBODY", "LBYONGROUND", "LUA UNCLAMPED", "LUA UNCLAMPED2", // untrusted
	};

	const char* xTypes[] = {
			"UP", "DOWN", "DANCE", "FRONT", "LUA", // safe
			"FAKE UP", "FAKE DOWN", "LISP DOWN", "ANGEL DOWN", "ANGEL UP", "LUA UNCLAMPED" // untrusted
	};

	ImGui::Columns(2, NULL, true);
	{
		ImGui::BeginChild(XORSTR("HVH1"), ImVec2(0, 0), true);
		{
			ImGui::Text(XORSTR("AntiAim"));
			ImGui::BeginChild(XORSTR("##ANTIAIM"), ImVec2(0, 0), true);
			{
				ImGui::Checkbox(XORSTR("Yaw"), &Settings::AntiAim::Yaw::enabled);
				ImGui::Separator();
				ImGui::Columns(2, NULL, true);
				{
					ImGui::ItemSize(ImVec2(0.0f, 0.0f), 0.0f);
					ImGui::Text(XORSTR("Yaw Fake"));
					ImGui::ItemSize(ImVec2(0.0f, 0.0f), 0.0f);
					ImGui::Text(XORSTR("Yaw Actual"));
					ImGui::Checkbox(XORSTR("Anti Resolver"), &Settings::AntiAim::Yaw::antiResolver);
				}
				ImGui::NextColumn();
				{
					ImGui::PushItemWidth(-1);
					if (ImGui::Combo(XORSTR("##YFAKETYPE"), (int*)& Settings::AntiAim::Yaw::typeFake, yTypes, IM_ARRAYSIZE(yTypes)))
					{
						if (!ValveDSCheck::forceUT && ((*csGameRules) && (*csGameRules)->IsValveDS()) && Settings::AntiAim::Yaw::typeFake >= AntiAimType_Y::LISP)
						{
							Settings::AntiAim::Yaw::typeFake = AntiAimType_Y::SPIN_SLOW;
							ImGui::OpenPopup(XORSTR("Error###UNTRUSTED_AA"));
						}
					}

					if (ImGui::Combo(XORSTR("##YACTUALTYPE"), (int*)& Settings::AntiAim::Yaw::type, yTypes, IM_ARRAYSIZE(yTypes)))
					{
						if (!ValveDSCheck::forceUT && ((*csGameRules) && (*csGameRules)->IsValveDS()) && Settings::AntiAim::Yaw::type >= AntiAimType_Y::LISP)
						{
							Settings::AntiAim::Yaw::type = AntiAimType_Y::SPIN_SLOW;
							ImGui::OpenPopup(XORSTR("Error###UNTRUSTED_AA"));
						}
					}
					ImGui::PopItemWidth();
				}
				ImGui::Columns(1);
				ImGui::Separator();
				ImGui::Checkbox(XORSTR("Pitch"), &Settings::AntiAim::Pitch::enabled);
				ImGui::Separator();
				ImGui::Columns(2, NULL, true);
				{
					ImGui::ItemSize(ImVec2(0.0f, 0.0f), 0.0f);
					ImGui::Text(XORSTR("Pitch Actual"));
				}
				ImGui::NextColumn();
				{
					ImGui::PushItemWidth(-1);
					if (ImGui::Combo(XORSTR("##XTYPE"), (int*)& Settings::AntiAim::Pitch::type, xTypes, IM_ARRAYSIZE(xTypes)))
					{
						if (!ValveDSCheck::forceUT && ((*csGameRules) && (*csGameRules)->IsValveDS()) && Settings::AntiAim::Pitch::type >= AntiAimType_X::STATIC_UP_FAKE)
						{
							Settings::AntiAim::Pitch::type = AntiAimType_X::STATIC_UP;
							ImGui::OpenPopup(XORSTR("Error###UNTRUSTED_AA"));
						}
					}
					ImGui::PopItemWidth();
				}
				ImGui::Columns(1);
				ImGui::Separator();
				ImGui::Text(XORSTR("Disable"));
				ImGui::Separator();
				ImGui::Checkbox(XORSTR("Knife"), &Settings::AntiAim::AutoDisable::knifeHeld);
				ImGui::Checkbox(XORSTR("No Enemy"), &Settings::AntiAim::AutoDisable::noEnemy);

				ImGui::Columns(1);
				ImGui::Separator();
				ImGui::Text(XORSTR("Edging"));
				ImGui::Separator();
				ImGui::Columns(2, NULL, true);
				{
					ImGui::Checkbox(XORSTR("Enabled"), &Settings::AntiAim::HeadEdge::enabled);
				}
				ImGui::NextColumn();
				{
					ImGui::PushItemWidth(-1);
						ImGui::SliderFloat(XORSTR("##EDGEDISTANCE"), &Settings::AntiAim::HeadEdge::distance, 20, 30, "Distance: %0.f");
					ImGui::PopItemWidth();
				}
				ImGui::Columns(1);
				ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(210, 85));
				if (ImGui::BeginPopupModal(XORSTR("Error###UNTRUSTED_AA")))
				{
					ImGui::Text(XORSTR("You cannot use this antiaim type on a VALVE server."));

					ImGui::Checkbox(XORSTR("This is not a VALVE server"), &ValveDSCheck::forceUT);

					if (ImGui::Button(XORSTR("OK")))
						ImGui::CloseCurrentPopup();

					ImGui::EndPopup();
				}
				ImGui::PopStyleVar();

				ImGui::EndChild();
			}
			ImGui::EndChild();
		}
	}
	ImGui::NextColumn();
	{
		ImGui::BeginChild(XORSTR("HVH2"), ImVec2(0, 0), true);
		{
			ImGui::Text(XORSTR("Resolver"));
			ImGui::Separator();
			ImGui::Checkbox(XORSTR("Resolve All"), &Settings::Resolver::resolveAll);
			ImGui::Separator();
			ImGui::Text(XORSTR("Movement"));
			ImGui::Checkbox(XORSTR("Auto Crouch"), &Settings::Aimbot::AutoCrouch::enabled);

			ImGui::Separator();
			ImGui::Checkbox(XORSTR("Lua Debug Mode"), &Settings::AntiAim::Lua::debugMode);
			if( Settings::AntiAim::Pitch::type == AntiAimType_X::LUA1 || Settings::AntiAim::Pitch::type == AntiAimType_X ::LUA_UNCLAMPED )
			{
				ImGui::Text(XORSTR("Lua AntiAim Editor -- X Axis"));
				ImGui::InputTextMultiline(XORSTR("##LUAX"), Settings::AntiAim::Lua::scriptX, sizeof(Settings::AntiAim::Lua::scriptX));
			}
			ImGui::Separator();

			if( ((Settings::AntiAim::Yaw::type == Settings::AntiAim::Yaw::typeFake) && // if they are equal to each other and a LUA type
						(Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA1 ||
						Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA2  ||
						Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED ||
						Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED2))
				|| // OR
					( (Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA1 && Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA_UNCLAMPED)// Any LUA types that use the same underlying script.
					 || (Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA2 && Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA_UNCLAMPED2)
					 || (Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED && Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA1)
					 || (Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED2 && Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA2)
					)
				)
		    {
				ImGui::Text(XORSTR("Lua AntiAim Editor -- Y Axis(BOTH)"));
				if( Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA1 || Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED )
				{
					ImGui::InputTextMultiline(XORSTR("##LUAY"), Settings::AntiAim::Lua::scriptY, sizeof(Settings::AntiAim::Lua::scriptY));
				}
				else
				{
					ImGui::InputTextMultiline(XORSTR("##LUAY2"), Settings::AntiAim::Lua::scriptY2, sizeof(Settings::AntiAim::Lua::scriptY2));
				}
			}
			else
			{
				if ( Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA1 || Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED )
				{
					ImGui::Text(XORSTR("Lua AntiAim Editor -- Y Axis(ACTUAL)"));
					ImGui::InputTextMultiline(XORSTR("##LUAY"), Settings::AntiAim::Lua::scriptY, sizeof(Settings::AntiAim::Lua::scriptY));
				}
				else if ( Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA2 || Settings::AntiAim::Yaw::type == AntiAimType_Y::LUA_UNCLAMPED2 )
				{
					ImGui::Text(XORSTR("Lua AntiAim Editor -- Y2 Axis(ACTUAL)"));
					ImGui::InputTextMultiline(XORSTR("##LUAY2"), Settings::AntiAim::Lua::scriptY2, sizeof(Settings::AntiAim::Lua::scriptY2));
				}
				ImGui::Separator();
				if( Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA1 || Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA_UNCLAMPED )
				{
					ImGui::Text(XORSTR("Lua AntiAim Editor -- Y Axis(FAKE)"));
					ImGui::InputTextMultiline(XORSTR("##LUAY"), Settings::AntiAim::Lua::scriptY, sizeof(Settings::AntiAim::Lua::scriptY));
				}
				else if( Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA2 || Settings::AntiAim::Yaw::typeFake == AntiAimType_Y::LUA_UNCLAMPED2 )
				{
					ImGui::Text(XORSTR("Lua AntiAim Editor -- Y2 Axis (FAKE)"));
					ImGui::InputTextMultiline(XORSTR("##LUAY2"), Settings::AntiAim::Lua::scriptY2, sizeof(Settings::AntiAim::Lua::scriptY2));
				}
			}
			ImGui::EndChild();
		}
	}
}
Beispiel #20
0
int main()
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	int timer = 0;

	MapReader mr = MapReader();

	//Map data
	string* map = nullptr;
	//map = mr.ReadMap("Maps/Randomized128x128-29-0.map");
	map = mr.ReadMap("Maps/maze512-1-1.map");
	//map = mr.ReadMap("Maps/adaptive-depth-1.map");
	//map = mr.ReadMap("Maps/32room_008.map");
	//map = GenerateMap(10, 10, 1.0f, mr);
	int width = mr.GetWidth();
	int height = mr.GetHeight();
	int nrOfWalls = mr.GetNrOfWalls(map);
	Vec2D startPos = {1, 1};
	Vec2D goalPos = {width-1, height-1};
	int clusterSize = 16;
	Vec2D* wallPos = new Vec2D[nrOfWalls];
	sf::RectangleShape* walls = new sf::RectangleShape[nrOfWalls];
	AStarNode** grid = nullptr;

	if (map != nullptr)
	{
		if (width > 0 && height > 0)
		{
			grid = new AStarNode*[width];

			//Initiate the grid** with walkable or non-walkable tiles
			int wallCounter = 0;
			for (int i = 0; i < width; i++)
			{
				grid[i] = new AStarNode[height];
				for (int j = 0; j < height; j++)
				{
					grid[i][j] = AStarNode(i, j);

					if (map[j*width + i] != "@")
					{
						grid[i][j]._traversable = true;
					}
					else
					{
						grid[i][j]._traversable = false;
						walls[wallCounter] = sf::RectangleShape(sf::Vector2f((float)tileWidth, (float)tileHeight));
						walls[wallCounter].setFillColor(sf::Color::White);
						walls[wallCounter].setPosition(sf::Vector2f(10.0f + (float)(tileWidth * i), 10.0f + (float)(tileHeight * j)));
						wallCounter++;
					}
				}
			}
		}
	}

	sf::View view;
	view.setCenter(0.5f * width * tileWidth, 0.5f * height * tileHeight);
	view.setSize(1.6f * width * tileWidth, 1.2f * height * tileHeight);
	sf::RenderWindow window(sf::VideoMode(windowWidth, windowHeight), "AI test");
	window.setFramerateLimit(60);
	window.setView(view);

	ImGui::SFML::SetRenderTarget(window);
	ImGui::SFML::InitImGuiRendering();
	ImGui::SFML::SetWindow(window);
	ImGui::SFML::InitImGuiEvents();

	sf::RectangleShape* openedTiles = nullptr;
	sf::RectangleShape* expandedTiles = nullptr;
	sf::Vertex* pathTiles = nullptr;
	
	//Mainly for the highlevel graph of HPA*
	sf::Vertex* abstractGraph = nullptr;
	sf::Vertex* openedGraph = nullptr;
	sf::Vertex* expandedGraph = nullptr;
	Metrics metrics;
	
	sf::CircleShape startNode = sf::CircleShape(0.4f*tileHeight);
	startNode.setPosition(sf::Vector2f(10.0f + startPos._x * (float)tileWidth, 10.0f + startPos._y * (float)tileHeight));
	startNode.setFillColor(sf::Color::Red);

	sf::CircleShape goalNode = sf::CircleShape(0.4f*tileHeight);;
	goalNode.setPosition(sf::Vector2f(10.0f + goalPos._x * (float)tileWidth, 10.0f + goalPos._y * (float)tileHeight));
	goalNode.setFillColor(sf::Color::Yellow);

	//Other variables
	bool calculatePaths = false;
	int choosePathfinding = 0;
	int chooseHeuristic = 0;

	//Movement variable
	int delta = width * 0.05f;
	float blockSize = 32.0f;

	//Randomize map variables
	bool randomizeMap = false;
	char widthBuffer[4] = "512";
	char heightBuffer[4] = "512";
	char densityBuffer[3] = "30";

	//Set start/goal position variables
	int startOrGoal = 0;   //0 == start pos, 1 == goal pos
	char xBuffer[4] = "0";
	char yBuffer[4] = "0";

	//What should be drawn?
	bool showWalls = false;
	bool showExpandedNodes = false;
	bool showOpenedNodes = false;

	while (window.isOpen())
	{
		ImGui::SFML::UpdateImGui();
		ImGui::SFML::UpdateImGuiRendering();
		sf::Event event;
		while (window.pollEvent(event))
		{
			ImGui::SFML::ProcessEvent(event);
			if (event.type == sf::Event::Closed)
			{
				window.close();
			}
		}

		ImGuiIO &io = ImGui::GetIO();
		//ImGui::ShowTestWindow();
		window.clear();

		/**************************************/
		/*          Start of GUI code         */
		/**************************************/
		if (ImGui::CollapsingHeader("Choose pathfinding"))
		{
			ImGui::RadioButton("A*", &choosePathfinding, 0);		ImGui::SameLine();
			ImGui::RadioButton("Theta*", &choosePathfinding, 1);	ImGui::SameLine();
			ImGui::RadioButton("HPA*", &choosePathfinding, 2);		ImGui::SameLine();
			ImGui::RadioButton("IDA*", &choosePathfinding, 3);		ImGui::SameLine();
			ImGui::RadioButton("Dijkstra", &choosePathfinding, 4);

			ImGui::RadioButton("Manhattan", &chooseHeuristic, 0);	ImGui::SameLine();
			ImGui::RadioButton("Chebyshev", &chooseHeuristic, 1);	ImGui::SameLine();
			ImGui::RadioButton("Octile", &chooseHeuristic, 2);		ImGui::SameLine();
			ImGui::RadioButton("Euclidean", &chooseHeuristic, 3);
		}
		if (ImGui::CollapsingHeader("Randomize a map"))
		{
			//Set width, height and obstacle density
			ImGui::InputText("Width", widthBuffer, IM_ARRAYSIZE(widthBuffer));
			ImGui::InputText("Height", heightBuffer, IM_ARRAYSIZE(heightBuffer));
			ImGui::InputText("Density (%)", densityBuffer, IM_ARRAYSIZE(densityBuffer));

			if (ImGui::SmallButton("Generate map"))
			{
				mr.GenerateRandomMap(stoi(string(widthBuffer)), stoi(string(heightBuffer)), 0.01f*stof(string(densityBuffer)));
			}
		}
		if (ImGui::CollapsingHeader("Set start/goal"))
		{
			ImGui::RadioButton("Set start position", &startOrGoal, 0); ImGui::SameLine();
			ImGui::RadioButton("Set goal position", &startOrGoal, 1);
			
			//Set xPos and yPos
			ImGui::InputText("X position", xBuffer, IM_ARRAYSIZE(xBuffer));
			ImGui::InputText("Y position", yBuffer, IM_ARRAYSIZE(yBuffer));

			if (ImGui::SmallButton("Set position"))
			{
				Vec2D pos = {stoi(string(xBuffer)), stoi(string(yBuffer))};
				if (startOrGoal == 0)  //Start pos
				{
					startPos = pos;
					startNode.setPosition(sf::Vector2f(10.0f + startPos._x * (float)tileWidth, 10.0f + startPos._y * (float)tileHeight));
				}
				else if (startOrGoal == 1)  //Goal pos
				{
					goalPos = pos;
					goalNode.setPosition(sf::Vector2f(10.0f + goalPos._x * (float)tileWidth, 10.0f + goalPos._y * (float)tileHeight));
				}
			}
		}
		if (ImGui::CollapsingHeader("Choose what will be drawn"))
		{
			ImGui::Checkbox("Walls", &showWalls);
			ImGui::Checkbox("Opened nodes", &showOpenedNodes);
			ImGui::Checkbox("Expanded nodes", &showExpandedNodes);
		}
		if (ImGui::SmallButton("Calculate paths"))
		{
			calculatePaths = !calculatePaths;
		}

		/**************************************/
		/*            End of GUI code         */
		/**************************************/

		//Moving of the camera
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))  //Move camera west
		{
			view.setCenter(view.getCenter().x, view.getCenter().y - delta);
		}
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))  //Move camera east
		{
			view.setCenter(view.getCenter().x - delta, view.getCenter().y);
		}
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))  //Move camera south
		{
			view.setCenter(view.getCenter().x, view.getCenter().y + delta);
		}
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))  //Move camera north
		{
			view.setCenter(view.getCenter().x + delta, view.getCenter().y);
		}

		//Zooming with the camera
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::PageUp) && blockSize <= 32.0f)  //Zoom out
		{
			view.setSize(sf::Vector2f(width * tileWidth * blockSize++ * 0.05f, height * tileHeight * blockSize++ * 0.0375f));
		}
		if (sf::Keyboard::isKeyPressed(sf::Keyboard::PageDown) && blockSize >= 1.0f)  //Zoom in
		{
			view.setSize(sf::Vector2f(width * tileWidth * blockSize-- * 0.05f, height * tileHeight * blockSize-- * 0.0375f));
		}
		window.setView(view);


		//Calculate pathfinding
		if (calculatePaths)
		{
			metrics.clean();
			switch (choosePathfinding)
			{
			case 0:		//A*
				CalculateAStar(metrics, (Pathfinding::Heuristic)chooseHeuristic, width, height, startPos, goalPos, grid);
				break;
			case 1:		//Theta*
				CalculateThetaStar(metrics, (Pathfinding::Heuristic)chooseHeuristic, width, height, startPos, goalPos, grid);
				break;
			case 2:		//HPA*
				CalculateHPAStar(metrics, (Pathfinding::Heuristic)chooseHeuristic, width, height, startPos, goalPos, grid, clusterSize);
				break;
			case 3:		//IDA*
				CalculateIDAStar(metrics, (Pathfinding::Heuristic)chooseHeuristic, width, height, startPos, goalPos, grid);
				break;
			case 4:
				CalculateDijkstra(metrics, (Pathfinding::Heuristic)chooseHeuristic, width, height, startPos, goalPos, grid);
			default:
				break;
			}

			if (showOpenedNodes)
			{
				if (openedTiles != nullptr)
				{
					delete[] openedTiles;
				}
				openedTiles = new sf::RectangleShape[metrics.getNrOfOpenedNodes()];

				for (int i = 0; i < metrics.getNrOfOpenedNodes(); i++)
				{
					openedTiles[i] = sf::RectangleShape(sf::Vector2f((float)tileWidth, (float)tileHeight));
					openedTiles[i].setFillColor(sf::Color(0, 200, 200, 120));
					openedTiles[i].setPosition(sf::Vector2f(10.0f + (float)tileWidth * metrics.getOpenedNodes()[i]._x, 10.0f + (float)tileHeight * metrics.getOpenedNodes()[i]._y));
					window.draw(openedTiles[i]);
				}
			}

			if (showExpandedNodes)
			{
				if (expandedTiles != nullptr)
				{
					delete[] expandedTiles;
				}
				expandedTiles = new sf::RectangleShape[metrics.getNrOfExpandedNodes()];

				for (int i = 0; i < metrics.getNrOfExpandedNodes(); i++)
				{
					expandedTiles[i] = sf::RectangleShape(sf::Vector2f((float)tileWidth, (float)tileHeight));
					expandedTiles[i].setFillColor(sf::Color(200, 0, 0, 120));
					expandedTiles[i].setPosition(sf::Vector2f(10.0f + (float)tileWidth * metrics.getExpandedNodes()[i]._x, 10.0f + (float)tileHeight * metrics.getExpandedNodes()[i]._y));
					window.draw(expandedTiles[i]);
				}
			}

			if (pathTiles != nullptr)
			{
				delete[] pathTiles;
			}
			pathTiles = new sf::Vertex[metrics.getNrOfPathNodes() + 1];
			for (int i = 0; i < metrics.getNrOfPathNodes(); i++)
			{
				pathTiles[i] = sf::Vertex(sf::Vector2f(10.0f + (float)tileWidth * (metrics.getPathNodes()[i]._x + 0.5f), 10.0f + (float)tileHeight * (metrics.getPathNodes()[i]._y + 0.5f)));
				pathTiles[i].color = sf::Color(200, 0, 200, 255);
			}
			pathTiles[metrics.getNrOfPathNodes()] = sf::Vector2f(10.0f + (float)tileWidth * (startPos._x + 0.5f), 10.0f + (float)tileHeight * (startPos._y + 0.5f));
			
			SaveDataToFile(metrics, choosePathfinding, chooseHeuristic);
			calculatePaths = false;
		}

		//Draw the start and goal node(s)
		window.draw(startNode);
		window.draw(goalNode);

		if (choosePathfinding == 2)			//Special case for HPA*
		{
			window.draw(abstractGraph, metrics.getNrOfGraphNodes(), sf::Lines);

			if (showOpenedNodes)
			{
				window.draw(openedGraph, metrics.getNrOfOpenedNodes(), sf::Lines);
			}

			if (showExpandedNodes)
			{
				window.draw(expandedGraph, metrics.getNrOfExpandedNodes(), sf::Lines);
			}
		}
		else
		{
			if (showOpenedNodes && openedTiles != nullptr)
			{
				for (int i = 0; i < metrics.getNrOfOpenedNodes(); i++)
				{
					window.draw(openedTiles[i]);
				}
			}

			if (showExpandedNodes)
			{
				for (int i = 0; i < metrics.getNrOfExpandedNodes(); i++)
				{
					window.draw(expandedTiles[i]);
				}
			}
		}
		window.draw(pathTiles, metrics.getNrOfPathNodes() + 1, sf::LinesStrip);

		//Draw all the walls
		if (showWalls)
		{
			for (int i = 0; i < nrOfWalls; i++)
			{
				window.draw(walls[i]);
			}
		}

		ImGui::Render();
		window.display();
	}
	delete[] expandedTiles;
	delete[] openedTiles;
	delete[] pathTiles;
	delete[] walls;
	delete[] map;
	delete[] wallPos;
	for (__int16 i = 0; i < width; i++)
	{
		delete[] grid[i];
	}
	delete[] grid;
	ImGui::SFML::Shutdown();
	return 0;
}
void ReymentaServerApp::draw()
{
	if (mFirstLaunch) {
		CI_LOG_V("draw begin");
	}
	// clear the window and set the drawing color to white
	gl::clear();
	gl::color(Color::white());
	// draw the fbos
	mBatchass->getTexturesRef()->draw();
	gl::enableAlphaBlending();
	//gl::setMatricesWindow(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight);
	if (mImage) {
		// iterate over the warps and draw their content
		for (auto &warp : mWarps) {
			// there are two ways you can use the warps:
			if (mUseBeginEnd) {
				// a) issue your draw commands between begin() and end() statements
				warp->begin();

				// in this demo, we want to draw a specific area of our image,
				// but if you want to draw the whole image, you can simply use: gl::draw( mImage );
				gl::draw(mImage, mSrcArea, warp->getBounds());

				warp->end();
			}
			else {
				// b) simply draw a texture on them (ideal for video)

				// in this demo, we want to draw a specific area of our image,
				// but if you want to draw the whole image, you can simply use: warp->draw( mImage );
				warp->draw(mBatchass->getTexturesRef()->getTexture(11), mSrcArea);
			}
		}
	}
	gl::disableAlphaBlending();
	//imgui
	ui::NewFrame();

	gl::setMatricesWindow(getWindowSize());
	xPos = margin;
	yPos = margin + 30;

#pragma region Info

	ui::SetNextWindowSize(ImVec2(largePreviewW + 20, largePreviewH), ImGuiSetCond_Once);
	ui::SetNextWindowPos(ImVec2(xPos, yPos), ImGuiSetCond_Once);
	sprintf_s(buf, "Fps %c %d###fps", "|/-\\"[(int)(ImGui::GetTime() / 0.25f) & 3], (int)mParameterBag->iFps);
	ui::Begin(buf);
	{
		ImGui::PushItemWidth(mParameterBag->mPreviewFboWidth);
		// fps
		static ImVector<float> values; if (values.empty()) { values.resize(100); memset(&values.front(), 0, values.size()*sizeof(float)); }
		static int values_offset = 0;
		static float refresh_time = -1.0f;
		if (ui::GetTime() > refresh_time + 1.0f / 6.0f)
		{
			refresh_time = ui::GetTime();
			values[values_offset] = mParameterBag->iFps;
			values_offset = (values_offset + 1) % values.size();
		}
		if (mParameterBag->iFps < 12.0) ui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 0, 0, 1));
		ui::PlotLines("FPS", &values.front(), (int)values.size(), values_offset, mParameterBag->sFps.c_str(), 0.0f, 300.0f, ImVec2(0, 30));
		if (mParameterBag->iFps < 12.0) ui::PopStyleColor();

		// Checkbox
		ui::Checkbox("Tex", &showTextures);
		ui::SameLine();
		ui::Checkbox("Fbos", &showFbos);
		ui::SameLine();
		ui::Checkbox("Shada", &showShaders);

		ui::Checkbox("Audio", &showAudio);
		ui::SameLine();
		ui::Checkbox("Cmd", &showConsole);
		ui::SameLine();
		ui::Checkbox("OSC", &showOSC);

		ui::Checkbox("MIDI", &showMidi);
		ui::SameLine();
		ui::Checkbox("Test", &showTest);
		if (ui::Button("Save Params"))
		{
			// save warp settings
			mBatchass->getWarpsRef()->save("warps1.xml");
			// save params
			mParameterBag->save();
		}

		mParameterBag->iDebug ^= ui::Button("Debug");
		ui::SameLine();
		mParameterBag->mRenderThumbs ^= ui::Button("Thumbs");
		ui::PopItemWidth();
		if (ui::Button("Stop Loading")) mBatchass->stopLoading();
	}
	ui::End();
	xPos += largePreviewW + 20 + margin;

#pragma endregion Info


#pragma region WebSockets
	// websockets
	ui::SetNextWindowSize(ImVec2(largePreviewW + 20, largePreviewH), ImGuiSetCond_Once);
	ui::SetNextWindowPos(ImVec2(xPos, yPos), ImGuiSetCond_Once);
	ui::Begin("WebSockets server");
	{
		if (mParameterBag->mIsWebSocketsServer)
		{
			ui::Text("WS Server %d", mParameterBag->mWebSocketsPort);
			ui::Text("IP %s", mParameterBag->mWebSocketsHost.c_str());
		}
		else
		{
			ui::Text("WS Client %d", mParameterBag->mWebSocketsPort);
			ui::Text("IP %s", mParameterBag->mWebSocketsHost.c_str());
		}
		if (ui::Button("Connect")) { mBatchass->wsConnect(); }
		ui::SameLine();
		if (ui::Button("Ping")) { mBatchass->wsPing(); }
	}

	ui::End();
	xPos += largePreviewW + 20 + margin;
#pragma endregion WebSockets


	// console
	if (showConsole)
	{
		ui::SetNextWindowSize(ImVec2((w + margin) * mParameterBag->MAX, largePreviewH), ImGuiSetCond_Once);
		ui::SetNextWindowPos(ImVec2(xPos, yPos), ImGuiSetCond_Once);
		ShowAppConsole(&showConsole);
		if (mParameterBag->newMsg)
		{
			mParameterBag->newMsg = false;
			mConsole->AddLog(mParameterBag->mMsg.c_str());
		}
	}
	if (showTest)
	{
		ui::ShowTestWindow();
		ui::ShowStyleEditor();
	}

#pragma region MIDI

	// MIDI window
	if (showMidi)
	{
		ui::SetNextWindowSize(ImVec2(largePreviewW + 20, largePreviewH), ImGuiSetCond_Once);
		ui::SetNextWindowPos(ImVec2(xPos, yPos), ImGuiSetCond_Once);
		ui::Begin("MIDI");
		{
			sprintf_s(buf, "Enable");
			if (ui::Button(buf)) mBatchass->midiSetup();
			if (ui::CollapsingHeader("MidiIn", "20", true, true))
			{
				ui::Columns(2, "data", true);
				ui::Text("Name"); ui::NextColumn();
				ui::Text("Connect"); ui::NextColumn();
				ui::Separator();

				for (int i = 0; i < mBatchass->midiInCount(); i++)
				{
					ui::Text(mBatchass->midiInPortName(i).c_str()); ui::NextColumn();

					if (mBatchass->midiInConnected(i))
					{
						sprintf_s(buf, "Disconnect %d", i);
					}
					else
					{
						sprintf_s(buf, "Connect %d", i);
					}

					if (ui::Button(buf))
					{
						if (mBatchass->midiInConnected(i))
						{
							mBatchass->midiInClosePort(i);
						}
						else
						{
							mBatchass->midiInOpenPort(i);
						}
					}
					ui::NextColumn();
					ui::Separator();
				}
				ui::Columns(1);
			}
		}
		ui::End();
		xPos += largePreviewW + 20 + margin;
		yPos = margin;

	}
#pragma endregion MIDI

#pragma region OSC

	if (showOSC && mParameterBag->mOSCEnabled)
	{
		ui::SetNextWindowSize(ImVec2(largeW, largeH), ImGuiSetCond_Once);
		ui::SetNextWindowPos(ImVec2(xPos, yPos), ImGuiSetCond_Once);
		ui::Begin("OSC router");
		{
			ui::Text("Sending to host %s", mParameterBag->mOSCDestinationHost.c_str());
			ui::SameLine();
			ui::Text(" on port %d", mParameterBag->mOSCDestinationPort);
			ui::Text("Sending to 2nd host %s", mParameterBag->mOSCDestinationHost2.c_str());
			ui::SameLine();
			ui::Text(" on port %d", mParameterBag->mOSCDestinationPort2);
			ui::Text(" Receiving on port %d", mParameterBag->mOSCReceiverPort);

			static char str0[128] = "/live/play";
			static int i0 = 0;
			static float f0 = 0.0f;
			ui::InputText("address", str0, IM_ARRAYSIZE(str0));
			ui::InputInt("track", &i0);
			ui::InputFloat("clip", &f0, 0.01f, 1.0f);
			if (ui::Button("Send")) { mBatchass->sendOSCIntMessage(str0, i0); }
		}
		ui::End();
		xPos += largeW + margin;
	}
#pragma endregion OSC

	ui::Render();

	gl::ScopedGlslProg shader(mBatchass->getShadersRef()->getLiveShader());
	//gl::ScopedGlslProg shader(mProg);

	gl::draw(mMesh);
	if (mFirstLaunch) {
		CI_LOG_V("draw end");
		mFirstLaunch = false;
	}

}
Beispiel #22
0
void DialogControlsModels::drawModels(bool* isFrame, std::vector<ModelFaceBase*> * meshModelFaces) {
    this->meshModelFaces = meshModelFaces;
    ImGui::PushStyleColor(ImGuiCol_Button, ImColor::HSV(0.1f / 7.0f, 0.6f, 0.6f));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor::HSV(0.1f / 7.0f, 0.7f, 0.7f));
    ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImColor::HSV(0.1f / 7.0f, 0.8f, 0.8f));
    if (ImGui::Button("Reset values to default", ImVec2(-1, 0))) {
        for (size_t i=0; i<meshModelFaces->size(); i++) {
            (*meshModelFaces)[i]->initModelProperties();
        }
    }
    ImGui::PopStyleColor(3);

    ImGui::BeginChild("Scene Items", ImVec2(0, this->heightTopPanel), true);

    std::vector<const char*> scene_items;
    for (size_t i=0; i<meshModelFaces->size(); i++) {
        scene_items.push_back((*meshModelFaces)[i]->meshModel.ModelTitle.c_str());
    }

    // Scene ModelFace
    ImGui::PushItemWidth(-1);
    ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 6));
    ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 100));
    ImGui::PushStyleColor(ImGuiCol_FrameBg, ImColor(1, 0, 0, 1));
    ImGui::ListBox("", &this->selectedObject, &scene_items[0], static_cast<int>(meshModelFaces->size()));
    ImGui::PopStyleColor(1);
    ImGui::PopStyleVar(2);
    if (this->selectedObject > -1 && ImGui::BeginPopupContextItem("Actions")) {
        ImGui::MenuItem("Rename", NULL, &this->cmenu_renameModel);
        if (ImGui::MenuItem("Duplicate"))
            (*meshModelFaces).push_back((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->clone(static_cast<int>((*meshModelFaces).size() + 1)));
        //ImGui::MenuItem("Delete", NULL, &this->cmenu_deleteYn);
        if (ImGui::BeginMenu("Delete")) {
            if (ImGui::MenuItem("OK"))
                this->funcDeleteModel(this->selectedObject);
            ImGui::EndMenu();
        }
        ImGui::EndPopup();
    }
    ImGui::PopItemWidth();

    if (this->cmenu_renameModel)
        this->contextModelRename(meshModelFaces);

    if (this->cmenu_deleteYn)
        this->contextModelDelete();
    ImGui::EndChild();

    ImGui::GetIO().MouseDrawCursor = true;
    ImGui::PushStyleColor(ImGuiCol_Button, ImColor(89, 91, 94));
    ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor(119, 122, 124));
    ImGui::PushStyleColor(ImGuiCol_Border, ImColor(0, 0, 0));
    ImGui::Button("###splitterModels", ImVec2(-1, 8.0f));
    ImGui::PopStyleColor(3);
    if (ImGui::IsItemActive())
        this->heightTopPanel += ImGui::GetIO().MouseDelta.y;
    if (ImGui::IsItemHovered())
        ImGui::SetMouseCursor(3);

    ImGui::BeginChild("Properties Pane", ImVec2(0,0), false);

    ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.75f);

    if (this->selectedObject > -1) {
        ModelFaceBase *mmf = (*meshModelFaces)[static_cast<size_t>(this->selectedObject)];
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "OBJ File:"); ImGui::SameLine(); ImGui::Text("%s", mmf->meshModel.File.title.c_str());
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "ModelFace:"); ImGui::SameLine(); ImGui::Text("%s", mmf->meshModel.ModelTitle.c_str());
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "Material:"); ImGui::SameLine(); ImGui::Text("%s", mmf->meshModel.MaterialTitle.c_str());
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "Vertices:"); ImGui::SameLine(); ImGui::Text("%i", mmf->meshModel.countVertices);
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "Normals:"); ImGui::SameLine(); ImGui::Text("%i", mmf->meshModel.countNormals);
        ImGui::TextColored(ImVec4(255, 0, 0, 255), "Indices:"); ImGui::SameLine(); ImGui::Text("%i", mmf->meshModel.countIndices);

        if (mmf->meshModel.ModelMaterial.TextureAmbient.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureDiffuse.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureBump.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureDisplacement.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureDissolve.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureSpecular.Image != "" ||
            mmf->meshModel.ModelMaterial.TextureSpecularExp.Image != "") {
            ImGui::Separator();
            ImGui::TextColored(ImVec4(255, 0, 0, 255), "Textures");
        }

        this->showTextureLine("##001", MaterialTextureType_Ambient, &this->showTextureWindow_Ambient, &this->showTexture_Ambient);
        this->showTextureLine("##002", MaterialTextureType_Diffuse, &this->showTextureWindow_Diffuse, &this->showTexture_Diffuse);
        this->showTextureLine("##003", MaterialTextureType_Dissolve, &this->showTextureWindow_Dissolve, &this->showTexture_Dissolve);
        this->showTextureLine("##004", MaterialTextureType_Bump, &this->showTextureWindow_Bump, &this->showTexture_Bump);
        this->showTextureLine("##005", MaterialTextureType_Displacement, &this->showTextureWindow_Displacement, &this->showTexture_Displacement);
        this->showTextureLine("##006", MaterialTextureType_Specular, &this->showTextureWindow_Specular, &this->showTexture_Specular);
        this->showTextureLine("##007", MaterialTextureType_SpecularExp, &this->showTextureWindow_SpecularExp, &this->showTexture_SpecularExp);

        if (this->showTextureWindow_Ambient)
            this->showTextureImage(mmf, MaterialTextureType_Ambient, "Ambient", &this->showTextureWindow_Ambient, &this->showTexture_Ambient, &this->vboTextureAmbient, &this->textureAmbient_Width, &this->textureAmbient_Height);

        if (this->showTextureWindow_Diffuse)
            this->showTextureImage(mmf, MaterialTextureType_Diffuse, "Diffuse", &this->showTextureWindow_Diffuse, &this->showTexture_Diffuse, &this->vboTextureDiffuse, &this->textureDiffuse_Width, &this->textureDiffuse_Height);

        if (this->showTextureWindow_Dissolve)
            this->showTextureImage(mmf, MaterialTextureType_Dissolve, "Dissolve", &this->showTextureWindow_Dissolve, &this->showTexture_Dissolve, &this->vboTextureDissolve, &this->textureDissolve_Width, &this->textureDissolve_Height);

        if (this->showTextureWindow_Bump)
            this->showTextureImage(mmf, MaterialTextureType_Bump, "Bump", &this->showTextureWindow_Bump, &this->showTexture_Bump, &this->vboTextureBump, &this->textureBump_Width, &this->textureBump_Height);

        if (this->showTextureWindow_Displacement)
            this->showTextureImage(mmf, MaterialTextureType_Displacement, "Height", &this->showTextureWindow_Displacement, &this->showTexture_Displacement, &this->vboTextureDisplacement, &this->textureDisplacement_Width, &this->textureDisplacement_Height);

        if (this->showTextureWindow_Specular)
            this->showTextureImage(mmf, MaterialTextureType_Specular, "Specular", &this->showTextureWindow_Specular, &this->showTexture_Specular, &this->vboTextureSpecular, &this->textureSpecular_Width, &this->textureSpecular_Height);

        if (this->showTextureWindow_SpecularExp)
            this->showTextureImage(mmf, MaterialTextureType_SpecularExp, "SpecularExp", &this->showTextureWindow_SpecularExp, &this->showTexture_SpecularExp, &this->vboTextureSpecularExp, &this->textureSpecularExp_Width, &this->textureSpecularExp_Height);

        ImGui::Separator();

        ImGui::PushStyleColor(ImGuiCol_Button, ImColor::HSV(0.1f / 7.0f, 0.6f, 0.6f));
        ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor::HSV(0.1f / 7.0f, 0.7f, 0.7f));
        ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImColor::HSV(0.1f / 7.0f, 0.8f, 0.8f));

        const char* tabsScene[] = {
            "\n" ICON_MD_TRANSFORM,
            "\n" ICON_MD_PHOTO_SIZE_SELECT_SMALL,
            "\n" ICON_MD_3D_ROTATION,
            "\n" ICON_MD_OPEN_WITH,
            "\n" ICON_MD_TOLL,
            "\n" ICON_MD_FORMAT_PAINT,
            "\n" ICON_MD_BLUR_ON,
            "\n" ICON_MD_LIGHTBULB_OUTLINE,
        };
        const char* tabsLabelsScene[] = { "General", "Scale", "Rotate", "Translate", "Displace", "Material", "Effects", "Illumination" };
        const int numTabsScene = sizeof(tabsScene) / sizeof(tabsScene[0]);
        ImGui::TabLabels(numTabsScene, tabsScene, this->selectedTabScene, ImVec2(30.0, 30.0), tabsLabelsScene);
        ImGui::PopStyleColor(3);

        ImGui::Separator();

        static bool K_DCM_ReadOnly = false;

        switch (this->selectedTabScene) {
            case 0: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Properties");
                // cel shading
                ImGui::Checkbox("Cel Shading", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_CelShading);
                ImGui::Checkbox("Wireframe", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Wireframe);
                ImGui::Checkbox("Edit Mode", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_EditMode);
                ImGui::Checkbox("Shadows", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_ShowShadows);
                // alpha
                ImGui::TextColored(ImVec4(1, 1, 1, (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Alpha), "Alpha Blending");
                this->helperUI->addControlsFloatSlider("", 1, 0.0f, 1.0f, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Alpha);
                break;
            }
            case 1: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Scale ModelFace");
                if (ImGui::Checkbox("Gizmo Scale", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Scale)) {
                    if ((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Scale) {
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Rotate = false;
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Translate = false;
                    }
                }
                ImGui::Checkbox("Scale all", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scale0);
                if ((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scale0) {
                    ImGui::Checkbox("", &K_DCM_ReadOnly); ImGui::SameLine(); ImGui::SliderFloat("##001", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleX->point, 0.05f, this->managerObjects.Setting_GridSize / 2); ImGui::SameLine(); ImGui::Text("X");
                    ImGui::Checkbox("", &K_DCM_ReadOnly); ImGui::SameLine(); ImGui::SliderFloat("##001", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleY->point, 0.05f, this->managerObjects.Setting_GridSize / 2); ImGui::SameLine(); ImGui::Text("Y");
                    ImGui::Checkbox("", &K_DCM_ReadOnly); ImGui::SameLine(); ImGui::SliderFloat("##001", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleZ->point, 0.05f, this->managerObjects.Setting_GridSize / 2); ImGui::SameLine(); ImGui::Text("Z");
                }
                else {
                    this->helperUI->addControlsSliderSameLine("X", 1, 0.05f, 0.0f, this->managerObjects.Setting_GridSize / 2, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleX->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleX->point, false, isFrame);
                    this->helperUI->addControlsSliderSameLine("Y", 2, 0.05f, 0.0f, this->managerObjects.Setting_GridSize / 2, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleY->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleY->point, false, isFrame);
                    this->helperUI->addControlsSliderSameLine("Z", 3, 0.05f, 0.0f, this->managerObjects.Setting_GridSize / 2, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleZ->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->scaleZ->point, false, isFrame);
                }
                break;
            }
            case 2: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Rotate model around axis");
                if (ImGui::Checkbox("Gizmo Rotate", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Rotate)) {
                    if ((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Rotate) {
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Scale = false;
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Translate = false;
                    }
                }
                this->helperUI->addControlsSliderSameLine("X", 4, 1.0f, -180.0f, 180.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateX->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateX->point, true, isFrame);
                this->helperUI->addControlsSliderSameLine("Y", 5, 1.0f, -180.0f, 180.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateY->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateY->point, true, isFrame);
                this->helperUI->addControlsSliderSameLine("Z", 6, 1.0f, -180.0f, 180.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateZ->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->rotateZ->point, true, isFrame);
                break;
            }
            case 3: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Move model by axis");

                if (ImGui::Checkbox("Gizmo Translate", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Translate)) {
                    if ((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Translate) {
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Scale = false;
                        (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_Gizmo_Rotate = false;
                    }
                }

//                ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
                this->helperUI->addControlsSliderSameLine("X", 7, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionX->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionX->point, true, isFrame);
//                ImGui::PopItemWidth();
//                ImGui::SameLine();
//                ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.35f);
//                ImGui::InputFloat("##0001", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionX->point, -1.0f, -1.0f, 3);
//                ImGui::PopItemWidth();

                this->helperUI->addControlsSliderSameLine("Y", 8, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionY->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionY->point, true, isFrame);
                this->helperUI->addControlsSliderSameLine("Z", 9, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionZ->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->positionZ->point, true, isFrame);
                break;
            }
            case 4: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Displace model");
                this->helperUI->addControlsSliderSameLine("X", 10, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceX->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceX->point, true, isFrame);
                this->helperUI->addControlsSliderSameLine("Y", 11, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceY->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceY->point, true, isFrame);
                this->helperUI->addControlsSliderSameLine("Z", 12, 0.5f, (-1 * this->managerObjects.Setting_GridSize), this->managerObjects.Setting_GridSize, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceZ->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displaceZ->point, true, isFrame);
                break;
            }
            case 5: {
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Material of the model");
                if (ImGui::Button("Material Editor"))
                    (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->showMaterialEditor = true;
                ImGui::Checkbox("Parallax Mapping", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_ParallaxMapping);
                ImGui::Separator();
                ImGui::Checkbox("Use Tessellation", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_UseTessellation);
                if ((*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_UseTessellation) {
                    ImGui::Checkbox("Culling", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_UseCullFace);
                    this->helperUI->addControlsIntegerSlider("Subdivision", 24, 0, 100, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_TessellationSubdivision);
                    ImGui::Separator();
                    if (mmf->meshModel.ModelMaterial.TextureDisplacement.UseTexture) {
                        this->helperUI->addControlsSlider("Displacement", 15, 0.05f, -2.0f, 2.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displacementHeightScale->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->displacementHeightScale->point, false, isFrame);
                        ImGui::Separator();
                    }
                }
                else
                    ImGui::Separator();
                this->helperUI->addControlsSlider("Refraction", 13, 0.05f, -10.0f, 10.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_MaterialRefraction->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_MaterialRefraction->point, true, isFrame);
                this->helperUI->addControlsSlider("Specular Exponent", 14, 10.0f, 0.0f, 1000.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_MaterialSpecularExp->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Setting_MaterialSpecularExp->point, true, isFrame);
                ImGui::Separator();
                this->helperUI->addControlColor3("Ambient Color", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialAmbient->color, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialAmbient->colorPickerOpen);
                this->helperUI->addControlColor3("Diffuse Color", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialDiffuse->color, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialDiffuse->colorPickerOpen);
                this->helperUI->addControlColor3("Specular Color", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialSpecular->color, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialSpecular->colorPickerOpen);
                this->helperUI->addControlColor3("Emission Color", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialEmission->color, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialEmission->colorPickerOpen);
                break;
            }
            case 6: {
                if (ImGui::CollapsingHeader("Gaussian Blur")) {
                    ImGui::Indent();
                    ImGui::BeginGroup();
                    const char* gb_items[] = {"No Blur", "Horizontal", "Vertical"};
                    ImGui::Combo("Mode##228", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_GBlur_Mode, gb_items, IM_ARRAYSIZE(gb_items));
                    this->helperUI->addControlsSlider("Radius", 16, 0.0f, 0.0f, 1000.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_GBlur_Radius->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_GBlur_Radius->point, true, isFrame);
                    this->helperUI->addControlsSlider("Width", 17, 0.0f, 0.0f, 1000.0f, true, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_GBlur_Width->animate, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_GBlur_Width->point, true, isFrame);
                    ImGui::EndGroup();
                    ImGui::Unindent();
                }
                if (ImGui::CollapsingHeader("Filmic Tone Mapping")) {
                    ImGui::Indent();
                    ImGui::BeginGroup();
                    ImGui::Checkbox("ACES Film Rec2020", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_ToneMapping_ACESFilmRec2020);
                    ImGui::EndGroup();
                    ImGui::Unindent();
                }

//            ImGui::Text("Bloom");
//            ImGui::Checkbox("Apply Bloom", &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_doBloom);
//            this->helperUI->addControlsSlider("Ambient", 18, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_WeightA, false, isFrame);
//            this->helperUI->addControlsSlider("Specular", 19, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_WeightB, false, isFrame);
//            this->helperUI->addControlsSlider("Specular Exp", 20, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_WeightC, false, isFrame);
//            this->helperUI->addControlsSlider("Dissolve", 21, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_WeightD, false, isFrame);
//            this->helperUI->addControlsSlider("Vignette", 22, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_Vignette, false, isFrame);
//            this->helperUI->addControlsSlider("Vignette Attenuation", 23, 0.0f, 0.0f, 10.0f, false, NULL, &(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->Effect_Bloom_VignetteAtt, false, isFrame);
//            ImGui::Separator();
                break;
            }
            case 7: {
                // https://en.wikipedia.org/wiki/List_of_common_shading_algorithms
                // https://renderman.pixar.com/view/cook-torrance-shader
                ImGui::TextColored(ImVec4(1, 0, 0, 1), "Illumination type");
                const char* illum_models_items[] = {
                    "[0] Color on and Ambient off",  // "Shaderless" option in Blender, under "Shading" in Material tab
                    "[1] Color on and Ambient on",
                    "[2] Highlight on",
                    "[3] Reflection on and Raytrace on",
                    "[4] Transparency: Glass on\n    Reflection: Raytrace on",
                    "[5] Reflection: Fresnel on\n    Raytrace on",
                    "[6] Transparency: Refraction on\n    Reflection: Fresnel off\n    Raytrace on",
                    "[7] Transparency: Refraction on\n    Reflection: Fresnel on\n    Raytrace on",
                    "[8] Reflection on\n    Raytrace off",
                    "[9] Transparency: Glass on\n    Reflection: Raytrace off",
                    "[10] Casts shadows onto invisible surfaces"
                };
                ImGui::Combo("##987", reinterpret_cast<int*>(&(*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->materialIlluminationModel), illum_models_items, IM_ARRAYSIZE(illum_models_items));
                break;
            }
            default:
                break;
        }
    }

    ImGui::PopItemWidth();

    ImGui::EndChild();
}