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
| """ | |
| .blend to TMD export. | |
| Only objects in "Collection" collection are exported, they're automatically joined and triangulated. | |
| Only flat shaded meshes are supported: | |
| Use Color Attribute -> Face Corner (NOT Vertex color). | |
| Run via CLI: | |
| /usr/bin/blender <BLEND_FILE> \ | |
| --quiet --python-exit-code 1 \ | |
| --background --python tmd_export.py \ |
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
| import std.io; | |
| import std.core; | |
| import std.sys; | |
| #include <math.hexpat> | |
| struct Vec3Pad { | |
| FixedPoint<s16> x, y, z; | |
| u16 pad [[hidden]]; | |
| } [[sealed, format("format_vec3")]]; |
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
| -- depends on https://github.com/kikito/inspect.lua | |
| local inspect = require 'inspect' | |
| local M = {} | |
| local function tostring_impl(v) | |
| if type(v) == "table" then | |
| -- change to inspect(v, {newline=""}) if you want to print everything tables on one line | |
| return inspect(v) | |
| elseif type(v) == "nil" then |
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
| package main | |
| import ( | |
| "testing" | |
| "github.com/go-gl/mathgl/mgl32" | |
| "github.com/kvartborg/vector" | |
| "github.com/ungerik/go3d/vec2" | |
| "gonum.org/v1/gonum/mat" | |
| ) |
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
| package main | |
| import ( | |
| "testing" | |
| "github.com/kvartborg/vector" | |
| ) | |
| // kvartborg/vector version | |
| type vec = vector.Vector |
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 <iostream> | |
| #include <meta.h> | |
| #include <json.h> | |
| using json = nlohmann::json; | |
| struct Entity { | |
| int id; | |
| }; | |
| struct Character : Entity { |
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 <iostream> | |
| #include <memory> | |
| #include <string> | |
| #include <unordered_map> | |
| #include <json.hpp> | |
| using json = nlohmann::json; | |
| template <typename Class> |
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 <sol.hpp> | |
| #include <string> | |
| #include <iostream> | |
| using EntityId = int; | |
| class Entity { | |
| public: | |
| explicit Entity(EntityId id) : | |
| name("John"), id(id) |
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
| Handles = {} | |
| local memoizedFuncs = {} | |
| -- metatable which does magic | |
| local mt = {} | |
| mt.__index = function(handle, key) | |
| if not handle.isValid then | |
| print(debug.traceback()) | |
| error("Error: handle is not valid!", 2) | |
| end |
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
| // SAT collision check and resolution | |
| // Public domain | |
| // Usage example: | |
| // if (testCollision(obb1, obb2, mtv)) { // obb1, obb2 - sf::RectangleShape, mtv - sf::Vector2f | |
| // obb1.move(mtv); | |
| // } | |
| static const float NORMAL_TOLERANCE = 0.0001f; | |
| using RectVertexArray = std::array<sf::Vector2f, 4>; |