Final Project: Reddit – Spaces of Climate Crisis

sketch

//Tim Nelson-Pyne
//tnelsonp
//Section C

var linksAntofu = ['https://i.imgur.com/Px1nV2B.jpg',
        'https://i.imgur.com/0Xd0GrB.png',
        'https://i.imgur.com/tAZFqHS.png',
        'https://i.imgur.com/mQenYYL.png',
        'https://i.imgur.com/49UZ1CQ.png',
        'https://i.imgur.com/zCeIB47.png',
        'https://i.imgur.com/bW5fsDf.png',
        'https://i.imgur.com/QqtjU1X.png',
        'https://i.imgur.com/PexfMHV.png',
        'https://i.imgur.com/KKu6Az2.png',
        'https://i.imgur.com/w55Ylwi.png',
        'https://i.imgur.com/86yrIIy.png',
        'https://i.imgur.com/xv63US1.png',
        'https://i.imgur.com/LfTmJHW.png',
        'https://i.imgur.com/qL8OCUJ.png',
        'https://i.imgur.com/RZlY9w8.png',
        'https://i.imgur.com/XTz4fVe.png',
        'https://i.imgur.com/8FZDSTa.png',
        'https://i.imgur.com/qBusraJ.png',
        'https://i.imgur.com/BpzmTcT.png',
        'https://i.imgur.com/YpxCZ1L.png',
        'https://i.imgur.com/8DXeLem.png',
        'https://i.imgur.com/a9pINWL.png',
        'https://i.imgur.com/jUFq33O.png',
        'https://i.imgur.com/xjQqAO1.png',
        'https://i.imgur.com/WXqNRVx.png',
        'https://i.imgur.com/gbkrwCj.png',
        'https://i.imgur.com/6gz20Vz.png',
        'https://i.imgur.com/UisuyPK.png',
        'https://i.imgur.com/tLvo8ln.png',
        'https://i.imgur.com/t2uQLf3.png',
        'https://i.imgur.com/mcsxD55.png',
        'https://i.imgur.com/rXMGQXS.png',
        'https://i.imgur.com/gbNnKhs.png',
        'https://i.imgur.com/9sp5SBc.png',
        'https://i.imgur.com/UEQJKrt.png'];


var linksClimatememes = [  'https://i.imgur.com/PyyxiE2h.png ',
 'https://i.imgur.com/Qaij15yh.jpg ',
 'https://i.imgur.com/9qBZVsfh.jpg ',
 'https://i.imgur.com/BHMNtHbh.jpg ',
 'https://i.imgur.com/lWpftgdh.jpg ',
 'https://i.imgur.com/7UoMKfdh.jpg ',
 'https://i.imgur.com/ljK0Pxmh.png ',
 'https://i.imgur.com/jC0tndfh.jpg ',
 'https://i.imgur.com/GEH3qEeh.jpg ',
 'https://i.imgur.com/4iAHEGsh.jpg ',
 'https://i.imgur.com/rEfIJiAh.png ',
 'https://i.imgur.com/FxxbBPgh.jpg ',
 'https://i.imgur.com/MZYveu9h.jpg ',
 'https://i.imgur.com/r4d9cuMh.jpg ',
 'https://i.imgur.com/TtWnYNQh.jpg ',
 'https://i.imgur.com/XWvhFzyh.jpg ',
 'https://i.imgur.com/lTNprgCh.jpg ',
 'https://i.imgur.com/z6vGesEh.jpg ',
 'https://i.imgur.com/JFel7Tch.jpg ',
 'https://i.imgur.com/PswaFlUh.jpg ',
 'https://i.imgur.com/dRpfRJ4h.jpg ',
 'https://i.imgur.com/McW5KTuh.jpg ',
 'https://i.imgur.com/Jy2LqDZh.jpg ',
 'https://i.imgur.com/P4bDHvQh.jpg ',
 'https://i.imgur.com/qHRRRMyh.jpg ',
 'https://i.imgur.com/gIa53RXh.png ',
 'https://i.imgur.com/bWA8mW1h.jpg ',
 'https://i.imgur.com/ZWKScsth.jpg ',
 'https://i.imgur.com/MaWfObgh.jpg ',
 'https://i.imgur.com/FyJglCGh.jpg ',
 'https://i.imgur.com/GuC0B1Uh.jpg ',
 'https://i.imgur.com/7ToxgQah.jpg ',
 'https://i.imgur.com/Vpn0Wslh.jpg ',
 'https://i.imgur.com/JMgByNHh.jpg ',
 'https://i.imgur.com/aHrVja4h.png ',
 'https://i.imgur.com/moAPzg9h.jpg ',
 'https://i.imgur.com/lj31aS9h.jpg ',
 'https://i.imgur.com/tvYMvjAh.jpg ',
 'https://i.imgur.com/2RKCCfGh.png ',
 'https://i.imgur.com/ZwIM1Plh.jpg ',
 'https://i.imgur.com/Ebojz1gh.jpg ',
 'https://i.imgur.com/uq4CIM3h.png ',
 'https://i.imgur.com/kyQ3Teih.jpg ',
 'https://i.imgur.com/H6vxpfEh.png ',
 'https://i.imgur.com/bifhKt0h.jpg ',
 'https://i.imgur.com/42350bEh.jpg ',
 'https://i.imgur.com/9jwG8PUh.png ',
 'https://i.imgur.com/ZBCUV8uh.png ',
 'https://i.imgur.com/6N1ldU6h.jpg ',
 'https://i.imgur.com/pq3NAamh.jpg ',
 'https://i.imgur.com/eOK1u5yh.jpg ',
 'https://i.imgur.com/pUWXHaKh.jpg ',
 'https://i.imgur.com/O23YUVNh.png ',
 'https://i.imgur.com/6HmLOVQh.png ',
 'https://i.imgur.com/YebJamjh.png ',
 'https://i.imgur.com/mfrCdV4h.png ',
 'https://i.imgur.com/3pOQ1Mph.png ',
 'https://i.imgur.com/LmdujUKh.png ',
 'https://i.imgur.com/ARcSLCWh.png ',
 'https://i.imgur.com/ZtRgLC9h.jpg ',
 'https://i.imgur.com/YxGZoaVh.jpg ',
 'https://i.imgur.com/h2tYvXah.jpg ',
 'https://i.imgur.com/WBpgFlah.png ',
 'https://i.imgur.com/oVDPrYzh.png ',
 'https://i.imgur.com/Jk2FS3gh.png ',
 'https://i.imgur.com/1yX6MrVh.jpg ',
 'https://i.imgur.com/ILVScKVh.jpg ',
 'https://i.imgur.com/MeAjx8jh.jpg ',
 'https://i.imgur.com/xl4E56Yh.jpg ',
 'https://i.imgur.com/2Hz0IgQh.png ',
 'https://i.imgur.com/I1PlN5rh.jpg ',
 'https://i.imgur.com/yGFtN21h.png ',
 'https://i.imgur.com/oGhbiGgh.jpg ',
 'https://i.imgur.com/iUOHEibh.jpg ',
 'https://i.imgur.com/X45RvOAh.jpg ',
 'https://i.imgur.com/8DMjVJsh.jpg ',
 'https://i.imgur.com/73Q2YJch.jpg ',
 'https://i.imgur.com/fOsT7Hrh.jpg ',
 'https://i.imgur.com/WdGVHsch.png ',
 'https://i.imgur.com/eqCtXMPh.png ',
 'https://i.imgur.com/x23X9B9h.png ',
 'https://i.imgur.com/EkVUfkxh.png ',
 'https://i.imgur.com/GCsbwG7h.png ',
 'https://i.imgur.com/PMKg9UNh.jpg ',
 'https://i.imgur.com/1gRZiWXh.png ',
 'https://i.imgur.com/sq7Jz1nh.jpg ',
 'https://i.imgur.com/cAmr84ah.jpg ',
 'https://i.imgur.com/7RuXyB0h.jpg ',
 'https://i.imgur.com/6EYcWgah.jpg ',
 'https://i.imgur.com/6jSUIZyh.jpg ',
 'https://i.imgur.com/kcQpLZhh.jpg ',
 'https://i.imgur.com/m03xcE9h.jpg ',
 'https://i.imgur.com/zRAdgyZh.jpg ',
 'https://i.imgur.com/IqbDugGh.jpg ',
 'https://i.imgur.com/DXQ2lOqh.jpg ',
 'https://i.imgur.com/lxrlGJoh.jpg ',
 'https://i.imgur.com/3hXMfSth.jpg ',
 'https://i.imgur.com/EpqBdiRh.jpg ',
 'https://i.imgur.com/ZebsPX7h.jpg ',
 'https://i.imgur.com/PkvNfBJh.gif '
];

var linksSustainability = [ 'https://i.imgur.com/u5ItRuxh.jpg ',
 'https://i.imgur.com/Sy2HAlOh.jpg ',
 'https://i.imgur.com/okRlVEwh.jpg ',
 'https://i.imgur.com/cqwu0PFh.jpg ',
 'https://i.imgur.com/8MLqLhDh.jpg ',
 'https://i.imgur.com/4VuEzAsh.jpg ',
 'https://i.imgur.com/wnBbGJrh.jpg ',
 'https://i.imgur.com/7kGAMzSh.jpg ',
 'https://i.imgur.com/K7gts3mh.jpg ',
 'https://i.imgur.com/xBVrR2nh.jpg ',
 'https://i.imgur.com/pesVKmMh.jpg ',
 'https://i.imgur.com/V3R0cmvh.jpg ',
 'https://i.imgur.com/8zg2suYh.jpg ',
 'https://i.imgur.com/pX0kCEfh.jpg ',
 'https://i.imgur.com/3GdN8qvh.jpg ',
 'https://i.imgur.com/jGyj8hnh.jpg ',
 'https://i.imgur.com/xXfWBuxh.jpg ',
 'https://i.imgur.com/sPqgaqHh.png ',
 'https://i.imgur.com/KQncyTIh.png ',
 'https://i.imgur.com/AR01WlJh.jpg ',
 'https://i.imgur.com/3MmIiwUh.png ',
 'https://i.imgur.com/slhBBPqh.jpg ',
 'https://i.imgur.com/t6u3oxzh.png ',
 'https://i.imgur.com/3nNdcyRh.jpg ',
 'https://i.imgur.com/rkg4eAjh.jpg ',
 'https://i.imgur.com/cHEVMDBh.png ',
 'https://i.imgur.com/N7eMTs7h.jpg ',
 'https://i.imgur.com/ogxU6RRh.png ',
 'https://i.imgur.com/8ngBECJh.jpg ',
 'https://i.imgur.com/o8Vkagfh.jpg ',
 'https://i.imgur.com/wM7Bmgqh.jpg ',
 'https://i.imgur.com/uyIYSKZh.jpg ',
 'https://i.imgur.com/vdYDEobh.jpg ',
 'https://i.imgur.com/QzpCWBfh.jpg ',
 'https://i.imgur.com/5efCFeuh.jpg ',
 'https://i.imgur.com/3hk2vV5h.jpg ',
 'https://i.imgur.com/Rshe6LZh.jpg ',
 'https://i.imgur.com/ksGZsi2h.jpg ',
 'https://i.imgur.com/8BKlC8dh.jpg ',
 'https://i.imgur.com/Xhlrw2ch.jpg ',
 'https://i.imgur.com/nAQkleoh.png ',
 'https://i.imgur.com/ALrM2ZVh.jpg ',
 'https://i.imgur.com/RDHt4gkh.jpg ',
 'https://i.imgur.com/RvhIH9Zh.jpg ',
 'https://i.imgur.com/6QUMPLvh.jpg ',
 'https://i.imgur.com/jeutft7h.jpg ',
 'https://i.imgur.com/CqHFhl2h.jpg ',
 'https://i.imgur.com/BvHTZYzh.jpg ',
 'https://i.imgur.com/fwHR3yLh.jpg ',
 'https://i.imgur.com/YbxXzldh.jpg ',
 'https://i.imgur.com/o2HLl8ih.jpg ',
 'https://i.imgur.com/nUXGmUPh.png ',
 'https://i.imgur.com/lludSoch.png ',
 'https://i.imgur.com/h71BBcwh.jpg ',
 'https://i.imgur.com/PnNSME0h.png ',
 'https://i.imgur.com/oWiVymeh.jpg ',
 'https://i.imgur.com/EqQAgL8h.png ',
 'https://i.imgur.com/CtWcdqbh.jpg ',
 'https://i.imgur.com/rm9fh7Yh.jpg ',
 'https://i.imgur.com/QxFQijNh.jpg ',
 'https://i.imgur.com/cUbY2IWh.jpg ',
 'https://i.imgur.com/vC7pm9rh.jpg ',
 'https://i.imgur.com/cRflWrYh.jpg ',
 'https://i.imgur.com/GwOoWn9h.jpg ',
 'https://i.imgur.com/gODh17vh.jpg ',
 'https://i.imgur.com/FG9KyUQh.jpg ',
 'https://i.imgur.com/fFH1aOVh.jpg ',
 'https://i.imgur.com/MUmP036h.jpg ',
 'https://i.imgur.com/aOuxAbgh.png ',
 'https://i.imgur.com/ucoyWPwh.jpg ',
 'https://i.imgur.com/b05HpLch.png ',
 'https://i.imgur.com/NBbJ1Lfh.jpg ',
 'https://i.imgur.com/Es3df3oh.jpg ',
 'https://i.imgur.com/K3yI4lyh.jpg ',
 'https://i.imgur.com/XKW28VOh.jpg ',
 'https://i.imgur.com/87LcYAAh.jpg ',
 'https://i.imgur.com/xVCXpPVh.jpg ',
 'https://i.imgur.com/lxbiBpah.jpg ',
 'https://i.imgur.com/V95daFph.jpg ',
 'https://i.imgur.com/d2W3sDyh.jpg ',
 'https://i.imgur.com/9E6y9erh.jpg ',
 'https://i.imgur.com/8Vjyqpvh.jpg ',
 'https://i.imgur.com/XUdcjFsh.jpg ',
 'https://i.imgur.com/ww98APSh.jpg ',
 'https://i.imgur.com/WEKVyKnh.jpg ',
 'https://i.imgur.com/o32AxXNh.jpg ',
 'https://i.imgur.com/3fZnCV7h.jpg ',
 'https://i.imgur.com/6oT4ONvh.jpg ',
 'https://i.imgur.com/MQxKPbth.jpg ',
 'https://i.imgur.com/WjPaXjYh.jpg ',
 'https://i.imgur.com/jUZLwEnh.jpg ',
 'https://i.imgur.com/v8ImRoTh.jpg ',
 'https://i.imgur.com/M4qTDFvh.png ',
 'https://i.imgur.com/4rT4mS6h.jpg ',
 'https://i.imgur.com/J06CZzxh.png ',
 'https://i.imgur.com/9Renalth.jpg ',
 'https://i.imgur.com/5zNyTR9h.png ',
 'https://i.imgur.com/8CsG3avh.jpg '
 ];


var linksZerowaste = ['https://i.imgur.com/wzEG0fnh.jpg ',
 'https://i.imgur.com/ldT12DGh.jpg ',
 'https://i.imgur.com/jKVJPgWh.jpg ',
 'https://i.imgur.com/3Ls8Ppjh.jpg ',
 'https://i.imgur.com/KRwnOUVh.jpg ',
 'https://i.imgur.com/L9WpXfCh.jpg ',
 'https://i.imgur.com/I4cW198h.jpg ',
 'https://i.imgur.com/ozwogIqh.jpg ',
 'https://i.imgur.com/ZQaAvPEh.jpg ',
 'https://i.imgur.com/FUcPvh3h.jpg ',
 'https://i.imgur.com/M1lrTPrh.jpg ',
 'https://i.imgur.com/Ec63ChZh.jpg ',
 'https://i.imgur.com/mCsfBtWh.jpg ',
 'https://i.imgur.com/UWNLxwKh.png ',
 'https://i.imgur.com/YUcTkPWh.jpg ',
 'https://i.imgur.com/LKdnpDhh.jpg ',
 'https://i.imgur.com/rdXJr2yh.jpg ',
 'https://i.imgur.com/4OcqGH7h.png ',
 'https://i.imgur.com/6tZtgf9h.jpg ',
 'https://i.imgur.com/ChQKo8rh.jpg ',
 'https://i.imgur.com/QOUjZRQh.jpg ',
 'https://i.imgur.com/aAAYH9gh.jpg ',
 'https://i.imgur.com/AIR4eIQh.jpg ',
 'https://i.imgur.com/YvpyquRh.jpg ',
 'https://i.imgur.com/BGTcKyMh.jpg ',
 'https://i.imgur.com/m1IrcLNh.jpg ',
 'https://i.imgur.com/EP9D08Lh.jpg ',
 'https://i.imgur.com/HlHRbVWh.jpg ',
 'https://i.imgur.com/c3B2sDAh.jpg ',
 'https://i.imgur.com/C4EqrvNh.jpg ',
 'https://i.imgur.com/S1uaKeOh.jpg ',
 'https://i.imgur.com/YAr0Oy4h.jpg ',
 'https://i.imgur.com/xNwGEMzh.jpg ',
 'https://i.imgur.com/Sv9auv7h.jpg ',
 'https://i.imgur.com/xqT7WL2h.jpg ',
 'https://i.imgur.com/DWksaYWh.jpg ',
 'https://i.imgur.com/7TVEfgQh.jpg ',
 'https://i.imgur.com/K8UlQjAh.jpg ',
 'https://i.imgur.com/V9zPYbbh.gif ',
 'https://i.imgur.com/XdfZXr9h.jpg ',
 'https://i.imgur.com/yb0SpJEh.jpg ',
 'https://i.imgur.com/PdUH01vh.jpg ',
 'https://i.imgur.com/YXJJ9M0h.jpg ',
 'https://i.imgur.com/dPCuze5h.jpg ',
 'https://i.imgur.com/QjlyHAbh.jpg ',
 'https://i.imgur.com/ViBoITAh.jpg ',
 'https://i.imgur.com/SyiRo3Mh.jpg ',
 'https://i.imgur.com/Jk5pAUBh.jpg ',
 'https://i.imgur.com/nzhPcXOh.jpg ',
 'https://i.imgur.com/pfGXEpYh.jpg ',
 'https://i.imgur.com/5lkeRYOh.jpg ',
 'https://i.imgur.com/HhaBZzSh.jpg ',
 'https://i.imgur.com/ZKwxy29h.png ',
 'https://i.imgur.com/KwnwNkFh.jpg ',
 'https://i.imgur.com/zRzluPuh.jpg ',
 'https://i.imgur.com/FepuX0Gh.jpg ',
 'https://i.imgur.com/Qn33yrWh.jpg ',
 'https://i.imgur.com/pvHiqg7h.jpg ',
 'https://i.imgur.com/gpgC3uSh.jpg ',
 'https://i.imgur.com/cMTYM0Xh.jpg ',
 'https://i.imgur.com/z2GYs36h.jpg ',
 'https://i.imgur.com/VV7NFwQh.jpg ',
 'https://i.imgur.com/6tiazS2h.jpg ',
 'https://i.imgur.com/MKky5LOh.jpg ',
 'https://i.imgur.com/JCDTymih.jpg ',
 'https://i.imgur.com/8L9kFr9h.jpg ',
 'https://i.imgur.com/VOacrgqh.png ',
 'https://i.imgur.com/8jgKQksh.jpg ',
 'https://i.imgur.com/1yOlrJGh.jpg ',
 'https://i.imgur.com/hACJ15Th.jpg ',
 'https://i.imgur.com/Vh9ZLw7h.jpg ',
 'https://i.imgur.com/haReVl4h.jpg ',
 'https://i.imgur.com/DyjRnuxh.jpg ',
 'https://i.imgur.com/oFS6ufAh.jpg ',
 'https://i.imgur.com/WbtmoYHh.jpg ',
 'https://i.imgur.com/AIoMYv0h.jpg ',
 'https://i.imgur.com/hN3uJCEh.jpg ',
 'https://i.imgur.com/PgvY3yEh.jpg ',
 'https://i.imgur.com/DJi8S41h.jpg ',
 'https://i.imgur.com/9bepsP5h.jpg ',
 'https://i.imgur.com/f8Tneuyh.jpg ',
 'https://i.imgur.com/kaBCMQ7h.jpg ',
 'https://i.imgur.com/REVapE7h.jpg ',
 'https://i.imgur.com/1YrDImeh.jpg ',
 'https://i.imgur.com/UZILEiRh.jpg ',
 'https://i.imgur.com/ObagwtPh.jpg ',
 'https://i.imgur.com/nVnhimuh.jpg ',
 'https://i.imgur.com/z3QPxUgh.jpg ',
 'https://i.imgur.com/94vgjhCh.jpg ',
 'https://i.imgur.com/tmOk03Nh.jpg ',
 'https://i.imgur.com/CMCwrywh.jpg ',
 'https://i.imgur.com/eC1tUT2h.jpg ',
 'https://i.imgur.com/FIyhlI5h.jpg ',
 'https://i.imgur.com/O1JdCMTh.jpg ',
 'https://i.imgur.com/jGbCzceh.jpg ',
 'https://i.imgur.com/wyCjwSuh.jpg ',
 'https://i.imgur.com/R1sXYi9h.png ',
 'https://i.imgur.com/HHJH4DAh.jpg ',
 'https://i.imgur.com/vPSDKudh.jpg ',
];

var linksSignage = ['https://i.imgur.com/hAQYGunh.png ',
 'https://i.imgur.com/k6ILqJ4h.png ',
 'https://i.imgur.com/bRB7k12h.png ',
 'https://i.imgur.com/MG71pFGh.png ',
 'https://i.imgur.com/nSWgLP4h.png ',
 'https://i.imgur.com/nSWgLP4h.png ',

];

var size = 1800;
var sz2 = size / 2;

var frameCount = 0;
var displayCount = 51;

var cam;
var yOffset = -600;

var voice;

var memesAntofu = [];
var randIndexAntofu = [];
var antofuLocation = [4 * size, yOffset, 0];

var memesClimatememes = [];
var randIndexClimatememes = [];
var climatememesLocatoin = [2 * size, yOffset, 0];

var memesSustainability = [];
var randIndexSustainability = [];
var sustainabilityLoacation = [0, yOffset, 0];

var memesZerowaste = [];
var randIndexZerowaste = [];
var zerowasteLocation = [-2 * size, yOffset, 0];

var imagesSignage = [];

var texCount = 0;


var testArray = [];




function preload () {

    //load images for each space
    for (i = 0; i < linksAntofu.length; i++) {
        var newMeme = loadImage(linksAntofu[i]);
        memesAntofu.push(newMeme);
    }
    for (i = 0; i < linksClimatememes.length; i++) {
        var newMeme = loadImage(linksClimatememes[i]);
        memesClimatememes.push(newMeme);
    }
    for (i = 0; i < linksSustainability.length; i++) {
        var newMeme = loadImage(linksSustainability[i]);
        memesSustainability.push(newMeme);
    }
    for (i = 0; i < linksZerowaste.length; i++) {
        var newMeme = loadImage(linksZerowaste[i]);
        memesZerowaste.push(newMeme);
    }
    for (i = 0; i < linksSignage.length; i++) {
        var newSign = loadImage(linksSignage[i]);
        imagesSignage.push(newSign);
    }
    

}


function setup() {
    createCanvas(1000, 700, WEBGL);
    cam = createCamera();

    //creates arrays of raondom index values for each space
    for (i = 0; i < displayCount; i++) {
            var newIndex1 = round(random(0, memesSustainability.length)); 
            randIndexSustainability.push(newIndex1);

            var newIndex2 = round(random(0, memesClimatememes.length)); 
            randIndexClimatememes.push(newIndex2);

            var newIndex3 = round(random(0, memesAntofu.length));
            randIndexAntofu.push(newIndex3);

            var newIndex4 = round(random(0, memesZerowaste.length));
            randIndexZerowaste.push(newIndex4);
    }
    

    
}

function boxGrid(w, d, tex, randIndex) {
    //divides left and right walls into grid of boxes w/ opening for door
    var indexCount = 0;
    push();
    for (var ix = 0; ix < 2; ix ++){
        push();
        for (var iy = 0; iy < 9; iy ++){
            translate(0, 0, size / 4.5);
            if (indexCount == 13) {
                noFill();
            }
            else {
                texture(tex[randIndex[texCount]]);
                box(w, size /2, d);
            }
            texCount ++
            indexCount ++
        }
        pop();
        translate(0, size / 2, 0);
    }
    pop();

}


function subSpace (tex, randIndex, x, y, z) {
    //creates the geometry for each space
    push();
    translate(x, y, z);
    texCount = 0;

    noStroke();

    //floor
    texture(tex[randIndex[texCount]]);
    push();
    translate(0, sz2, sz2);
    box(size, 20, 2 * size);
    texCount ++
    pop();

    //back wall
    texture(tex[randIndex[texCount]]);
    push();
    translate(0, 0, 3 * sz2);
    box(-size, size, -20);
    texCount++
    texture(tex[randIndex[texCount]]);
    translate(0, -size, 0);
    box(size, size, 20);
    texCount++
    pop();

    //front wall
    texture(tex[randIndex[texCount]]);
    push();
    translate(0, 0, -sz2);
    box(size, size, 20);
    texCount++
    texture(tex[randIndex[texCount]]);
    translate(0, -size, 0);
    box(size, size, 20);
    texCount++
    pop();

    //right wall
    push();
    translate(sz2, -sz2 + (size / 4), -sz2 - (size / 9));
    boxGrid(20, size / 4.5, tex, randIndex);
    texCount++
    pop();

    //left wall
    push();
    translate(-sz2, -sz2 + (size / 4), -sz2 - (size / 9));
    boxGrid(-20, -size / 4.5, tex, randIndex);
    pop();

    //roof
    push();
    translate(-sz2 + size / 10, -sz2 - size/10, sz2);
    for (i = 0; i < 7; i++) {
        box(size/5, size/5, 2 * size);
        texture(tex[randIndex[texCount]]);
        if (i <= 1) {
            translate(size/5, -size/5, 0);            
        }
        else {
            translate(size/5, size/5, 0);    
        }
        texCount++
    }
    pop();



    pop();

}

function hallSpace(sign, x, y, z) {
    //creates geometry for the halls and associated signage
    var wHall = size / 4.5;
    var lHall = size;
    var hHall = size / 3;
    var wHall2 = wHall / 2;
    var lHall2 = lHall / 2;
    var hHall2 = hHall / 2;

    push();
    translate(x, y + hHall, z);
    fill(255);
    noStroke();

    //ceiling
    push();
    translate(0, -hHall2 - 9, 0);
    box(lHall + 16, 20, wHall);
    pop();
    
    //floor
    push();
    translate(0, hHall2 + 9, 0);
    box(lHall + 16, -20, wHall);
    pop();

    //front wall
    push();
    translate(0, 0, -wHall2 - 9);
    box(lHall + 16, hHall, -20);
    pop();

    //back wall
    push();
    translate(0, 0, wHall2 + 9);
    box(lHall + 16, hHall, 20);
    pop();

    //signage 1
    push();
    translate(lHall2 + 10, - hHall2 - size / 12, 0);
    -texture(imagesSignage[sign]);
    box(-10, size / 6, -size / 4.5);

    pop();

    //signage 2
    push();
    translate(-lHall2 - 10, -hHall2 - size / 12, 0);
    texture(imagesSignage[sign + 1]);
    box(10, size / 6, size / 4.5);
    pop();

    pop();

}


function moveFunction () {
    //allows camera to be moved with keyboard

    boundaryFunction();
    var dx = 8;
    var dz = 8;

    var px = 0.02;
    var py = 0.02;

    //move left
    if (keyIsDown(65)) {
        cam.move(-dx, 0, 0);
    }
    //move right
    if (keyIsDown(68)) {
        cam.move(dx, 0, 0);
    }
    //move back
    if (keyIsDown(83)) {
        cam.move(0, 0, dz);
    }
    //move forward
    if (keyIsDown(87)) {
        cam.move(0, 0, -dz);
    }
    
    //camera rotate left
    if (keyIsDown(LEFT_ARROW)) {
        cam.pan(px);
    }
    //camera rotate right
    if (keyIsDown(RIGHT_ARROW)) {
        cam.pan(-px);
    }
    //camera rotate down
    if (keyIsDown(DOWN_ARROW)) {
        cam.tilt(py);
    }
    //camera rotate up
    if (keyIsDown(UP_ARROW)) {
        cam.tilt(-py);
    }
    //maintains camera at the same height allways
    cam.eyeY = 0;
}

function boundaryFunction() {
    //stops user form passing through walls
    if (cam.eyeX > -5 * sz2 & cam.eyeX < -3 * sz2) {
        if (cam.eyeZ < - 0.8 * sz2) {
            cam.eyeZ = - 0.8 * sz2
        }
        if (cam.eyeZ > 2.8 * sz2) {
            cam.eyeZ = 2.8 * sz2;
        }
        if (cam.eyeZ < (sz2 - size / 9) || cam.eyeZ > (sz2 + size / 9)) {
            if (cam.eyeX < -4.8 * sz2) {
                cam.eyeX = -4.8 * sz2;

            }
            if (cam.eyeX > -3.2 * sz2) {
                cam.eyeX = -3.2 * sz2;
            }
        }
    }
    else if (cam.eyeX > -sz2 & cam.eyeX < sz2) {
        if (cam.eyeZ < - 0.8 * sz2) {
            cam.eyeZ = - 0.8 * sz2
        }
        if (cam.eyeZ > 2.8 * sz2) {
            cam.eyeZ = 2.8 * sz2;
        }
        if (cam.eyeZ < (sz2 - size / 9) || cam.eyeZ > (sz2 + size / 9)) {
            if (cam.eyeX < -0.8 * sz2) {
                cam.eyeX = -0.8 * sz2;

            }
            if (cam.eyeX > 0.8 * sz2) {
                cam.eyeX = 0.8 * sz2;
            }
        }
        
    }
    else if (cam.eyeX > 3 * sz2 & cam.eyeX < 5 *sz2) {
        if (cam.eyeZ < - 0.8 * sz2) {
            cam.eyeZ = - 0.8 * sz2
        }
        if (cam.eyeZ > 2.8 * sz2) {
            cam.eyeZ = 2.8 * sz2;
        }
        if (cam.eyeZ < (sz2 - size / 9) || cam.eyeZ > (sz2 + size / 9)) {
            if (cam.eyeX < 3.2 * sz2) {
                cam.eyeX = 3.2 * sz2;

            }
            if (cam.eyeX > 4.8 * sz2) {
                cam.eyeX = 4.8 * sz2;
            }
        }

    }
    else if (cam.eyeX > 7 * sz2 & cam.eyeX < 9 *sz2) {
        if (cam.eyeZ < - 0.8 * sz2) {
            cam.eyeZ = - 0.8 * sz2
        }
        if (cam.eyeZ > 2.8 * sz2) {
            cam.eyeZ = 2.8 * sz2;
        }
        if (cam.eyeZ < (sz2 - size / 9) || cam.eyeZ > (sz2 + size / 9)) {
            if (cam.eyeX < 7.2 * sz2) {
                cam.eyeX = 7.2 * sz2;

            }
            if (cam.eyeX > 8.8 * sz2) {
                cam.eyeX = 8.8 * sz2;
            }
        }

    }
    else {
        if (cam.eyeZ < (sz2 + 60 - size / 9)) {
            cam.eyeZ = (sz2 + 60 - size / 9)
        }
        if (cam.eyeZ > (sz2 - 60 + size / 9)){
            cam.eyeZ = (sz2 - 60 + size / 9);
        }
        if (cam.eyeX < - 6.5 * sz2) {
            cam.eyeX = - 6.5 * sz2;
        }
        if (cam.eyeX >  10.5 * sz2) {
            cam.eyeX =  10.5 * sz2;
        }

    }


}

function frameCounter() {
    //generates new random array of indexes to display new imagery every 450 frames
    frameCount++

    if (frameCount % 450 == 0) {
        for (i = 0; i < displayCount; i++) {
            var newIndex1 = round(random(0, memesSustainability.length)); 
            randIndexSustainability.shift();
            randIndexSustainability.push(newIndex1);

            var newIndex2 = round(random(0, memesClimatememes.length)); 
            randIndexClimatememes.shift();
            randIndexClimatememes.push(newIndex2);

            var newIndex3 = round(random(0, memesAntofu.length)); 
            randIndexAntofu.shift();
            randIndexAntofu.push(newIndex3);

            var newIndex4 = round(random(0, memesZerowaste.length)); 
            randIndexZerowaste.shift();
            randIndexZerowaste.push(newIndex4);

        }
    }
}

function draw() {
    background(190, 220, 255);
    //draw spaces
    hallSpace(4, -3 * size, yOffset, size / 2);
    subSpace(memesZerowaste, randIndexZerowaste, zerowasteLocation[0], zerowasteLocation[1], zerowasteLocation[2]);
    hallSpace(0, -size, yOffset, size / 2);
    subSpace(memesSustainability, randIndexSustainability, sustainabilityLoacation[0], sustainabilityLoacation[1], sustainabilityLoacation[2]);
    hallSpace(1, size, yOffset, size / 2);
    subSpace(memesClimatememes, randIndexClimatememes, climatememesLocatoin[0], climatememesLocatoin[1], climatememesLocatoin[2]);
    hallSpace(2, 3 * size, yOffset, size / 2);
    subSpace(memesAntofu, randIndexAntofu, antofuLocation[0], antofuLocation[1], antofuLocation[2]);
    hallSpace(4, 5 * size, yOffset, size / 2);

    //allows movement
    moveFunction();
    //generates new random index arrays
    frameCounter(); 
}

With my project I attempted to create a spatial-visual representation of different online discourses and imagery surrounding climate change. I used four sets of images scraped from four different subreddits relating to climate change r/ZeroWaste r/Sustainability, r/ClimateMemes, and r/Antofu. These subreddits all have different ideological tendencies that inform people’s discussions of climate change. If I had more time for this project I would have liked to incorporate some of the individual character of the subreddits into the geometry of the spaces and I would have liked to add some minimal contextualizing text that displays as an overlay when moving from one subredddit space to another in order to add some of my own opinions to frame the experience of each space.

To move through the space use WASD
To rotate the camera use the Arowkeys

Leave a Reply