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
#[deriving(ToStr)] | |
struct Vec3f { | |
x: f32, | |
y: f32, | |
z: f32 | |
} | |
macro_rules! impl_vec_op( | |
($tr: ident, $op: ident, $vt: ident, $($members: ident)+) => ( | |
impl $tr<$vt, $vt> for $vt { |
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
src/functions.rs:1557:109: 1557:113 error: unresolved import. maybe a missing `extern mod libc`? | |
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, count: ::GLsizei, gltype: ::GLenum, indices: *::libc::c_void, instancecount: ::GLsizei, baseinstance: ::GLuint); | |
^~~~ | |
src/functions.rs:1557:109: 1557:123 error: use of undeclared module `::libc` | |
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, count: ::GLsizei, gltype: ::GLenum, indices: *::libc::c_void, instancecount: ::GLsizei, baseinstance: ::GLuint); | |
^~~~~~~~~~~~~~ | |
src/functions.rs:1557:109: 1557:123 error: use of undeclared type name `libc::c_void` | |
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, c |
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
use std::uint; use std::vec; | |
static node_size : uint = 32; | |
struct HashArrayMappedTrie<T> { | |
root : Node<T>, | |
length : uint | |
} | |
#[deriving(Clone)] |
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
static node_size : uint = 32; | |
struct HashArrayMappedTrie<T> { | |
root : ~Node<T>, | |
length : uint | |
} | |
enum Node<T> { | |
Values([T]), | |
Children([@Node<T>, ..node_size]), |
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
module toybox.math.vector; | |
private | |
{ | |
import std.stdio, std.string, std.metastrings, std.typecons, std.traits; | |
static import std.math, std.algorithm; | |
import toybox.math.matrix; | |
} | |
template IsComponentType(T) { static if(is(T == float) || is(T == double) || is(T == int) || is(T == uint) || is(T == bool)) { enum IsComponentType = true; } else { enum IsComponentType = false; } } | |
template IsFloat(T) { static if(is(T == float) || is(T == double)) { enum IsFloat = true; } else { enum IsFloat = 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
static int coordIndex(char c)() pure nothrow | |
{ | |
switch(c) | |
{ | |
case 'x': return 0; | |
case 'y': return 1; | |
case 'z': return N > 2 ? 2 : -1; | |
case 'w': return N > 3 ? 3 : -1; | |
default: | |
return -1; |
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
module test; | |
import std.stdio; | |
void foo(T)(T param) { static assert(false, "Not implemented"); } | |
void foo(T:float)(T param) { writeln(param); } | |
int main() | |
{ | |
foo!double(1); | |
return 0; |
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
ReturnType!fn checkedgl(alias fn) (ParameterTypeTuple!fn params, string file = __FILE__, size_t line = __LINE__) | |
{ | |
scope(success) | |
{ | |
auto errorCode = gl.getError(); | |
if(errorCode != 0) | |
throw new GlException(errorCode, file, line); | |
} | |
return fn(params); | |
} |
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
class Foo | |
{ | |
int foo; | |
} | |
int main() | |
{ | |
const Foo[] foo = [new Foo(), new Foo(), new Foo()]; | |
foo[0].foo= 1; |
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 xml.etree.ElementTree as ET | |
import string | |
core_3_0 = [ | |
"VERSION_1_0", | |
"VERSION_1_1", | |
"VERSION_1_2", | |
"VERSION_1_3", | |
"VERSION_1_4", |