Added pages for replays
This commit is contained in:
parent
7a6d4b0247
commit
cfd8f77151
|
@ -112,6 +112,20 @@ var addArrowsFromId = function(client, req, res, callback, id) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var getAllUsers = function(req, res, callback) {
|
||||||
|
pg.connect(pgc.url, function(err, client, release) {
|
||||||
|
client.query(
|
||||||
|
"SELECT id, name FROM users;",
|
||||||
|
[],
|
||||||
|
function(err, result) {
|
||||||
|
res.locals.ids = result.rows;
|
||||||
|
callback();
|
||||||
|
release();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.index = function(req, res) {
|
module.exports.index = function(req, res) {
|
||||||
res.setHeader('Content-Type', 'text/html');
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
|
||||||
|
@ -193,3 +207,11 @@ module.exports.replay = function(req, res, next) {
|
||||||
}, res.locals.id);
|
}, res.locals.id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.replay_index = function(req, res, next) {
|
||||||
|
getAllUsers(req, res, function() {
|
||||||
|
res.render("replay_index.jade", res.locals, function(err, result) {
|
||||||
|
res.send(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ module.exports = {
|
||||||
'/prototype/arrows': 'arrows',
|
'/prototype/arrows': 'arrows',
|
||||||
'/prototype/viewports': 'viewports',
|
'/prototype/viewports': 'viewports',
|
||||||
'/prototype/reverse': 'reverse',
|
'/prototype/reverse': 'reverse',
|
||||||
|
'/prototype/replay': 'replay_index',
|
||||||
'/prototype/replay/:id': 'replay',
|
'/prototype/replay/:id': 'replay',
|
||||||
'/prototype/replay_info/:id': 'replay_info'
|
'/prototype/replay_info/:id': 'replay_info'
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ block title
|
||||||
|
|
||||||
block content
|
block content
|
||||||
h2 Index
|
h2 Index
|
||||||
p There are two prototypes here :
|
p There are three prototypes here :
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a(href="arrows/") Arrows
|
a(href="arrows/") Arrows
|
||||||
|
@ -13,3 +13,4 @@ block content
|
||||||
a(href="reverse/") Reversed arrows looking like funnel
|
a(href="reverse/") Reversed arrows looking like funnel
|
||||||
li
|
li
|
||||||
a(href="viewports/") Viewports
|
a(href="viewports/") Viewports
|
||||||
|
p You can also watch replays of previous experiences <a href="/prototype/replay/">here</a>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
extends ../../../views/main
|
||||||
|
|
||||||
|
block title
|
||||||
|
title #{title} - Prototype - Replays
|
||||||
|
|
||||||
|
block content
|
||||||
|
h2 Replays available
|
||||||
|
if ids.length == 0
|
||||||
|
p Sorry, there are no replays available... try later or do an experiment !
|
||||||
|
else
|
||||||
|
ol
|
||||||
|
each elt in ids
|
||||||
|
li <a href="/prototype/replay/#{elt.id}">#{elt.name}</a>
|
|
@ -10,7 +10,6 @@ var cameras, cameraSelecter;
|
||||||
var spheres = new Array(mesh_number);
|
var spheres = new Array(mesh_number);
|
||||||
var visible = 0;
|
var visible = 0;
|
||||||
var stats;
|
var stats;
|
||||||
var previewer;
|
|
||||||
|
|
||||||
var loader;
|
var loader;
|
||||||
var coins;
|
var coins;
|
||||||
|
@ -57,13 +56,6 @@ function init() {
|
||||||
renderer.shadowMapEnabled = true;
|
renderer.shadowMapEnabled = true;
|
||||||
renderer.setClearColor(0x87ceeb);
|
renderer.setClearColor(0x87ceeb);
|
||||||
|
|
||||||
// Initialize previewer
|
|
||||||
previewer = new Previewer(renderer);
|
|
||||||
previewer.domElement.style.position ="absolute";
|
|
||||||
previewer.domElement.style.cssFloat = 'top-left';
|
|
||||||
previewer.domElement.width = container_size.width();
|
|
||||||
previewer.domElement.height = container_size.height();
|
|
||||||
|
|
||||||
// Initialize scene
|
// Initialize scene
|
||||||
scene = new THREE.Scene();
|
scene = new THREE.Scene();
|
||||||
|
|
||||||
|
@ -75,7 +67,6 @@ function init() {
|
||||||
|
|
||||||
// Add elements to page
|
// Add elements to page
|
||||||
container.appendChild( stats.domElement );
|
container.appendChild( stats.domElement );
|
||||||
container.appendChild(previewer.domElement);
|
|
||||||
container.appendChild(renderer.domElement);
|
container.appendChild(renderer.domElement);
|
||||||
|
|
||||||
// init light
|
// init light
|
||||||
|
@ -130,7 +121,7 @@ function initListeners() {
|
||||||
document.addEventListener('keydown', function(event) { if (event.keyCode == 27) { stopFullscreen();} }, false);
|
document.addEventListener('keydown', function(event) { if (event.keyCode == 27) { stopFullscreen();} }, false);
|
||||||
|
|
||||||
// HTML Bootstrap buttons
|
// HTML Bootstrap buttons
|
||||||
buttonManager = new ButtonManager(cameras, previewer);
|
buttonManager = new ButtonManager(cameras);
|
||||||
|
|
||||||
// Camera selecter for hover and clicking recommendations
|
// Camera selecter for hover and clicking recommendations
|
||||||
cameraSelecter = new CameraSelecter(renderer, cameras, buttonManager);
|
cameraSelecter = new CameraSelecter(renderer, cameras, buttonManager);
|
||||||
|
@ -228,14 +219,8 @@ function render() {
|
||||||
renderer.setViewport(left, bottom, width, height);
|
renderer.setViewport(left, bottom, width, height);
|
||||||
renderer.render(scene, cameras.mainCamera());
|
renderer.render(scene, cameras.mainCamera());
|
||||||
|
|
||||||
// Remove borders of preview
|
|
||||||
previewer.clear();
|
|
||||||
|
|
||||||
// Hide arrows in recommendation
|
// Hide arrows in recommendation
|
||||||
cameras.map(function(camera) { if (camera instanceof RecommendedCamera) hide(camera); });
|
cameras.map(function(camera) { if (camera instanceof RecommendedCamera) hide(camera); });
|
||||||
|
|
||||||
// Render preview
|
|
||||||
previewer.render(cameraSelecter.prev, container_size.width(), container_size.height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
|
@ -253,9 +238,6 @@ function onWindowResize() {
|
||||||
container.style.width = container_size.width() + "px";
|
container.style.width = container_size.width() + "px";
|
||||||
container.style.height = container_size.height() + "px";
|
container.style.height = container_size.height() + "px";
|
||||||
|
|
||||||
previewer.domElement.width = container_size.width();
|
|
||||||
previewer.domElement.height = container_size.height();
|
|
||||||
|
|
||||||
renderer.setSize(container_size.width(), container_size.height());
|
renderer.setSize(container_size.width(), container_size.height());
|
||||||
cameras.forEach(function(camera) {camera.aspect = container_size.width() / container_size.height();});
|
cameras.forEach(function(camera) {camera.aspect = container_size.width() / container_size.height();});
|
||||||
cameras.forEach(function(camera) {camera.updateProjectionMatrix();});
|
cameras.forEach(function(camera) {camera.updateProjectionMatrix();});
|
||||||
|
|
1
urls.js
1
urls.js
|
@ -6,3 +6,4 @@ module.exports.arrows = '/prototype/arrows/';
|
||||||
module.exports.viewports = '/prototype/viewports/';
|
module.exports.viewports = '/prototype/viewports/';
|
||||||
module.exports.stream = '/stream/';
|
module.exports.stream = '/stream/';
|
||||||
module.exports.reverse = '/prototype/reverse/';
|
module.exports.reverse = '/prototype/reverse/';
|
||||||
|
module.exports.replay_index = '/prototype/replay/';
|
||||||
|
|
|
@ -37,6 +37,9 @@ html(lang='fr')
|
||||||
a(href="#{urls.reverse}") Reverse arrows
|
a(href="#{urls.reverse}") Reverse arrows
|
||||||
li
|
li
|
||||||
a(href="#{urls.viewports}") Viewports
|
a(href="#{urls.viewports}") Viewports
|
||||||
|
li.divider
|
||||||
|
li
|
||||||
|
a(href="#{urls.replay_index}") Replays
|
||||||
li
|
li
|
||||||
a(href="#{urls.stream}") Streaming simulator
|
a(href="#{urls.stream}") Streaming simulator
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue