Skip to content

Instantly share code, notes, and snippets.

View MatthewBlanchard's full-sized avatar

Matthew Blanchard MatthewBlanchard

  • Atlantic City, New Jersey
View GitHub Profile
@MatthewBlanchard
MatthewBlanchard / geometry.c
Created May 29, 2011 04:06
Generating some stuff
#include "math.h"
#include "stdlib.h"
#include "geometry.h"
//Inputs:
//verts: The higher the number the more vertices and the smoother the cylinder, number of verts on each side.
//size: distance of the vertices from the center.
//width: the thickness of the cylinder
//return: pointer to memory on heap, contains points in size verts*2
mesh generateCylinder(int verts, float size, float width)
require "os"
require "math"
require "glfw"
require "glua"
vertshade = [[
#version 330
layout(location = 0) in vec4 position;
void main()
@MatthewBlanchard
MatthewBlanchard / Miniobj.lua
Created October 26, 2012 23:09
Two small object systems.
Object={}Object.__index=Object
setmetatable(Object,Object)function Object:__call(...)return self:new(...)end
function Object:init()end
function Object:parent()return getmetatable(self)end
function Object:new(...)local e={}setmetatable(e,self)self.__index=self
e:init(...)return e
end
local s = [[
extern Image normaltex;
extern Image materialtex;
extern Image ramp;
extern Image sramp;
extern vec2 lightvec;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords )
{
vec4 material = Texel(materialtex, texture_coords);
local sqrt = math.sqrt
Vector3 = Object()
function Vector3:Vector3(x, y, z)
self.x = x or 0
self.y = y or 0
self.z = z or 0
end
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ship;
namespace Ship
{
namespace Firespray31
{
public class BobaFettScum : Firespray31
if (!CanShootOutsideArc)
{
ShotInfo shotInfo = new ShotInfo(Host, targetShip, this);
range = shotInfo.Range;
if (IsBullseyeArcOnly)
{
ShotInfoArc bullseyeShotInfo = new ShotInfoArc(Host, targetShip, Host.ArcInfo.GetArc<Arcs.ArcBullseye>());
if (!bullseyeShotInfo.InArc)
if (!CanShootOutsideArc)
{
ShotInfo shotInfo = new ShotInfo(Host, targetShip, this);
range = shotInfo.Range;
if (IsBullseyeArcOnly)
{
ShotInfoArc bullseyeShotInfo = new ShotInfoArc(Host, targetShip, Host.ArcInfo.GetArc<Arcs.ArcBullseye>());
if (!bullseyeShotInfo.InArc)
private void CheckRange()
{
InArcInfo = new Dictionary<GenericArc, bool>();
List<System.Type> WeaponArcRestrictions = (Weapon is GenericSecondaryWeapon) ? (Weapon as GenericSecondaryWeapon).ArcRestrictions : null;
WeaponTypes weaponType = (Weapon is GenericSecondaryWeapon) ? (Weapon as GenericSecondaryWeapon).WeaponType : WeaponTypes.PrimaryWeapon;
foreach (var arc in Ship1.ArcInfo.Arcs)
{
ShotInfoArc shotInfoArc = new ShotInfoArc(Ship1, Ship2, arc);
InArcInfo.Add(arc, shotInfoArc.InArc);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ship;
using ActionsList.SecondEdition;
using System;
using SubPhases;
using RuleSets;
namespace Ship