@@ -0,0 +1,21 @@ | |||
MIT License | |||
Copyright (c) 2017 hbksaar | |||
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 conditions: | |||
The above copyright notice and this permission notice shall be included in all | |||
copies or substantial portions of the Software. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
SOFTWARE. |
@@ -0,0 +1,254 @@ | |||
import processing.video.*; | |||
import ddf.minim.*; | |||
import processing.opengl.*; | |||
import processing.net.*; | |||
int port = 50000; | |||
Server myServer; | |||
PApplet app; //technically needed to create movie instances inside of a class | |||
PImage blob; | |||
boolean debug = false; //new: activate it to see the movies in the background | |||
WordedImageLayer[] layers = new WordedImageLayer[4]; | |||
Minim minim; | |||
AudioPlayer song; | |||
Button []button= new Button[8]; | |||
PFont f; | |||
PFont f1; | |||
PFont f2; | |||
Text[] t1, t2, t3; | |||
Stock[]stocks= new Stock[26]; | |||
float totalW =0 ; | |||
float totalH=0; | |||
int wordCount = 26; | |||
boolean start=false; | |||
boolean level1=false; | |||
boolean level2=false; | |||
boolean level3=false; | |||
boolean level4=false; | |||
boolean screen; | |||
boolean win; | |||
PImage Buttona, Button11, Button1, Button2, Button12, ButtonMovie; | |||
int laserX, laserY; | |||
void movieEvent(Movie m) { | |||
m.read(); | |||
} | |||
Movie door; | |||
void setup() { | |||
size(2000, 300, P3D); | |||
myServer = new Server(this, port); | |||
door = new Movie (this, "part1.mov"); | |||
//doorclicked = new Movie (this, "part2.mov"); | |||
door.play(); | |||
blob = loadImage("blob.png"); | |||
app = this; | |||
layers[0] = new WordedImageLayer("0.mov", "door", 0, 100, 10); | |||
layers[1] = new WordedImageLayer("3.mov", "door", 0, 10, 40); | |||
layers[2] = new WordedImageLayer("wave15.mov", "DOOR", 0, 20, 30); //new: make threshold a negative number to inverse it. | |||
layers[3] = new WordedImageLayer("4.mov", "DOOR", 0, 100, 34); | |||
//layers[4] = new WordedImageLayer("4.mov", "DOOR", 0, 100, 20); | |||
//layers[5] = new WordedImageLayer("5.mov", "smoke", 0, 200, 7); | |||
layers[0].togglePlaying(); | |||
layers[1].startPlaying(); | |||
layers[1].stopPlaying(); | |||
layers[2].togglePlaying(); | |||
layers[3].togglePlaying(); | |||
minim= new Minim(this); | |||
// you have to change the name of the sound and drog and drop in the sketch | |||
song =minim.loadFile ("door24.mp3"); | |||
float x = 0; | |||
float y=0; | |||
f= createFont("Monospaced-48", 10); | |||
f1 = loadFont("Avenir-Roman-48.vlw"); | |||
f2= loadFont("SansSerif-48.vlw"); | |||
Button1 = loadImage("Button1.png"); | |||
Button2 = loadImage("Button2.png"); | |||
Buttona = loadImage("Buttona.png"); | |||
Button11 = loadImage("Button11.png"); | |||
Button12 = loadImage("Button12.png"); | |||
ButtonMovie = createImage(door.width, door.height, ARGB); | |||
button[0]= new Button (250, 200, 100, Buttona.width/10, Buttona.height/10, 1, Buttona, "intro"); | |||
button[1]=new Button (100, 100, 100, Button11.width/10, Button11.height/10, 1, Button11, "virus"); | |||
button[2]=new Button (200, 150, 100, Button1.width/10, Button1.height/10, 1, Button1, "sound"); | |||
button[3]=new Button (10, 250, 100, Button2.width/10, Button2.height/10, 1, Button2, "color"); | |||
button[4]=new Button (350, 150, 100, Button12.width/10, Button12.height/10, 1, Button12, "levelone"); | |||
button[5]=new Button (250, 10, 100, Buttona.width/10, Buttona.height/10, 2, Buttona, "leveltwo"); | |||
button[7]=new Button (350, 210, 100, Buttona.width/10, Buttona.height/10, 2, Buttona, "leveltree"); | |||
//bouton door !!666 | |||
button[6]=new Button (100, 100, 100, ButtonMovie.width/5, ButtonMovie.height/5, 1, ButtonMovie, "doorbutton"); | |||
t1=new Text [wordCount]; | |||
t2=new Text [wordCount]; | |||
t3=new Text [wordCount]; | |||
for (int i=0; i< wordCount; i++) { | |||
t1[i]=new Text ("DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR ", 0, 30*i, -30, 1); | |||
t2[i]=new Text ("DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR ", 0, 30*i, -10, 1); | |||
t3[i]=new Text ("DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR DOOR ", 0, 30*i, 10, 2); | |||
} | |||
for (int j = 0; j < stocks.length; j++) { | |||
stocks[j]= new Stock("DOOR DOOR DOOR DOOR DOOR", 100, 30, -100, 1); | |||
} | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].setX(x); | |||
x = x + (stocks[i].textW()); | |||
y = y + (stocks[i].textH()); | |||
} | |||
totalH = y; | |||
totalW = x; | |||
start = true; | |||
level1 = true; | |||
} | |||
void draw() { | |||
background(0); | |||
getLaser(); | |||
try { | |||
if ((!start)) { | |||
if (!screen) { | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].move(); | |||
stocks[i].display(); | |||
} | |||
if (!screen) { | |||
button[0].display(); | |||
button[0].move(); | |||
// println("je suis la"); | |||
} | |||
} | |||
textAlign(LEFT); | |||
//textSize(40); | |||
textFont(f2); | |||
textLeading(10); | |||
String s= "FIND THE DOOR !"; | |||
String h="click on the button to start..."; | |||
String d="But...Can you find the good one?"; | |||
text(s, 200, 50); | |||
textSize(30); | |||
text(h, 200, 110); | |||
text(d, 200, 160); | |||
} else if ((!level1)) { | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].move(); | |||
stocks[i].display(); | |||
} | |||
for (int i =0; i<wordCount; i++) { | |||
t1[i].display(); | |||
t2[i].display(); | |||
t3[i].display(); | |||
t1[i].move(); | |||
t2[i].move(); | |||
t3[i].move(); | |||
t1[i].interact(); | |||
t2[i].interact(); | |||
t3[i].interact(); | |||
} | |||
button[1].display(); | |||
button[1].move(); | |||
button[2].display(); | |||
button[2].move(); | |||
button[3].display(); | |||
button[3].move(); | |||
if (!screen) { | |||
button[4].display(); | |||
button[4].move(); | |||
} | |||
} else if ((!level2)) { | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].move(); | |||
stocks[i].display(); | |||
} | |||
layers[1].update(); | |||
layers[0].update(); | |||
button[4].display(); | |||
button[4].move(); | |||
button[5].display(); | |||
button[5].move(); | |||
println("level1"); | |||
} | |||
else if ((!level3)) { | |||
button[6].display(); | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].move(); | |||
stocks[i].display(); | |||
} | |||
layers[2].update(); | |||
if (!screen) { | |||
println("level2"); | |||
button[5].display(); | |||
button[5].move(); | |||
button[7].display(); | |||
button[7].move(); | |||
} | |||
} else if ((!level4)) { | |||
for (int i = 0; i < stocks.length; i++) { | |||
stocks[i].move(); | |||
stocks[i].display(); | |||
} | |||
button[5].display(); | |||
button[5].move(); | |||
println("reviens"); | |||
button[7].display(); | |||
button[7].move(); | |||
println("level3"); | |||
layers[3].update();}} | |||
catch (Exception a) { | |||
} | |||
if (door.time() >= door.duration()) { | |||
replay(); | |||
} | |||
} | |||
void mousePressed() { | |||
for (int i=0; i< button.length; i++) { | |||
if (button[i].hover()) { | |||
button[i].clicked(); | |||
} | |||
} | |||
for (int i = 0; i < layers.length; i++) { | |||
if (layers[i].hover()) { | |||
println("Clicked layer " + i + "!"); | |||
//you could call the following function with a button. (are there really going to be buttons in final version?) | |||
layers[i].togglePlaying(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,94 @@ | |||
class Button { | |||
int x, y, z, w, h; | |||
int xspeed; | |||
PImage img; | |||
String WhatToDo; | |||
boolean hover() { | |||
if (laserX>x && laserX< x +w&& laserY>y && laserY<y+h) { | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} | |||
Button (int X, int Y, int Z, int W, int H, int Xspeed, PImage Img, String WTD) { | |||
x= X; | |||
y = Y; | |||
z=Z; | |||
xspeed=Xspeed; | |||
w = W; | |||
h = H; | |||
img = Img.get(); | |||
WhatToDo = WTD; | |||
} | |||
void clicked() { | |||
if (WhatToDo.equals("color")) { | |||
for (int i=0; i< t1.length; i++) { | |||
t1[i].apparition(); | |||
t2[i].apparition(); | |||
t3[i].apparition(); | |||
stocks[i].apparition(); | |||
} | |||
} | |||
if (WhatToDo.equals("virus")) { | |||
for (int i=0; i< t1.length; i++) { | |||
t1[i].crazy(); | |||
t2[i].crazy(); | |||
t3[i].crazy(); | |||
} | |||
} | |||
if (WhatToDo.equals("sound")) { | |||
song =minim.loadFile ("door24.mp3"); | |||
song.play(); | |||
} | |||
if (WhatToDo.equals("intro")) { | |||
start = true; | |||
} | |||
if (WhatToDo.equals("levelone")) { | |||
level1 =! level1; | |||
} | |||
if (WhatToDo.equals("leveltwo")) { | |||
level2 =! level2; | |||
} | |||
if (WhatToDo.equals("leveltree")) { | |||
level3 =! level3; | |||
} | |||
if (WhatToDo.equals("doorbutton")) { | |||
//THIS IS THE GAMES ENDING!! YOU CLICKED THE DOOR!! WHAT HAPPENS NOW? | |||
win = true; | |||
//play second door video. | |||
door.stop(); | |||
door = new Movie (app, "part2.mov"); | |||
door.play(); | |||
} | |||
} | |||
void display() { | |||
if (WhatToDo.equals("doorbutton")) { | |||
img = door.get(); | |||
println(img.width); | |||
} | |||
image(img, x, y, w, h); | |||
} | |||
void randomPosition() { | |||
x = int(random(0, width - w)); | |||
y = int(random(0, height - h)); | |||
} | |||
void move() { | |||
x=x+xspeed; | |||
if (x < 0 || x > width-w) { | |||
xspeed=-xspeed; | |||
} | |||
} | |||
} |
@@ -0,0 +1,84 @@ | |||
class WordedImageLayer { | |||
Movie sourceMovie; | |||
PGraphics canvas; | |||
PImage getmov; | |||
PImage mov; | |||
String word; | |||
String movFileName; | |||
boolean inverse; | |||
boolean hover; | |||
boolean isPlaying; | |||
int threshold; | |||
int detailfactor; | |||
int movX; | |||
int movY = 0; | |||
int movW; | |||
int movH; | |||
WordedImageLayer(String MovName, String Word, int X, int thresh, int Factor) { | |||
movFileName = MovName; | |||
word = Word; | |||
movX = X; | |||
threshold = thresh; | |||
detailfactor = Factor; | |||
sourceMovie = new Movie(app, movFileName); | |||
} | |||
void startPlaying() { //new- | |||
sourceMovie.loop(); | |||
isPlaying = true; | |||
} | |||
void stopPlaying() { //-functions- | |||
sourceMovie.stop(); | |||
isPlaying = false; | |||
} | |||
void togglePlaying() { //-yay! | |||
if (isPlaying) | |||
stopPlaying(); | |||
else | |||
startPlaying(); | |||
} | |||
boolean hover() { | |||
if (laserX > movX && laserX < movX + movW && laserY > movY && laserY < movY + movH) | |||
return true; | |||
else | |||
return false; | |||
} | |||
void update() { | |||
if (isPlaying) { //new! check if isplaying. so you can just keep the for loops that update every video. it will break here if the video shall not be running. | |||
try { | |||
mov = sourceMovie.get(); | |||
mov.resize(0, height); | |||
movW = mov.width; | |||
movH = mov.height; | |||
canvas = createGraphics(movW, movH); | |||
canvas.beginDraw(); | |||
canvas.imageMode(CORNER); | |||
canvas.image(mov, 0, 0, canvas.width, canvas.height); | |||
canvas.imageMode(CENTER); | |||
canvas.image(blob, laserX-movX, laserY, height/3, height/3); | |||
mov = canvas.get(); | |||
canvas.endDraw(); | |||
mov.resize(0, height/detailfactor); | |||
if (debug) { | |||
tint(255, 60); | |||
image(canvas, movX, 0); | |||
tint(255, 255); | |||
} | |||
mov.loadPixels(); | |||
for (int i=0; i<mov.pixels.length; i++ ) { | |||
int col = mov.pixels[i]; | |||
if (brightness(col) > threshold) { | |||
//int x = i%mov.width*detailfactor; | |||
int x = int(map(i%mov.width*detailfactor, 0, mov.width, 0, movW/detailfactor)); //new! fixes a bug where the cursor was out of place | |||
int y = i/mov.width*detailfactor+10; | |||
text(word, x+movX, y); | |||
} | |||
} | |||
} | |||
catch (Exception e) { | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
class Stock { | |||
String w; // Name | |||
int val; // Value | |||
float x; // x position | |||
float y; | |||
float z; | |||
int xspeed; | |||
color colorw =255 ; | |||
String display; | |||
boolean colorActif; | |||
Stock(String tempw, float xpos, float tempz, float ypos, int Xspeed) { | |||
w= tempw; | |||
z=tempz; | |||
x=xpos; | |||
y=ypos; | |||
xspeed=Xspeed; | |||
// Concatenate the name, value and some spaces | |||
display = w + " " ; | |||
} | |||
// A function to set x position | |||
void setX(float x_) { | |||
x = x_; | |||
} | |||
void display() { | |||
for (int i = 0; i < stocks.length; i++) { | |||
fill(colorw); | |||
textFont(f); | |||
text(display, x, height-25*i); | |||
} | |||
if (colorActif) { | |||
for (int i = 0; i < stocks.length; i++) { | |||
fill( int(random(2))*255, int(random(2))*255, int(random(2))*255); | |||
textFont(f); | |||
text(display, x, height-25*i); | |||
} | |||
} | |||
} | |||
float textW() { | |||
textFont(f); | |||
return textWidth(display); | |||
} | |||
float textH() { | |||
textFont(f); | |||
return textAscent() + textDescent(); | |||
} | |||
void move() { | |||
x = x - 1; | |||
y= y-1; | |||
if (x < width-totalW && y < height-totalH) { | |||
x = width; | |||
y= height; | |||
} | |||
} | |||
void apparition() { | |||
colorActif =! colorActif; | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
class Text { | |||
String w; | |||
int x; | |||
int y; | |||
int z; | |||
color colorw =color( random(0, 255)) ; | |||
int xspeed; | |||
float textw; | |||
float texth; | |||
boolean colorActif; | |||
boolean mouseHover; | |||
boolean zoomVirus; | |||
Text(String tempw, int tempx, int tempy, int tempz,int tempxspeed) { | |||
xspeed= tempxspeed; | |||
w=tempw; | |||
x=tempx; | |||
y=tempy; | |||
z=tempz; | |||
} | |||
void display() { | |||
if (!mouseHover) { | |||
textw= textWidth(w); | |||
texth = textAscent() + textDescent(); | |||
fill(255); | |||
textFont(f1, 20); | |||
text(w, x, y,z); | |||
} | |||
if (colorActif) { | |||
fill( int(random(2))*255, int(random(2))*255, int(random(2))*255); | |||
textFont(f1, 20); | |||
text(w, x, y,z); | |||
} | |||
if (zoomVirus) { | |||
textSize(30); | |||
//textLeading(150); | |||
fill(0); | |||
text(w, x, y,0); | |||
} | |||
} | |||
void move() { | |||
y=y+xspeed; | |||
if (( y < height) && (y < 0) || (y > height) && ( y> height)) { | |||
xspeed=-xspeed; | |||
} | |||
} | |||
//interaction word dissapear | |||
void interact() { | |||
if (laserX > x && laserX < x+textw && laserY > y && laserY < y+texth) { | |||
mouseHover =! mouseHover; | |||
} | |||
} | |||
//interaction button color/stop and play. | |||
void apparition() { | |||
if (mousePressed) { | |||
colorActif =! colorActif; | |||
} | |||
} | |||
void crazy() { | |||
if (mousePressed) { | |||
zoomVirus =! zoomVirus; | |||
} | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
void replay() { | |||
/* | |||
instead of using loop. this way we can do stuff when the movie restarts without | |||
nasty frame calculation or duration / time comparison (there is a movie.duration() and movie.time() function) | |||
*/ | |||
door.stop(); | |||
if (!win) { | |||
button[6].randomPosition(); | |||
door.play(); | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
void getLaser() { | |||
Client thisClient = myServer.available(); | |||
if (thisClient !=null) { | |||
String whatClientSaid = thisClient.readString(); | |||
if (whatClientSaid != null) { | |||
String[] x = splitTokens(whatClientSaid, "(), "); | |||
//float(x[0]) = PVector1, float(x[1]) = PVector2, float(x[2]) = PVector3 | |||
try { | |||
float p1 = float(x[0]); | |||
float p2 = float(x[1]); | |||
float p3 = float(x[2]); | |||
if (p1 == 3.5) { | |||
laserX = int(map(p3, -2.3, 2.3, width/5*2, width/5*3)); | |||
} else { | |||
if (p3 < 0) { | |||
laserX = int(map(p1, -3.5, 3.5, 0, width/5*2)); | |||
} else { | |||
laserX = int(map(p1, 3.5, -3.5, width/5*3, width)); | |||
} | |||
} | |||
laserY = int(map(p2, 1, 4, height, 0)); | |||
laserX = int(map(constrain(laserX, 0, width),0,width,width,0)); | |||
laserY = constrain(laserY, 0, height); | |||
println(p1, p2, p3); | |||
} | |||
catch(Exception e) { | |||
} | |||
println(laserX, laserY); | |||
} | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
A button class for creating buttons with individual position, image and action. | |||
The action to run is determined by its name. | |||
``` | |||
Button( | |||
int X, //x-position | |||
int Y, //y-position | |||
int W, //width | |||
int H, //height | |||
String Img, //image name (image must be in data-folder) | |||
String WTD // what to do - every button carries all functions you want to be able to call. which function gets called is selected by the buttons name. THIS IS DIRTY, implement arraylist if you like, or some fancy case-table.. oh well | |||
) | |||
``` |
@@ -0,0 +1,66 @@ | |||
//what does a cool button need? | |||
//either trigger or bang | |||
//bang: call a function on click | |||
//trigger: toggle a boolean on click | |||
//image | |||
Button[] button = new Button[3]; | |||
void setup() { | |||
size(300, 300); | |||
button[0] = new Button(10, 10, 100, 100, "Button8.png", "print"); | |||
button[1] = new Button(200, 100, 100, 100, "Button1.png", "switchdoormovie"); | |||
button[2] = new Button(200, 100, 100, 100, "Button1.png", "toggle random movement"); | |||
fill(255); | |||
} | |||
void draw() { | |||
background(0); | |||
for (int i = 0; i < button.length; i++) { | |||
button[i].display(); | |||
} | |||
} | |||
void mousePressed() { | |||
for (int i = 0; i < button.length; i++) { | |||
if (button[i].hover()) | |||
button[i].clicked(); | |||
} | |||
} | |||
class Button { | |||
int x, y, w, h; | |||
String WhatToDo; | |||
PImage img; | |||
boolean hover() { | |||
if (mouseX > x && mouseX < x + w && | |||
mouseY > y && mouseY < y + h) { | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} | |||
Button(int X, int Y, int W, int H, String Img, String WTD) { | |||
x = X; | |||
y = Y; | |||
w = W; | |||
h = H; | |||
img = loadImage(Img); | |||
WhatToDo = WTD; | |||
} | |||
void clicked() { | |||
if (WhatToDo.equals("color")) { | |||
//call color functions shizzle | |||
} else if (WhatToDo.equals("print")) { | |||
println("Clicked!"); | |||
} else if (WhatToDo.equals("something")){ | |||
} else if (WhatToDo.equals("movieToggle5")){ | |||
// layers[5].togglePlay(): | |||
} | |||
} | |||
void display() { | |||
image(img, x, y, w, h); | |||
} | |||
} |
@@ -0,0 +1 @@ | |||
Basic netsocket setup for processing. Made to receive the position of the laserpoint. |
@@ -0,0 +1,44 @@ | |||
import processing.net.*; | |||
int port = 50000; | |||
Server myServer; | |||
void setup() | |||
{ | |||
size(300,300); | |||
background(0); | |||
myServer = new Server(this, port); | |||
} | |||
void draw() | |||
{ | |||
getLaser(); | |||
} | |||
int laserX,laserY; | |||
void getLaser() { | |||
Client thisClient = myServer.available(); | |||
if (thisClient !=null) { | |||
String whatClientSaid = thisClient.readString(); | |||
if (whatClientSaid != null) { | |||
String[] x = splitTokens(whatClientSaid, "(), "); | |||
//potentially add try and catch here if the client is not in synch | |||
float p1 = float(x[0]); | |||
float p2 = float(x[1]); | |||
float p3 = float(x[2]); | |||
if (p1 == 3.5) { | |||
laserX = int(map(p3, -2.3, 2.3, width/5*2, width/5*3)); | |||
} else { | |||
if (p3 < 0) { | |||
laserX = int(map(p1, -3.5, 3.5, 0, width/5*2)); | |||
} else { | |||
laserX = int(map(p1, 3.5, -3.5, width/5*3, width)); | |||
} | |||
} | |||
laserY = int(map(p2, 4, 1, 0, height)); | |||
laserX = constrain(laserX, 0, width); | |||
laserY = constrain(laserY, 0, height); | |||
} | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
Processing 3 Class that renders a Movie or Image in a PGraphic, looping through each pixel, determining its brightness value. | |||
If the brightness of a pixel is above / below a threshold, it writes a text on the pixel. | |||
``` | |||
WordedImageLayer( | |||
String MovName, //movie to load | |||
String Word, //word to write on pixel | |||
int X, //x-position of the movie on media-theatre screen | |||
int thresh, //brightness-threshold | |||
int Factor //level of detail - the higher, the more pixelated (less words) | |||
) | |||
``` |
@@ -0,0 +1,153 @@ | |||
import processing.video.*; | |||
PApplet app; //technically needed to create movie instances inside of a class | |||
PImage blob; | |||
boolean debug = false; //new: activate it to see the movies in the background | |||
WordedImageLayer[] layers = new WordedImageLayer[7]; | |||
void movieEvent(Movie m) { | |||
m.read(); | |||
} | |||
void setup() { | |||
size(1536, 230); | |||
textAlign(CENTER); | |||
fill(255); | |||
blob = loadImage("blob.png"); | |||
app = this; | |||
/* new: | |||
you don't need to load the movie seperately from the layer-class anymore. it loads the video itself now yay :) just give the filename as first argument. | |||
(changed first argument from Movie-type to String-type, added movie constructor to class) | |||
*/ | |||
layers[0] = new WordedImageLayer( | |||
"0.mov", //String, the name of the movie file we want to load in. | |||
"word", //String, the word it should use to write over the movie. | |||
0, //Integer, horizontal X-position. vertical position doesn't matter, the videos are always stretched over the whole height | |||
10, //Integer, brightness-threshold. look up what a threshold is if you don't know it. min: 0, max: 255. if it's 30 it will write the word for every pixel in the video that is less bright than 30 | |||
15 //Integer, level of detail. the higher the number, the less detail | |||
); | |||
layers[1] = new WordedImageLayer("1.mov", "door", 1000, 40, 3); | |||
layers[2] = new WordedImageLayer("2.mov", "a", 0, 10, 10); //new: make threshold a negative number to inverse it. | |||
layers[3] = new WordedImageLayer("3.mov", "water", 0, 10, 4); | |||
layers[4] = new WordedImageLayer("4.mov", "wave", 0, 100, 20); | |||
layers[5] = new WordedImageLayer("5.mov", "smoke", 0, 200, 7); | |||
layers[6] = new WordedImageLayer("6.mov", "smoke", 0, 200, 7); | |||
/* new functions: | |||
startPlaying, stopPlaying, togglePlaying | |||
*/ | |||
layers[0].startPlaying(); | |||
// layers[1].startPlaying(); | |||
// layers[2].startPlaying(); | |||
// layers[3].startPlaying(); | |||
// layers[4].startPlaying(); | |||
// layers[5].startPlaying(); | |||
} | |||
void draw() { | |||
background(0); | |||
for (int i = 0; i < layers.length; i++) { | |||
layers[i].update(); | |||
} | |||
} | |||
void mousePressed() { | |||
for (int i = 0; i < layers.length; i++) { | |||
if (layers[i].hover()) { | |||
println("Clicked layer " + i + "!"); | |||
//you could call the following function with a button. (are there really going to be buttons in final version?) | |||
layers[i].togglePlaying(); | |||
} | |||
} | |||
} | |||
class WordedImageLayer { | |||
Movie sourceMovie; | |||
PGraphics canvas; | |||
PImage getmov; | |||
PImage mov; | |||
String word; | |||
String movFileName; | |||
boolean inverse; | |||
boolean hover; | |||
boolean isPlaying; | |||
int threshold; | |||
int detailfactor; | |||
int movX; | |||
int movY = 0; | |||
int movW; | |||
int movH; | |||
WordedImageLayer(String MovName, String Word, int X, int thresh, int Factor) { | |||
movFileName = MovName; | |||
word = Word; | |||
movX = X; | |||
threshold = thresh; | |||
detailfactor = Factor; | |||
sourceMovie = new Movie(app, movFileName); | |||
} | |||
void startPlaying() { //new- | |||
sourceMovie.loop(); | |||
isPlaying = true; | |||
} | |||
void stopPlaying() { //-functions- | |||
sourceMovie.stop(); | |||
isPlaying = false; | |||
} | |||
void togglePlaying() { //-yay! | |||
if (isPlaying) | |||
stopPlaying(); | |||
else | |||
startPlaying(); | |||
} | |||
boolean hover() { | |||
if (mouseX > movX && mouseX < movX + movW && mouseY > movY && mouseY < movY + movH) | |||
return true; | |||
else | |||
return false; | |||
} | |||
void update() { | |||
if (isPlaying) { //new! check if isplaying. so you can just keep the for loops that update every video. it will break here if the video shall not be running. | |||
try { | |||
mov = sourceMovie.get(); | |||
mov.resize(0, height); | |||
movW = mov.width; | |||
movH = mov.height; | |||
canvas = createGraphics(movW, movH); | |||
canvas.beginDraw(); | |||
canvas.imageMode(CORNER); | |||
canvas.image(mov, 0, 0, canvas.width, canvas.height); | |||
canvas.imageMode(CENTER); | |||
canvas.image(blob, mouseX-movX, mouseY, height/3, height/3); | |||
mov = canvas.get(); | |||
canvas.endDraw(); | |||
mov.resize(0, height/detailfactor); | |||
if (debug) { | |||
tint(255, 60); | |||
image(canvas, movX, 0); | |||
tint(255, 255); | |||
} | |||
mov.loadPixels(); | |||
for (int i=0; i<mov.pixels.length; i++ ) { | |||
int col = mov.pixels[i]; | |||
if (brightness(col) > threshold) { | |||
//int x = i%mov.width*detailfactor; | |||
int x = int(map(i%mov.width*detailfactor, 0, mov.width, 0, movW/detailfactor)); //new! fixes a bug where the cursor was out of place | |||
int y = i/mov.width*detailfactor+10; | |||
text(word, x+movX, y); | |||
} | |||
} | |||
} | |||
catch (Exception e) { | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,2 @@ | |||
# Find-the-Door | |||
Game for Fun Palace |
@@ -0,0 +1,133 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProductVersion>10.0.20506</ProductVersion> | |||
<SchemaVersion>2.0</SchemaVersion> | |||
<RootNamespace></RootNamespace> | |||
<ProjectGuid>{1A2D5028-442C-2587-B143-7CECC2B8AC9B}</ProjectGuid> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<AssemblyName>Assembly-CSharp-Editor</AssemblyName> | |||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||
<FileAlignment>512</FileAlignment> | |||
<BaseDirectory>Assets</BaseDirectory> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>Temp\bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_5_0;UNITY_5_5;UNITY_5;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>0169</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>Temp\bin\Release\</OutputPath> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>0169</NoWarn> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="System" /> | |||
<Reference Include="System.XML" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Runtime.Serialization" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="UnityEngine"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Assets\SteamVR\Editor\SteamVR_Editor.cs" /> | |||
<Compile Include="Assets\SteamVR\Editor\SteamVR_RenderModelEditor.cs" /> | |||
<Compile Include="Assets\SteamVR\Editor\SteamVR_Settings.cs" /> | |||
<Compile Include="Assets\SteamVR\Editor\SteamVR_SkyboxEditor.cs" /> | |||
<Compile Include="Assets\SteamVR\Editor\SteamVR_Update.cs" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_Fade.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_ClearAll.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Hints\Shaders\ControllerButtonHints.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Teleport\Shaders\Highlight.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_SphericalProjection.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_AlphaOut.shader" /> | |||
<None Include="Assets\SteamVR\readme.txt" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Core\Shaders\Silhouette.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_ColorOut.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Core\Shaders\SeeThru.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Readme_InteractionSystem.txt" /> | |||
<Reference Include="UnityEditor.Advertisements"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath> | |||
</Reference> | |||
<Reference Include="nunit.framework"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/EditorTestsRunner/Editor/nunit.framework.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.EditorTestsRunner"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/EditorTestsRunner/Editor/UnityEditor.EditorTestsRunner.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.UI"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.UI"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.Networking"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.Networking"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.PlaymodeTestsRunner"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/PlaymodeTestsRunner/Editor/UnityEditor.PlaymodeTestsRunner.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.PlaymodeTestsRunner"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/PlaymodeTestsRunner/UnityEngine.PlaymodeTestsRunner.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.TreeEditor"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.Analytics"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.Analytics"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/Editor/UnityEditor.Analytics.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.HoloLens"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Editor/UnityEditor.HoloLens.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.HoloLens"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.VR"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.VR"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.Graphs"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.Graphs.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor.WindowsStandalone.Extensions"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/PlaybackEngines/windowsstandalonesupport/UnityEditor.WindowsStandalone.Extensions.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="Assembly-CSharp.csproj"> | |||
<Project>{06CC2B1B-B526-7801-AF2F-99A643C8309A}</Project> <Name>Assembly-CSharp</Name> </ProjectReference> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
Other similar extension points exist, see Microsoft.Common.targets. | |||
<Target Name="BeforeBuild"> | |||
</Target> | |||
<Target Name="AfterBuild"> | |||
</Target> | |||
--> | |||
</Project> |
@@ -0,0 +1,192 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProductVersion>10.0.20506</ProductVersion> | |||
<SchemaVersion>2.0</SchemaVersion> | |||
<RootNamespace></RootNamespace> | |||
<ProjectGuid>{06CC2B1B-B526-7801-AF2F-99A643C8309A}</ProjectGuid> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<AssemblyName>Assembly-CSharp</AssemblyName> | |||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||
<FileAlignment>512</FileAlignment> | |||
<BaseDirectory>Assets</BaseDirectory> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>Temp\bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_5_0;UNITY_5_5;UNITY_5;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>0169</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>Temp\bin\Release\</OutputPath> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>0169</NoWarn> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="System" /> | |||
<Reference Include="System.XML" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Runtime.Serialization" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="UnityEngine"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEditor"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_GazeTracker.cs" /> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_LaserPointer.cs" /> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_Teleporter.cs" /> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_TestThrow.cs" /> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_TestTrackedCamera.cs" /> | |||
<Compile Include="Assets\SteamVR\Extras\SteamVR_TrackedController.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\BodyCollider.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\CircularDrive.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\ComplexThrowable.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\ControllerHoverHighlight.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\CustomEvents.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DebugUI.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DestroyOnDetachedFromHand.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DestroyOnParticleSystemDeath.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DestroyOnTriggerEnter.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DistanceHaptics.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\DontDestroyOnLoad.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\EnumFlags.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\FallbackCameraController.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Hand.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\HapticRack.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\HideOnHandFocusLost.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\IgnoreHovering.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\InputModule.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Interactable.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\InteractableButtonEvents.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\InteractableHoverEvents.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\ItemPackage.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\ItemPackageReference.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\ItemPackageSpawner.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearAnimation.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearAnimator.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearAudioPitch.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearBlendshape.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearDisplacement.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearDrive.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\LinearMapping.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\PlaySound.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Player.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SeeThru.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SleepOnAwake.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SoundDeparent.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SoundPlayOneshot.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SpawnAndAttachAfterControllerIsTracking.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SpawnAndAttachToHand.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\SpawnRenderModel.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Throwable.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\UIElement.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Unparent.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\Util.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Core\Scripts\VelocityEstimator.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Hints\Scripts\ControllerButtonHints.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\ArcheryTarget.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\Arrow.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\ArrowHand.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\ArrowheadRotation.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\Balloon.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\BalloonColliders.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\BalloonHapticBump.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\BalloonSpawner.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\ExplosionWobble.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\FireSource.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\Longbow.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Longbow\Scripts\SoundBowClick.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Samples\Scripts\ControllerHintsExample.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Samples\Scripts\InteractableExample.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\AllowTeleportWhileAttachedToHand.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\ChaperoneInfo.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\IgnoreTeleportTrace.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\Teleport.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\TeleportArc.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\TeleportArea.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\TeleportMarkerBase.cs" /> | |||
<Compile Include="Assets\SteamVR\InteractionSystem\Teleport\Scripts\TeleportPoint.cs" /> | |||
<Compile Include="Assets\SteamVR\Plugins\openvr_api.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Camera.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_CameraFlip.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_CameraMask.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Controller.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_ControllerManager.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Ears.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Events.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_ExternalCamera.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Fade.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Frustum.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_GameView.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_IK.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_LoadLevel.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Menu.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Overlay.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_PlayArea.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Render.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_RenderModel.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Skybox.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_SphericalProjection.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Stats.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_TestController.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_TrackedCamera.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_TrackedObject.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_UpdatePoses.cs" /> | |||
<Compile Include="Assets\SteamVR\Scripts\SteamVR_Utils.cs" /> | |||
<Compile Include="Assets\ViveLaserPointer.cs" /> | |||
<Compile Include="Assets\networkSocket.cs" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_Fade.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_ClearAll.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Hints\Shaders\ControllerButtonHints.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Teleport\Shaders\Highlight.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_SphericalProjection.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_AlphaOut.shader" /> | |||
<None Include="Assets\SteamVR\readme.txt" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Core\Shaders\Silhouette.shader" /> | |||
<None Include="Assets\SteamVR\Resources\SteamVR_ColorOut.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Core\Shaders\SeeThru.shader" /> | |||
<None Include="Assets\SteamVR\InteractionSystem\Readme_InteractionSystem.txt" /> | |||
<Reference Include="UnityEngine.UI"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.Networking"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.PlaymodeTestsRunner"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/PlaymodeTestsRunner/UnityEngine.PlaymodeTestsRunner.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.Analytics"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.HoloLens"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.VR"> | |||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
Other similar extension points exist, see Microsoft.Common.targets. | |||
<Target Name="BeforeBuild"> | |||
</Target> | |||
<Target Name="AfterBuild"> | |||
</Target> | |||
--> | |||
</Project> |
@@ -0,0 +1,7 @@ | |||
fileFormatVersion: 2 | |||
guid: a8a7ba0a9db49da4f82473c51c9cb8f4 | |||
folderAsset: yes | |||
DefaultImporter: | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: 7c46b5d37e9beda4092bb579be8aafc2 | |||
timeCreated: 1485427390 | |||
licenseType: Free | |||
DefaultImporter: | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@@ -0,0 +1,9 @@ | |||
fileFormatVersion: 2 | |||
guid: 17fdbdac4774fcf49b911cb9fb795b21 | |||
folderAsset: yes | |||
timeCreated: 1485425910 | |||
licenseType: Free | |||
DefaultImporter: | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@@ -0,0 +1,6 @@ | |||
fileFormatVersion: 2 | |||
guid: c33af0785775d7548b22541da37936fe | |||
folderAsset: yes | |||
DefaultImporter: | |||
userData: | |||
assetBundleName: |
@@ -0,0 +1,127 @@ | |||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | |||
// | |||
// Purpose: Custom inspector display for SteamVR_Camera | |||
// | |||
//============================================================================= | |||
using UnityEngine; | |||
using UnityEditor; | |||
using System.IO; | |||
[CustomEditor(typeof(SteamVR_Camera)), CanEditMultipleObjects] | |||
public class SteamVR_Editor : Editor | |||
{ | |||
int bannerHeight = 150; | |||
Texture logo; | |||
SerializedProperty script, wireframe; | |||
string GetResourcePath() | |||
{ | |||
var ms = MonoScript.FromScriptableObject(this); | |||
var path = AssetDatabase.GetAssetPath(ms); | |||
path = Path.GetDirectoryName(path); | |||
return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; | |||
} | |||
void OnEnable() | |||
{ | |||
var resourcePath = GetResourcePath(); | |||
logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png"); | |||
script = serializedObject.FindProperty("m_Script"); | |||
wireframe = serializedObject.FindProperty("wireframe"); | |||
foreach (SteamVR_Camera target in targets) | |||
target.ForceLast(); | |||
} | |||
public override void OnInspectorGUI() | |||
{ | |||
serializedObject.Update(); | |||
var rect = GUILayoutUtility.GetRect(Screen.width - 38, bannerHeight, GUI.skin.box); | |||
if (logo) | |||
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); | |||
if (!Application.isPlaying) | |||
{ | |||
var expand = false; | |||
var collapse = false; | |||
foreach (SteamVR_Camera target in targets) | |||
{ | |||
if (AssetDatabase.Contains(target)) | |||
continue; | |||
if (target.isExpanded) | |||
collapse = true; | |||
else | |||
expand = true; | |||
} | |||
if (expand) | |||
{ | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button("Expand")) | |||
{ | |||
foreach (SteamVR_Camera target in targets) | |||
{ | |||
if (AssetDatabase.Contains(target)) | |||
continue; | |||
if (!target.isExpanded) | |||
{ | |||
target.Expand(); | |||
EditorUtility.SetDirty(target); | |||
} | |||
} | |||
} | |||
GUILayout.Space(18); | |||
GUILayout.EndHorizontal(); | |||
} | |||
if (collapse) | |||
{ | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button("Collapse")) | |||
{ | |||
foreach (SteamVR_Camera target in targets) | |||
{ | |||
if (AssetDatabase.Contains(target)) | |||
continue; | |||
if (target.isExpanded) | |||
{ | |||
target.Collapse(); | |||
EditorUtility.SetDirty(target); | |||
} | |||
} | |||
} | |||
GUILayout.Space(18); | |||
GUILayout.EndHorizontal(); | |||
} | |||
} | |||
EditorGUILayout.PropertyField(script); | |||
EditorGUILayout.PropertyField(wireframe); | |||
serializedObject.ApplyModifiedProperties(); | |||
} | |||
public static void ExportPackage() | |||
{ | |||
AssetDatabase.ExportPackage(new string[] { | |||
"Assets/SteamVR", | |||
"Assets/Plugins/openvr_api.cs", | |||
"Assets/Plugins/openvr_api.bundle", | |||
"Assets/Plugins/x86/openvr_api.dll", | |||
"Assets/Plugins/x86/steam_api.dll", | |||
"Assets/Plugins/x86/libsteam_api.so", | |||
"Assets/Plugins/x86_64/openvr_api.dll", | |||
"Assets/Plugins/x86_64/steam_api.dll", | |||
"Assets/Plugins/x86_64/libsteam_api.so", | |||
"Assets/Plugins/x86_64/libopenvr_api.so", | |||
}, "steamvr.unitypackage", ExportPackageOptions.Recurse); | |||
EditorApplication.Exit(0); | |||
} | |||
} | |||
@@ -0,0 +1,9 @@ | |||
fileFormatVersion: 2 | |||
guid: 5ba22c80948c94e44a82b9fd1b3abd0d | |||
MonoImporter: | |||
serializedVersion: 2 | |||
defaultReferences: [] | |||
executionOrder: 0 | |||
icon: {instanceID: 0} | |||
userData: | |||
assetBundleName: |
@@ -0,0 +1,105 @@ | |||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | |||
// | |||
// Purpose: Custom inspector display for SteamVR_RenderModel | |||
// | |||
//============================================================================= | |||
using UnityEngine; | |||
using UnityEditor; | |||
using System.Text; | |||
using System.Collections.Generic; | |||
using Valve.VR; | |||
[CustomEditor(typeof(SteamVR_RenderModel)), CanEditMultipleObjects] | |||
public class SteamVR_RenderModelEditor : Editor | |||
{ | |||
SerializedProperty script, index, modelOverride, shader, verbose, createComponents, updateDynamically; | |||
static string[] renderModelNames; | |||
int renderModelIndex; | |||
void OnEnable() | |||
{ | |||
script = serializedObject.FindProperty("m_Script"); | |||
index = serializedObject.FindProperty("index"); | |||
modelOverride = serializedObject.FindProperty("modelOverride"); | |||
shader = serializedObject.FindProperty("shader"); | |||
verbose = serializedObject.FindProperty("verbose"); | |||
createComponents = serializedObject.FindProperty("createComponents"); | |||
updateDynamically = serializedObject.FindProperty("updateDynamically"); | |||
// Load render model names if necessary. | |||
if (renderModelNames == null) | |||
{ | |||
renderModelNames = LoadRenderModelNames(); | |||
} | |||
// Update renderModelIndex based on current modelOverride value. | |||
if (modelOverride.stringValue != "") | |||
{ | |||
for (int i = 0; i < renderModelNames.Length; i++) | |||
{ | |||
if (modelOverride.stringValue == renderModelNames[i]) | |||
{ | |||
renderModelIndex = i; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
static string[] LoadRenderModelNames() | |||
{ | |||
var results = new List<string>(); | |||
results.Add("None"); | |||
using (var holder = new SteamVR_RenderModel.RenderModelInterfaceHolder()) | |||
{ | |||
var renderModels = holder.instance; | |||
if (renderModels != null) | |||
{ | |||
uint count = renderModels.GetRenderModelCount(); | |||
for (uint i = 0; i < count; i++) | |||
{ | |||
var buffer = new StringBuilder(); | |||
var requiredSize = renderModels.GetRenderModelName(i, buffer, 0); | |||
if (requiredSize == 0) | |||
continue; | |||
buffer.EnsureCapacity((int)requiredSize); | |||
renderModels.GetRenderModelName(i, buffer, requiredSize); | |||
results.Add(buffer.ToString()); | |||
} | |||
} | |||
} | |||
return results.ToArray(); | |||
} | |||
public override void OnInspectorGUI() | |||
{ | |||
serializedObject.Update(); | |||
EditorGUILayout.PropertyField(script); | |||
EditorGUILayout.PropertyField(index); | |||
//EditorGUILayout.PropertyField(modelOverride); | |||
GUILayout.BeginHorizontal(); | |||
GUILayout.Label("Model Override"); | |||
var selected = EditorGUILayout.Popup(renderModelIndex, renderModelNames); | |||
if (selected != renderModelIndex) | |||
{ | |||
renderModelIndex = selected; | |||
modelOverride.stringValue = (selected > 0) ? renderModelNames[selected] : ""; | |||
} | |||
GUILayout.EndHorizontal(); | |||
EditorGUILayout.PropertyField(shader); | |||
EditorGUILayout.PropertyField(verbose); | |||
EditorGUILayout.PropertyField(createComponents); | |||
EditorGUILayout.PropertyField(updateDynamically); | |||
serializedObject.ApplyModifiedProperties(); | |||
} | |||
} | |||
@@ -0,0 +1,12 @@ | |||
fileFormatVersion: 2 | |||
guid: 67867a20919f7db45a2e7034fda1c28e | |||
timeCreated: 1433373945 | |||
licenseType: Store | |||
MonoImporter: | |||
serializedVersion: 2 | |||
defaultReferences: [] | |||
executionOrder: 0 | |||
icon: {instanceID: 0} | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@@ -0,0 +1,685 @@ | |||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | |||
// | |||
// Purpose: Prompt developers to use settings most compatible with SteamVR. | |||
// | |||
//============================================================================= | |||
using UnityEngine; | |||
using UnityEditor; | |||
using System.IO; | |||
[InitializeOnLoad] | |||
public class SteamVR_Settings : EditorWindow | |||
{ | |||
const bool forceShow = false; // Set to true to get the dialog to show back up in the case you clicked Ignore All. | |||
const string ignore = "ignore."; | |||
const string useRecommended = "Use recommended ({0})"; | |||
const string currentValue = " (current = {0})"; | |||
const string buildTarget = "Build Target"; | |||
const string showUnitySplashScreen = "Show Unity Splashscreen"; | |||
const string defaultIsFullScreen = "Default is Fullscreen"; | |||
const string defaultScreenSize = "Default Screen Size"; | |||
const string runInBackground = "Run In Background"; | |||
const string displayResolutionDialog = "Display Resolution Dialog"; | |||
const string resizableWindow = "Resizable Window"; | |||
const string fullscreenMode = "D3D11 Fullscreen Mode"; | |||
const string visibleInBackground = "Visible In Background"; | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
const string renderingPath = "Rendering Path"; | |||
#endif | |||
const string colorSpace = "Color Space"; | |||
const string gpuSkinning = "GPU Skinning"; | |||
#if false // skyboxes are currently broken | |||
const string singlePassStereoRendering = "Single-Pass Stereo Rendering"; | |||
#endif | |||
const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64; | |||
const bool recommended_ShowUnitySplashScreen = false; | |||
const bool recommended_DefaultIsFullScreen = false; | |||
const int recommended_DefaultScreenWidth = 1024; | |||
const int recommended_DefaultScreenHeight = 768; | |||
const bool recommended_RunInBackground = true; | |||
const ResolutionDialogSetting recommended_DisplayResolutionDialog = ResolutionDialogSetting.HiddenByDefault; | |||
const bool recommended_ResizableWindow = true; | |||
const D3D11FullscreenMode recommended_FullscreenMode = D3D11FullscreenMode.FullscreenWindow; | |||
const bool recommended_VisibleInBackground = true; | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
const RenderingPath recommended_RenderPath = RenderingPath.Forward; | |||
#endif | |||
const ColorSpace recommended_ColorSpace = ColorSpace.Linear; | |||
const bool recommended_GpuSkinning = true; | |||
#if false | |||
const bool recommended_SinglePassStereoRendering = true; | |||
#endif | |||
static SteamVR_Settings window; | |||
static SteamVR_Settings() | |||
{ | |||
EditorApplication.update += Update; | |||
} | |||
static void Update() | |||
{ | |||
bool show = | |||
(!EditorPrefs.HasKey(ignore + buildTarget) && | |||
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) || | |||
(!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) || | |||
#else | |||
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) || | |||
#endif | |||
(!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && | |||
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) || | |||
(!EditorPrefs.HasKey(ignore + defaultScreenSize) && | |||
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || | |||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) || | |||
(!EditorPrefs.HasKey(ignore + runInBackground) && | |||
PlayerSettings.runInBackground != recommended_RunInBackground) || | |||
(!EditorPrefs.HasKey(ignore + displayResolutionDialog) && | |||
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) || | |||
(!EditorPrefs.HasKey(ignore + resizableWindow) && | |||
PlayerSettings.resizableWindow != recommended_ResizableWindow) || | |||
(!EditorPrefs.HasKey(ignore + fullscreenMode) && | |||
PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) || | |||
(!EditorPrefs.HasKey(ignore + visibleInBackground) && | |||
PlayerSettings.visibleInBackground != recommended_VisibleInBackground) || | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
(!EditorPrefs.HasKey(ignore + renderingPath) && | |||
PlayerSettings.renderingPath != recommended_RenderPath) || | |||
#endif | |||
(!EditorPrefs.HasKey(ignore + colorSpace) && | |||
PlayerSettings.colorSpace != recommended_ColorSpace) || | |||
(!EditorPrefs.HasKey(ignore + gpuSkinning) && | |||
PlayerSettings.gpuSkinning != recommended_GpuSkinning) || | |||
#if false | |||
(!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && | |||
PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) || | |||
#endif | |||
forceShow; | |||
if (show) | |||
{ | |||
window = GetWindow<SteamVR_Settings>(true); | |||
window.minSize = new Vector2(320, 440); | |||
//window.title = "SteamVR"; | |||
} | |||
// Switch to native OpenVR support. | |||
var updated = false; | |||
if (!PlayerSettings.virtualRealitySupported) | |||
{ | |||
PlayerSettings.virtualRealitySupported = true; | |||
updated = true; | |||
} | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone); | |||
#else | |||
var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone); | |||
#endif | |||
var hasOpenVR = false; | |||
foreach (var device in devices) | |||
if (device.ToLower() == "openvr") | |||
hasOpenVR = true; | |||
if (!hasOpenVR) | |||
{ | |||
string[] newDevices; | |||
if (updated) | |||
{ | |||
newDevices = new string[] { "OpenVR" }; | |||
} | |||
else | |||
{ | |||
newDevices = new string[devices.Length + 1]; | |||
for (int i = 0; i < devices.Length; i++) | |||
newDevices[i] = devices[i]; | |||
newDevices[devices.Length] = "OpenVR"; | |||
updated = true; | |||
} | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices); | |||
#else | |||
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices); | |||
#endif | |||
} | |||
if (updated) | |||
Debug.Log("Switching to native OpenVR support."); | |||
var dlls = new string[] | |||
{ | |||
"Plugins/x86/openvr_api.dll", | |||
"Plugins/x86_64/openvr_api.dll" | |||
}; | |||
foreach (var path in dlls) | |||
{ | |||
if (!File.Exists(Application.dataPath + "/" + path)) | |||
continue; | |||
if (AssetDatabase.DeleteAsset("Assets/" + path)) | |||
Debug.Log("Deleting " + path); | |||
else | |||
{ | |||
Debug.Log(path + " in use; cannot delete. Please restart Unity to complete upgrade."); | |||
} | |||
} | |||
EditorApplication.update -= Update; | |||
} | |||
Vector2 scrollPosition; | |||
bool toggleState; | |||
string GetResourcePath() | |||
{ | |||
var ms = MonoScript.FromScriptableObject(this); | |||
var path = AssetDatabase.GetAssetPath(ms); | |||
path = Path.GetDirectoryName(path); | |||
return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; | |||
} | |||
public void OnGUI() | |||
{ | |||
var resourcePath = GetResourcePath(); | |||
var logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png"); | |||
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); | |||
if (logo) | |||
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); | |||
EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning); | |||
scrollPosition = GUILayout.BeginScrollView(scrollPosition); | |||
int numItems = 0; | |||
if (!EditorPrefs.HasKey(ignore + buildTarget) && | |||
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) | |||
{ | |||
++numItems; | |||
GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget))) | |||
{ | |||
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget); | |||
#else | |||
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget); | |||
#endif | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + buildTarget, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |||
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && | |||
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) | |||
{ | |||
++numItems; | |||
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) | |||
{ | |||
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
#else | |||
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && | |||
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) | |||
{ | |||
++numItems; | |||
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) | |||
{ | |||
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
#endif | |||
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && | |||
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) | |||
{ | |||
++numItems; | |||
GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen))) | |||
{ | |||
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
if (!EditorPrefs.HasKey(ignore + defaultScreenSize) && | |||
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || | |||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) | |||
{ | |||
++numItems; | |||
GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight))) | |||
{ | |||
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; | |||
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + defaultScreenSize, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
if (!EditorPrefs.HasKey(ignore + runInBackground) && | |||
PlayerSettings.runInBackground != recommended_RunInBackground) | |||
{ | |||
++numItems; | |||
GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground))) | |||
{ | |||
PlayerSettings.runInBackground = recommended_RunInBackground; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + runInBackground, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && | |||
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) | |||
{ | |||
++numItems; | |||
GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog))) | |||
{ | |||
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog; | |||
} | |||
GUILayout.FlexibleSpace(); | |||
if (GUILayout.Button("Ignore")) | |||
{ | |||
EditorPrefs.SetBool(ignore + displayResolutionDialog, true); | |||
} | |||
GUILayout.EndHorizontal(); | |||
} | |||
if (!EditorPrefs.HasKey(ignore + resizableWindow) && | |||
PlayerSettings.resizableWindow != recommended_ResizableWindow) | |||
{ | |||
++numItems; | |||
GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow)); | |||
GUILayout.BeginHorizontal(); | |||
if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow))) | |||
{ | |||
PlayerSettings.resizableWindow = recommended_ResizableWindow; | |||
} | |||