From 66d1eeb327296e4d633d1fa66ea1bb573cc79645 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 19 Feb 2015 21:11:51 -0800 Subject: [PATCH 1/2] Add textured models as balls --- examples/example/games/billiards.js | 30 +++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/examples/example/games/billiards.js b/examples/example/games/billiards.js index fbd41e8939..cb30cc631f 100644 --- a/examples/example/games/billiards.js +++ b/examples/example/games/billiards.js @@ -105,37 +105,27 @@ function makeTable(pos) { } function makeBalls(pos) { - var colors = [{ red: 255, green: 255, blue: 0}, // Yellow - { red: 0, green: 0, blue: 255}, // Blue - { red: 255, green: 0, blue: 0}, // Red - { red: 128, green: 0, blue: 128}, // Purple - { red: 255, green: 165, blue: 0}, // Orange - { red: 0, green: 255, blue: 0}, // Green - { red: 128, green: 0, blue: 0}, // Maroon - { red: 0, green: 0, blue: 0}, // Black - { red: 255, green: 255, blue: 224}, // Light Yellow - { red: 173, green: 216, blue: 230}, // Light Blue - { red: 205, green: 92, blue: 92}, // Indian Red - { red: 218, green: 112, blue: 214}, // Orchid - { red: 218, green: 165, blue: 32}, // GoldenRod - { red: 255, green: 99, blue: 71}, // Tomato - { red: 128, green: 128, blue: 128}]; // Gray - // Object balls + var whichBall = [ 1, 14, 15, 4, 8, 7, 12, 9, 3, 13, 10, 5, 6, 11, 2 ]; + var ballNumber = 0; var ballPosition = { x: pos.x + (LENGTH / 4.0) * SCALE, y: pos.y + HEIGHT / 2.0 + DROP_HEIGHT, z: pos.z }; for (var row = 1; row <= 5; row++) { ballPosition.z = pos.z - ((row - 1.0) / 2.0 * (BALL_SIZE + BALL_GAP) * SCALE); for (var spot = 0; spot < row; spot++) { balls.push(Entities.addEntity( - { type: "Sphere", + { type: "Model", + modelURL: "https://s3.amazonaws.com/hifi-public/models/props/Pool/ball_" + whichBall[ballNumber].toString() + ".fbx", position: ballPosition, dimensions: { x: BALL_SIZE * SCALE, y: BALL_SIZE * SCALE, z: BALL_SIZE * SCALE }, - color: colors[balls.length], + rotation: Quat.fromPitchYawRollDegrees((Math.random() - 0.5) * 20, (Math.random() - 0.5) * 20, (Math.random() - 0.5) * 20), + color: { red: 255, green: 255, blue: 255 }, gravity: { x: 0, y: GRAVITY, z: 0 }, ignoreCollisions: false, damping: 0.50, + shapeType: 2, collisionsWillMove: true })); ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE; + ballNumber++; } ballPosition.x += (BALL_GAP + Math.sqrt(3.0) / 2.0 * BALL_SIZE) * SCALE; } @@ -143,7 +133,8 @@ function makeBalls(pos) { // Cue Ball cuePosition = { x: pos.x - (LENGTH / 4.0) * SCALE, y: pos.y + HEIGHT / 2.0 + DROP_HEIGHT, z: pos.z }; cueBall = Entities.addEntity( - { type: "Sphere", + { type: "Model", + modelURL: "https://s3.amazonaws.com/hifi-public/models/props/Pool/cue_ball.fbx", position: cuePosition, dimensions: { x: BALL_SIZE * SCALE, y: BALL_SIZE * SCALE, z: BALL_SIZE * SCALE }, color: { red: 255, green: 255, blue: 255 }, @@ -152,6 +143,7 @@ function makeBalls(pos) { velocity: {x: 0, y: 0, z: 0 }, ignoreCollisions: false, damping: 0.50, + shapeType: 2, collisionsWillMove: true }); } From 3a95614ca43647c0a788152e0d4a495cc66a557e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Feb 2015 11:29:51 -0800 Subject: [PATCH 2/2] Update Faceshift readme.txt with Windows instructions --- interface/external/faceshift/readme.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/external/faceshift/readme.txt b/interface/external/faceshift/readme.txt index 5a7333a9f6..4208711632 100644 --- a/interface/external/faceshift/readme.txt +++ b/interface/external/faceshift/readme.txt @@ -13,9 +13,14 @@ You may optionally choose to place this folder in a location outside the reposit If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder ‘faceshift’ that contains the lib and include folders. -1. Build a Faceshift static library from the fsbinarystream.cpp file. If you build a release version call it libfaceshift.a. The debug version should be called libfaceshiftd.a. Place this in the ‘lib’ folder in your Faceshift folder. +1. Build a Faceshift static library from the fsbinarystream.cpp file. + Windows: Win32 console application; no precompiled header or SDL checks; no ATL or MFC headers; Project Properties, Configuration Type = Static Library (.lib). -2. Copy the fsbinarystream.h header file from the Faceshift SDK into the ‘include’ folder in your Faceshift folder. +2. Copy the library files to the ‘lib’ folder in your Faceshift folder. + OSX: If you build a release version call it libfaceshift.a. The debug version should be called libfaceshiftd.a. + Windows: The release and debug versions should be called faceshift.lib and faceshiftd.lib, respectively. Copy them into a ‘Win32’ folder in your ‘lib’ folder. -3. Clear your build directory, run cmake and build, and you should be all set. +3. Copy the fsbinarystream.h header file from the Faceshift SDK into the ‘include’ folder in your Faceshift folder. + +4. Clear your build directory, run cmake and build, and you should be all set.