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
| #include <GL/glfw3.h> | |
| #include <png.h> | |
| #include "managers/FileManager.h" | |
| #include "PNGFile.h" | |
| #include "utils/Logger.h" | |
| Texture PNGFile::Load(std::string _path) | |
| { | |
| Texture tex; | |
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
| function findVar(attr) { | |
| var url = location.href.split("#")[0]; | |
| var search = new RegExp(attr + "=.*?(?=[#&]|$)"); | |
| var result = search.exec(url); | |
| if (result !== null) { | |
| result = result[0].split("=")[1]; | |
| if (/^-?\d+(\.\d+)?$/.test(result)) | |
| return Number(result); | |
| else | |
| return result; |
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
| /* | |
| * OpenHMD - Free and Open Source API and drivers for immersive technology. | |
| * Copyright (C) 2013 Fredrik Hultin. | |
| * Copyright (C) 2013 Jakob Bornecrantz. | |
| * Distributed under the Boost 1.0 licence, see LICENSE for full text. | |
| */ | |
| #ifndef OPENHMD_H | |
| #define OPENHMD_H |
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 pretty_print_extensions(std::vector<std::string> &extensions) | |
| { | |
| // derived from the extension pretty printing from StepMania. | |
| using namespace std; | |
| sort( extensions.begin(), extensions.end() ); | |
| size_t next = 0; | |
| while( next < extensions.size() ) | |
| { | |
| size_t last = next; |
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
| -- size 3 | |
| -- going up 1 3 5 | |
| -- going down 5 3 4 4 1 2 2 3 3 | |
| -- size 5 | |
| -- going up 1 3 5 7 9 | |
| -- going down 9 7 8 8 5 6 6 7 7 3 4 4 5 5 1 2 2 3 3 4 4 | |
| -- string.format is quite a bit of typing | |
| _ = string.format; |
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
| all: | |
| cp foo.o bar.o | |
| @echo "or if you're the silent type..." | |
| @cp bar.o baz.o | |
| @echo "copied bar.o to baz.o" |
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
| function split(s, v) | |
| local pos = s:find(v) | |
| local ret = {} | |
| local idx = 1 | |
| for i=1,string.len(s) do | |
| local c = s:sub(i,i) | |
| local token = s:sub(i, i+v:len()-1) | |
| if token:find(v) then | |
| idx = idx + 1 | |
| else |
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
| class Uniform | |
| { | |
| public: | |
| // todo: macroify, make m_program actually a thing. | |
| void set_uniform_float(std::string key, float data) | |
| { | |
| using namespace std; | |
| unsigned location = 0; | |
| map<string, unsigned>::iterator it; |
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
| #!/usr/bin/env bash | |
| if [[ $# != "1" ]]; then | |
| echo "Not enough arguments. Usage: jcl <path>" | |
| exit | |
| fi | |
| # remove trailing slash | |
| path=`echo $1 | sed 's/\/*$//'` |
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
| #define CheckError()\ | |
| {\ | |
| GLenum err = glGetError();\ | |
| if (unlikely(err != GL_NO_ERROR))\ | |
| {\ | |
| for (; err != GL_NO_ERROR; err = glGetError())\ | |
| {\ | |
| switch (err)\ | |
| {\ | |
| case GL_INVALID_ENUM: LOG->Error("GL_INVALID_ENUM"); break;\ |