public static LedSeq load(string path) { // read header and params // open the archive file if (!File.Exists(path)) { Debug.LogError("the file do not exist"); return(null); } // get the headers and valid header // create the corresponding ledseq Stream sw = File.OpenRead(path); LedSeq ledseq = null; if ((ledseq = validHeader(sw)) != null) { // input all the data and fill ledseq ledseq.restoreParams(); ledseq.restoreFrameBuffer(sw); } sw.Close(); sw.Dispose(); return(ledseq); }
protected override LedMatrix initEmulator(LedSeq s) { switch (mode) { case CubeDisplayMode.NORMAL: return(new CubeMatrix(s as CubeLedSeq)); case CubeDisplayMode.LED: return(new CubeLedMatrix(s as CubeLedSeq)); default: return(new CubeLedMatrix(s as CubeLedSeq)); } }
void Awake() { UnityEngine.Debug.Log("Awake"); if (NeedRegister) { manager = this; } QualitySettings.vSyncCount = 0; Application.targetFrameRate = 20; initConfig(); initBounds(); ledseq = initLedSeq(); }
static LedSeq validHeader(Stream sw) { uint[] header = new uint[HEADERNUM]; byte[] buf = new byte[header.Length * sizeof(uint)]; sw.Read(buf, 0, buf.Length); Buffer.BlockCopy(buf, 0, header, 0, buf.Length); if (header[(int)HeaderItem.Version] != version) { Debug.LogError("the ledseq version mismatch " + header[(int)HeaderItem.Version]); return(null); } LedSeq ledseq = null; switch (header[(int)HeaderItem.Shape]) { case (uint)Shape.Cube: ledseq = new CubeLedSeq(); break; case (uint)Shape.Cylinder: ledseq = new CylinderLeqSeq(); break; default: return(null); } Buffer.BlockCopy(header, 0, ledseq.header, 0, header.Length * sizeof(uint)); buf = new byte[ledseq.param1.Length * sizeof(uint)]; sw.Read(buf, 0, buf.Length); Buffer.BlockCopy(buf, 0, ledseq.param1, 0, buf.Length); buf = new byte[ledseq.param2.Length * sizeof(float)]; sw.Read(buf, 0, buf.Length); Buffer.BlockCopy(buf, 0, ledseq.param2, 0, buf.Length); return(ledseq); }
protected abstract ParticleVox initParticleVox(LedSeq s, Bounds b, HashSet <IParticleObject> ss);
protected abstract MeshVox initMeshVox(LedSeq s, Bounds b, HashSet <IMeshObject> ss);
public Vox(LedSeq s, Bounds b) { ledseq = s; worldBounds = b; }
protected override LedMatrix initBridge(LedSeq s) { throw new NotImplementedException(); }
public ParticleVox(LedSeq led, Bounds b, HashSet <IParticleObject> pos) : base(led, b) { this.pos = pos; }
protected override ParticleVox initParticleVox(LedSeq s, Bounds b, HashSet <IParticleObject> ss) { return(new CylinderParticleVox(s as CylinderLeqSeq, b, ss)); }
protected override MeshVox initMeshVox(LedSeq s, Bounds b, HashSet <IMeshObject> ss) { return(new CylinderMeshVox(s as CylinderLeqSeq, b, ss)); }
protected override LedMatrix initEmulator(LedSeq s) { return(new CylinderLedMatrix(s as CylinderLeqSeq)); }
protected override LedMatrix initBridge(LedSeq s) { return(new CylinderBigLedBridge(s as CylinderLeqSeq)); }
public LedMatrix(LedSeq led) { ledseq = led; TOTAL = led.ledsPerFrame; }
protected abstract LedMatrix initEmulator(LedSeq s);
public MeshVox(LedSeq seq, Bounds worldBounds, HashSet <IMeshObject> objs) : base(seq, worldBounds) { voxObjects = objs == null ? voxObjects : objs; }
protected abstract LedMatrix initBridge(LedSeq s);
// Use this for initialization void Start() { Debug.Log("Start"); Loom.Initialize(); //touchControlThread = new Thread(touchControl); //touchControlThread.Start(); //sonicControlThread = new Thread(sonicControl); //sonicControlThread.Start(); //gestureControlThread = new Thread(gestureControl); //gestureControlThread.Start(); giraffe = GameObject.Find("/Giraffe"); dolphin = GameObject.Find("/dolphin"); fish = GameObject.Find("transformFizzBait"); fishanimator = GameObject.Find("/fish"); sth = GameObject.Find("/sth"); glow = GameObject.Find("/Glow"); glowps = glow.GetComponent <ParticleSystem>(); ripple = GameObject.Find("/Ripple"); rippleps = ripple.GetComponent <ParticleSystem>(); bubble = GameObject.Find("/bubble"); buddy = GameObject.Find("U_Char"); face = GameObject.Find("Bruce_Willis_Face"); stag = GameObject.Find("STAG/STAG"); GameObject test = GameObject.Find("/test"); GameObject mermaid = GameObject.Find("/Mermaid/Mermaid"); Animator aa = null; if (fishanimator != null) { aa = fishanimator.GetComponent <Animator>(); aa.speed = 0.4f; } //objectsWorld = new Bounds(new Vector3(0, 11.5f, 0), new Vector3(7, 11.5f, 7) * 2); //particlesWorld = new Bounds(new Vector3(0, 36, 0), new Vector3(18, 36, 18) * 2); objectsWorld = new Bounds(new Vector3(0, 9f, 0), new Vector3(18, 9f, 18) * 2); //particlesWorld = new Bounds(new Vector3(0, 18, 0), new Vector3(27, 18, 27) * 2); particlesWorld = new Bounds(new Vector3(0, 18, 0), new Vector3(27, 18, 27) * 2); //ParticleSystem p = GameObject.Find("/FireworksGood").GetComponent<ParticleSystem>(); HashSet <IParticleObject> pos = new HashSet <IParticleObject> { //new ParticleSystemObject(particlesWorld, rippleps, new Vector2()) }; objs = new HashSet <IMeshObject> { //new VoxObject { // gameObject = GameObject.Find("11_Hand_Right"), // mode = MeshMode.MeshFilterMode, // transform = GameObject.Find("11_Hand_Right").transform, //}, //new VoxObject { // gameObject = GameObject.Find("07_Hand_Left"), // mode = MeshMode.MeshFilterMode, // transform = GameObject.Find("07_Hand_Left").transform, //}, //new VoxObject { // gameObject = face, // mode = MeshMode.SkinnedMeshRendererMode, // transform = face.transform, //}, //new VoxObject { // gameObject = buddy, // mode = MeshMode.SkinnedMeshRendererMode, // transform = buddy.transform, //}, //new VoxObject{ // gameObject = dd, // mode = MeshMode.MeshFilterMode, // transform = dd.transform //}, }; //extract(new Transform[] //{ // //GameObject.Find("/flower01").transform, // //GameObject.Find("/flower02").transform, // //GameObject.Find("/flower03").transform, // //GameObject.Find("/flower05").transform, // //GameObject.Find("/rose").transform, // //GameObject.Find("/flower06").transform, //}, objs); //CubeLedSeq s = new CubeLedSeq(21, 33, 21); //CylinderLeqSeq s = new CylinderLeqSeq(56, 12, 7, 7, 5, 7); CylinderLeqSeq s = new CylinderLeqSeq(25, 8, 15f, 15f, 6f, 8.5f); //CylinderLeqSeq s = new CylinderLeqSeq(40, 12, 15f, 15f, 6f, 8.5f); //CylinderLeqSeq s = new CylinderLeqSeq(32, 2, 15, 15, 6, 0); //CylinderLeqSeq s = new CylinderLeqSeq(80, 18, 15, 15, 6, 0); ledseq = s; //s.open("C:\\Users\\yqf\\Desktop\\test.ledseq", 30 * 20); //vox = new CubeMeshVox(s, objs, objectsWorld); //vox = new CylinderMeshVox(s, objectsWorld, objs); vox.Start(); MeshVox.setGradientColor(false, 1, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff); MeshVox.setSolidFill(true); //MeshVox.setFillColor(0x7f7f7f00); pvox = new CylinderParticleVox(s, particlesWorld, pos); //matrix = new CubeLedMatrix(s); matrix = new CylinderLedMatrix(s); //bridge = new CylinderBigLedBridge(s); ledWorld = matrix.getLedBound(); }