Skip to content

Instantly share code, notes, and snippets.

@jamesu
jamesu / Dockerfile
Created February 19, 2024 23:15
Generic build env
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install -y build-essential cmake libsdl2-dev libsdl2-mixer-dev libogg-dev libopenal-dev
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
@jamesu
jamesu / STB Font Prototype Code
Last active January 22, 2024 13:42
SDF Font Code prototype
AUTHORS
James S Urquhart (jamesu@gmail.com)
Tribes 1 Model Formats
----------------------
Tribes 1 uses file formats which are similar to file formats used in the Torque Game Engine, with the major difference being more use of tags and versioned objects serialized by class name (working on the same basic principle of class instantiation in torques' console system). Also a lot more emphasis on paletted textures.
Currently this document only covers enough to render .dts and interior (.dig,.dis,.dil) shapes present in Tribes 1. For tribes 2 file formats, your best bet is to check out the earlier torque code.
We'll refer to each field as [type] [name or tag value]. If successive fields need to be at a specific offset indicated by a field, that will be noted with "@nameOffset:" where appropriate. In addition if there is a list of typed data, it will be listed as "type[size]:" followed by the fields of that type.
@jamesu
jamesu / yt_download.js
Created January 31, 2011 16:16
Fixed that Youtube bookmarklet that puts download links for YT videos
// Convert to bookmarklet, run script. You should get download links for your video!
(function() {
if (document.getElementById('download-youtube-video')) return;
var args = null,
video_title = null,
video_id = null,
video_hash = null;
var download_code = new Array();
var fmt_labels = {
'18': 'standard MP4',
@jamesu
jamesu / premake5.lua
Last active September 10, 2023 21:44
Torque3D premake build file. Generates a suitable project for T3D with premake.
-- premake5.lua
-- Project file creator for T3D
-- Usage: premake5 <toolchain>
-- (C)2016-2019 James S Urquhart. Feel free to use wherever.
--
-- Instructions:
-- * Copy Templates/Full to a folder in "My Projects"
-- * Change PROJECT_NAME to match this folder name
-- * Change WORKSPACE_NAME to your desired workspace name
#
# Simple script - Print out pseudo-code for glTexGen* states
#
# Author: James Urquhart, jamesu@gmail.com
#
# Put your code in the doCode at the end of the file.
#
require 'json'
GL_TEXTURE_2D = 1

Critiques of MatrixNode

  • Feels a little too heavy for a "node" class. My generic in-head idea is to provide a lightweight abstraction over existing stuff in order to compliment it
  • Doesn't seem to allow for scaling ranges which some animations use, though may be impractical to implement anyway

NodeTransforms:

  • Feels hard to read - why do we need links etc?
  • NodeTransforms::NodeTransforms constructors - whats itterative do?
@jamesu
jamesu / Example.hx
Created March 19, 2012 13:43
Javascript Byte IO for haXe using ArrayBuffers
// Example usage
class Example
{
public static function test()
{
var bytes = new JSByteIO(new ArrayBuffer(128));
// Writing and reading a line
@jamesu
jamesu / read_tribes1dts.rb
Created February 13, 2012 23:19
Reading Tribes 1 dts files
#!/usr/bin/ruby
# Basic attempt at reading Tribes 1 .dts files
# Appears to be some sort of nested IFF-like block format
File.open(ARGV[0]) do |f|
pos = 0
while !f.eof
f.seek pos
magic = f.read(4).unpack("L<")[0]
//
// Copyright (c) 2014 James S Urquhart. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following