View tiled_voronoi.html
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> | |
<meta charset=utf-8> | |
</head> | |
<body> | |
<canvas width=2048 height=2048 style="width: 800px; height: 800px"></canvas> | |
</body> | |
<script language="javascript" src="https://npmcdn.com/regl/dist/regl.js"></script> |
View DrawCmdList.cpp
This file contains 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
// CC0 | |
#define IMGUI_DEFINE_MATH_OPERATORS | |
#include <imgui_internal.h> | |
#define isdigit(c) (c >= '0' && c <= '9') | |
namespace ImGui | |
{ | |
float strToFloat (const char *s) // atof from minilibc |
View flakes.glsl
This file contains 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
// based on shader by Nikos Papadopoulos, 4rknova / 2013 (https://www.shadertoy.com/view/llGSzw) | |
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | |
#define ENABLE_LIGHTING | |
#define ENABLE_SPECULAR | |
#define OFFSET_X 1 | |
#define OFFSET_Y 1 | |
#define DEPTH 5.5 |
View export_to_obj.cpp
This file contains 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
std::ofstream file ("Mesh.obj"); | |
// Every vertex is a line in output file: | |
// v pos_x pos_y pos_z | |
for (int i = 0; i < mesh->numVertices(); ++i) { | |
file << "v " << mesh->vertices()[i].x() << " " | |
<< mesh->vertices()[i].y() << " " | |
<< mesh->vertices()[i].z() << std::endl; | |
} |
View jfa_2d.glsl
This file contains 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
vec4 StepJFA (in vec2 fragCoord, in float level) | |
{ | |
level = clamp(level-1.0, 0.0, c_maxSteps); | |
float stepwidth = floor(exp2(c_maxSteps - level)+0.5); | |
float bestDistance = 9999.0; | |
vec2 bestCoord = vec2(0.0); | |
vec3 bestColor = vec3(0.0); | |
for (int y = -1; y <= 1; ++y) { |
View convert_opengl_depth.cl
This file contains 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
float const depthGL = read_imagef (depthImage, depthSampler, (int2) (x, y)).x; // in range [0,1] | |
float2 const pixel = (float2) ( (x + 0.5f) / (float) imageSizeX, | |
(y + 0.5f) / (float) imageSizeY); // in range [0,1] | |
float4 point_NDC = (float4) ( 2.0f * pixel.x - 1.0f, // in range [-1,1] | |
2.0f * pixel.y - 1.0f, // in range [-1,1] | |
2.0f * depthGL - 1.0f, // in range [-1,1] | |
1.0f); |
View copy_to_folders.sh
This file contains 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
for d in */ ; do cp sample.py $d`echo "$d" | sed 's/\(.*\)\..*/\1.py/'`; done |
View SublimeAStyleFormatter.sublime-settings
This file contains 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
Show hidden characters
{ | |
// Print debug message | |
"debug": false, | |
// Auto format on file save | |
"autoformat_on_save": false, | |
// The mapping key is `syntax name`, and the value is `formatting mode`. | |
// Note that the value for each mapping should be "c", "java" or "cs". | |
"user_defined_syntax_mode_mapping": { |
View getBufferSubData.cpp
This file contains 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
int size = ... | |
void* data = new char[size]; | |
EM_ASM_( | |
{ | |
Module.ctx.getBufferSubData(Module.ctx.ARRAY_BUFFER, 0, HEAPU8.subarray($0, $0 + $1)); | |
}, data, size); |
View text-textinput.cpp
This file contains 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
// Create text input in place of a text | |
static void TextAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiID id) | |
{ | |
ImGuiContext& g = *GImGui; | |
ImGuiWindow* window = GetCurrentWindow(); | |
// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen) | |
SetActiveID(g.ScalarAsInputTextId, window); | |
SetHoveredID(0); | |
FocusableItemUnregister(window); |
NewerOlder