This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder