Skip to content

Instantly share code, notes, and snippets.

View abidanBrito's full-sized avatar

Abidán Brito abidanBrito

View GitHub Profile
@alaingalvan
alaingalvan / bevel-normals.glsl
Created August 3, 2017 17:29
Some bevel shader magic. :3
void rng_seed(output int rng, int seed)
{
int chash = seed;
if (chash == 0) chash = 1;
rng = chash * 30391861;
}
float rng_uniform(output int rng)
{
float res = rng / float(2137483647) * 0.5 + 0.5;
@alaingalvan
alaingalvan / screenspacebentconesao.glsl
Last active December 27, 2023 20:53
GPU Pro 3 sample of bent cones screen space ambient occlusion.
void main()
{
vec3 positionX = backproject(depthTexture(pixelCoordinateI), inverseViewProjectionMatrix);
vec3 normalX = normalTexture(pixelCoordinateI);
// get ONB to transform samples
mat3 orthoNormalBasis = computeONB(normalX);
// select samples for pixel out of pattern
int patternOffset = getPatternOffset(pixelCoordinateI);
float ao = 0.0;
@dvddarias
dvddarias / Arrows2DMovement.cs
Last active May 5, 2024 05:32
Unity editor script to precisely move, rotate and scale GameObjects on a 2D scene, using the arrow keys.
/*
Unity editor script to precisely move, rotate and scale GameObjects on 2D scenes, using the arrow keys.
Notes:
- To use it just include it on an "Assets/Editor" folder on your project.
- The action depends on the selected tool and the size of the movement depends on the Scene view zoom.
- The more "zoomed in" is the scene view the smaller is the movement step.
- It will work when the current Scene tab is in 2D mode and there is at least one gameObject selected,
otherwise the scene camera will move as usual :)
@vurtun
vurtun / _readme_quarks.md
Last active October 24, 2024 11:38
Quarks: Graphical user interface

gui

@rmitton
rmitton / toolbar.cpp
Created March 13, 2019 06:20
How to do a toolbar in Dear ImGui.
// How to do a toolbar in Dear ImGui.
const float toolbarSize = 50;
void DockSpaceUI()
{
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos + ImVec2(0, toolbarSize));
ImGui::SetNextWindowSize(viewport->Size - ImVec2(0, toolbarSize));
ImGui::SetNextWindowViewport(viewport->ID);
void printOpenGLDebugInfo()
{
int majorVersion, minorVersion;
glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
std::cout << "OpenGL Version: " << majorVersion << "." << minorVersion
<< std::endl;
int work_grp_cnt[3];
@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Last active October 31, 2024 20:59
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@Wumpf
Wumpf / cfd.md
Last active September 22, 2024 03:22
Notes on CFD
This note simply gathers some info and thoughts on building Node Editor, especially in an
immediate mode setting.
Q: How does imgui render rounded rects?
Check imgui AddRectFilled
Imgui drawing api is closer to nanoVG
- Path is kept
- Contents are modified based on path
@malustewart
malustewart / imgui_consultas_2020_1C.md
Last active September 2, 2023 19:53
Consultas de ImGui para EDA 1er cuatrimestre 2020

ImGui consultas 2020 1C

> ¿Cómo cambio el tamaño de las fonts?

En DemoWindow > Configuration > Fonts :

  • Para cambiar el tamaño de la font de una sola ventana, existe ImGui::SetWindowFontScale(window_scale), donde window_scale es un float que va desde 0.0 (tamaño casi invisible) a 2.0 (tamaño doble que el normal).
  • Para cambiar el tamaño de una font en todas las ventanas, alcanza con modificar io.FontGlobalScale. io es el contexto de ImGui que se obtiene en la inicialización. FontGlobalScale es un float que va desde 0.0 (tamaño casi invisible) a 2.0 (tamaño doble que el normal).

Ver líneas 3324 a 3327 de imgui_demo.cpp

> ¿Cómo fijo la posición de las ventanas?