Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seanbaxter committed Oct 30, 2020
0 parents commit 6711ee7
Show file tree
Hide file tree
Showing 75 changed files with 7,282 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
*.ktx2 filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions assets/.gitattributes
@@ -0,0 +1 @@
*.ktx2 filter=lfs diff=lfs merge=lfs -text
15 changes: 15 additions & 0 deletions assets/DamagedHelmet/README.md
@@ -0,0 +1,15 @@
# Damaged Helmet

## Screenshot

![screenshot](screenshot/screenshot.png)

## License Information

Battle Damaged Sci-fi Helmet - PBR by [theblueturtle_](https://sketchfab.com/theblueturtle_), published under a Creative Commons Attribution-NonCommercial license

https://sketchfab.com/models/b81008d513954189a063ff901f7abfe4

## Modifications

The original model was built on an early draft of glTF 2.0 that did not become final. This new model has been imported and re-exported from Blender to bring it into alignment with the final release glTF 2.0 specification.
Binary file added assets/DamagedHelmet/glTF/DamagedHelmet.bin
Binary file not shown.
204 changes: 204 additions & 0 deletions assets/DamagedHelmet/glTF/DamagedHelmet.gltf
@@ -0,0 +1,204 @@
{
"accessors" : [
{
"bufferView" : 0,
"componentType" : 5123,
"count" : 46356,
"max" : [
14555
],
"min" : [
0
],
"type" : "SCALAR"
},
{
"bufferView" : 1,
"componentType" : 5126,
"count" : 14556,
"max" : [
0.9424954056739807,
0.8128451108932495,
0.900973916053772
],
"min" : [
-0.9474585652351379,
-1.18715500831604,
-0.9009949564933777
],
"type" : "VEC3"
},
{
"bufferView" : 2,
"componentType" : 5126,
"count" : 14556,
"max" : [
1.0,
1.0,
1.0
],
"min" : [
-1.0,
-1.0,
-1.0
],
"type" : "VEC3"
},
{
"bufferView" : 3,
"componentType" : 5126,
"count" : 14556,
"max" : [
0.9999759793281555,
1.998665988445282
],
"min" : [
0.002448640065267682,
1.0005531199858524
],
"type" : "VEC2"
}
],
"asset" : {
"generator" : "Khronos Blender glTF 2.0 exporter",
"version" : "2.0"
},
"bufferViews" : [
{
"buffer" : 0,
"byteLength" : 92712,
"byteOffset" : 0,
"target" : 34963
},
{
"buffer" : 0,
"byteLength" : 174672,
"byteOffset" : 92712,
"target" : 34962
},
{
"buffer" : 0,
"byteLength" : 174672,
"byteOffset" : 267384,
"target" : 34962
},
{
"buffer" : 0,
"byteLength" : 116448,
"byteOffset" : 442056,
"target" : 34962
}
],
"buffers" : [
{
"byteLength" : 558504,
"uri" : "DamagedHelmet.bin"
}
],
"images" : [
{
"uri" : "Default_albedo.jpg"
},
{
"uri" : "Default_metalRoughness.jpg"
},
{
"uri" : "Default_emissive.jpg"
},
{
"uri" : "Default_AO.jpg"
},
{
"uri" : "Default_normal.jpg"
}
],
"materials" : [
{
"emissiveFactor" : [
1.0,
1.0,
1.0
],
"emissiveTexture" : {
"index" : 2
},
"name" : "Material_MR",
"normalTexture" : {
"index" : 4
},
"occlusionTexture" : {
"index" : 3
},
"pbrMetallicRoughness" : {
"baseColorTexture" : {
"index" : 0
},
"metallicRoughnessTexture" : {
"index" : 1
}
}
}
],
"meshes" : [
{
"name" : "mesh_helmet_LP_13930damagedHelmet",
"primitives" : [
{
"attributes" : {
"NORMAL" : 2,
"POSITION" : 1,
"TEXCOORD_0" : 3
},
"indices" : 0,
"material" : 0
}
]
}
],
"nodes" : [
{
"mesh" : 0,
"name" : "node_damagedHelmet_-6514",
"rotation" : [
0.7071068286895752,
0.0,
-0.0,
0.7071068286895752
]
}
],
"samplers" : [
{}
],
"scene" : 0,
"scenes" : [
{
"name" : "Scene",
"nodes" : [
0
]
}
],
"textures" : [
{
"sampler" : 0,
"source" : 0
},
{
"sampler" : 0,
"source" : 1
},
{
"sampler" : 0,
"source" : 2
},
{
"sampler" : 0,
"source" : 3
},
{
"sampler" : 0,
"source" : 4
}
]
}
Binary file added assets/DamagedHelmet/glTF/Default_AO.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/DamagedHelmet/glTF/Default_albedo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/DamagedHelmet/glTF/Default_emissive.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/DamagedHelmet/glTF/Default_normal.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/DamagedHelmet/screenshot/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/brdfLUT.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/helipad/charlie/sheen.ktx2
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/helipad/ggx/specular.ktx2
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/helipad/lambertian/diffuse.ktx2
Git LFS file not shown
Binary file added assets/lut_charlie.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/lut_ggx.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/thisisfine.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tyrian.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions assets/tyrian.sprites
@@ -0,0 +1,20 @@
191 220 191
one_shot 0 42 12 56
two_shot 12 42 24 56
three_shot 24 42 36 56
four_shot 36 42 48 56
five_shot 48 42 60 56
energy 60 42 72 56
reg_fireball 72 42 84 56
blue_fireball 84 42 96 56
arched_energy 96 42 108 56
one_thin 108 42 120 56
missile 120 42 132 56
two_missile 132 42 144 56
two_thin 144 42 156 56
eagle 156 42 168 56
nuke 168 42 180 56
double_energy 180 42 192 56
blue_haduken 192 42 204 56
red_haduken 204 42 216 56
missile2 216 42 228 56
64 changes: 64 additions & 0 deletions attributes/attrib1.cxx
@@ -0,0 +1,64 @@
#include <cstdio>

template<typename type_t>
const char* enum_to_name(type_t x) {
switch(x) {
@meta for enum(type_t x2 : type_t)
case x2:
return @enum_name(x2);
default:
return "<unknown>";
}
}

// Three kinds of attributes:
// 1. Class types.
// 2. Enum type.
// 3. Attribute aliases to any other type.

// Define a class type to be used as an attribute.
struct extent_t {
int width, height;
};

// Name the class type after a dot in the attribute sequence.
// Because this is an aggregate (no user-provided constructor), use the
// braced aggregate initializer.
[[.extent_t { 800, 600 }]] int X;

// Define an enum for an attribute.
enum class shape_t {
circle,
square,
triangle,
};

// Name the enum after the dot. For enum attributes, a single-identifier
// token initializer will be matched to enumeration names.
[[.shape_t=triangle]] int Y;

// Define an attribute alias to some other type. This lets us reuse types
// without ambiguity.
using title_t [[attribute]] = const char*;

// Name the attribute alias. We can't name the underlying type.
// The attribute alias is like an opaque typedef.
[[.title_t="A great var"]] int Z;

int main() {
// The @attribute keyword is provided a declaration and an
// attribute type or attribute alias. It gives an lvalue to that
// compile-time attribute.
printf("X width = %d\n", @attribute(X, extent_t).width);

// If non-const, you can even modify it at compile time. This is helpful
// for keeping counters.
@meta ++@attribute(X, extent_t).width;
printf("X width = %d\n", @attribute(X, extent_t).width);

// Use Circle reflection to turn this enum attribute into a string:
printf("Y shape = %s\n", enum_to_name(@attribute(Y, shape_t)));

// Print directly from a compile-time const char*.
printf("Z title = %s\n", @attribute(Z, title_t));
}
68 changes: 68 additions & 0 deletions attributes/attrib2.cxx
@@ -0,0 +1,68 @@
#include <iostream>
#include <type_traits>

template<typename type_t>
const char* enum_to_name(type_t x) {
switch(x) {
@meta for enum(type_t x2 : type_t)
case x2:
return @enum_name(x2);
default:
return "<unknown>";
}
}

using title [[attribute]] = const char*;
using url [[attribute]] = const char*;
using magic [[attribute]] = int;

enum class edge {
left, top, right, bottom,
};
enum class corner {
nw, ne, se, sw,
};

template<typename type_t>
std::string to_string(type_t x) {
if constexpr(std::is_enum_v<type_t>) {
return enum_to_name(x);

} else if constexpr(std::is_same_v<bool, type_t>) {
return x ? "true" : "false";

} else if constexpr(std::is_arithmetic_v<type_t>) {
return std::to_string(x);

} else {
static_assert(std::is_same_v<const char*, type_t>);
return x;
}
}

struct foo_t {
[[.edge=right, .url="https://www.fake.url/"]] int x;
[[.title="Sometimes a vowel", .corner=ne]] int y;
[[.magic=10101, .title="The magic number"]] int z;
};

template<typename type_t>
void print_member_attributes() {
std::cout<< "Member attributes for "<< @type_string(type_t)<< "\n";

@meta for(int i = 0; i < @member_count(type_t); ++i) {{
// Loop over each member.
std::cout<< " "<< @member_name(type_t, i)<< ":\n";

// @member_attribute_list is a type parameter pack of all attribute names.
// Loop over them and print them out.
@meta for typename(t : { @member_attribute_list(type_t, i)... }) {
std::cout<< " "<< @type_string(t)<< " = "<<
to_string(@member_attribute(type_t, i, t))<< "\n";
}
}}
}

int main() {
print_member_attributes<foo_t>();
}

0 comments on commit 6711ee7

Please sign in to comment.