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
import sys | |
import argparse | |
def bytesToCHeader(fileBytes: bytes, inputFileName: str, variableName: str) -> str: | |
fileText = "#pragma once\n"; | |
fileText += "\n"; | |
fileText += "//----------------------------------------------\n"; | |
fileText += "// This is an auto-generated file.\n"; | |
fileText += "// It contains the binary representation of " + inputFileName + " as a C-Array.\n"; | |
fileText += "//----------------------------------------------\n"; |
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
void ACar::update(const GameUpdateSets& updateSets) | |
{ | |
if(updateSets.isGamePaused()) | |
return; | |
m_traitCamera.update(this, updateSets); | |
m_traitCamera.rotateWorkingDirectionTowardsFlat((-getTransformMtx().data[0].xyz().normalized0() + 2.5f*vec3f::getAxis(1)).normalized(), updateSets.dt); | |
//m_traitCamera.rotateWorkingDirectionTowardsFlat((-getTransformMtx().data[0].xyz().normalized0() + 0.5f*vec3f::getAxis(1)).normalized(), updateSets.dt); | |
struct Tyre |
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>constref</Title> | |
<Shortcut>constref</Shortcut> | |
</Header> | |
<Snippet> | |
<Code Language="CPP"> | |
<![CDATA[const $selected$&]]> |
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
#define STB_IMAGE_IMPLEMENTATION | |
#define STB_IMAGE_WRITE_IMPLEMENTATION | |
#define STBI_ONLY_PNG | |
#define STBI_ONLY_JPEG | |
#define STBI_ONLY_BMP | |
#define STBI_ONLY_GIF | |
#include "stb_image.h" | |
#include "stb_image_write.h" |
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 D_GGX(float linearRoughness, float NoH, const vec3 h) { | |
// Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces" | |
// In mediump, there are two problems computing 1.0 - NoH^2 | |
// 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights) | |
// 2) NoH doesn't have enough precision around 1.0 | |
// Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well | |
// However, we can do better using Lagrange's identity: | |
// ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2 |
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
// Creating a node graph editor for ImGui | |
// Quick demo, not production code! This is more of a demo of how to use ImGui to create custom stuff. | |
// Better version by @daniel_collin here https://gist.github.com/emoon/b8ff4b4ce4f1b43e79f2 | |
// See https://github.com/ocornut/imgui/issues/306 | |
// v0.02 | |
// Animated gif: https://cloud.githubusercontent.com/assets/8225057/9472357/c0263c04-4b4c-11e5-9fdf-2cd4f33f6582.gif | |
// NB: You can use math functions/operators on ImVec2 if you #define IMGUI_DEFINE_MATH_OPERATORS and #include "imgui_internal.h" | |
// Here we only declare simple +/- operators so others don't leak into the demo code. | |
static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); } |
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
bool MyImGui::DragFloats(const char* label, float* floats, int numFloats, bool* pJustReleased, float v_speed, float v_min, float v_max, const char* display_format, float power) | |
{ | |
ImGuiWindow* window = ImGui::GetCurrentWindow(); | |
if(window->SkipItems) | |
return false; | |
if(pJustReleased) { | |
*pJustReleased = false; | |
} |
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
ImGuiStyle& style = ImGui::GetStyle(); | |
style.ChildWindowRounding = 3.f; | |
style.GrabRounding = 0.f; | |
style.WindowRounding = 0.f; | |
style.ScrollbarRounding = 3.f; | |
style.FrameRounding = 3.f; | |
style.WindowTitleAlign = ImVec2(0.5f,0.5f); | |
style.Colors[ImGuiCol_Text] = ImVec4(0.73f, 0.73f, 0.73f, 1.00f); |
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
// variadic.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <vector> | |
#include <memory> | |
#include <iostream> | |
#include <functional> |