Skip to content

Commit

Permalink
Merge pull request #371 from guycalledfrank/customVsInPicker
Browse files Browse the repository at this point in the history
meshInstance.pick
  • Loading branch information
guycalledfrank committed Jul 30, 2015
2 parents 58030a9 + 70c7873 commit 1bbacbf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 63 deletions.
1 change: 0 additions & 1 deletion build/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
../src/scene/scene_basicmaterial.js
../src/scene/scene_depthmaterial.js
../src/scene/scene_phongmaterial.js
../src/scene/scene_pickmaterial.js
../src/scene/scene_mesh.js
../src/scene/scene_skin.js
../src/scene/scene_skinpartition.js
Expand Down
1 change: 1 addition & 0 deletions src/scene/scene_mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pc.extend(pc, function () {
this._receiveShadow = true;
this.drawToDepth = true;
this.cull = true;
this.pick = true;

// 64-bit integer key that defines render order of this mesh instance
this.key = 0;
Expand Down
11 changes: 6 additions & 5 deletions src/scene/scene_pick.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pc.extend(pc, function () {
* x: 10,
* y: 20
* });
*
*
* // Get all models in rectangle with corners at (10,20) and (20,40)
* var selection = picker.getSelection({
* x: 10,
Expand Down Expand Up @@ -110,7 +110,7 @@ pc.extend(pc, function () {
* @name pc.Picker#prepare
* @description Primes the pick buffer with a rendering of the specified models from the point of view
* of the supplied camera. Once the pick buffer has been prepared, pc.Picker#getSelection can be
* called multiple times on the same picker object. Therefore, if the models or camera do not change
* called multiple times on the same picker object. Therefore, if the models or camera do not change
* in any way, pc.Picker#prepare does not need to be called again.
* @param {pc.Camera} camera The camera used to render the scene, note this is the CameraNode, not an Entity
* @param {pc.Scene} scene The scene containing the pickable mesh instances.
Expand Down Expand Up @@ -152,7 +152,7 @@ pc.extend(pc, function () {

projId.setValue(projMat.data);
viewProjId.setValue(viewProjMat.data);

// copy scene drawCalls
this.drawCalls = scene.drawCalls.slice(0);
// sort same as forward renderer
Expand All @@ -162,6 +162,7 @@ pc.extend(pc, function () {
if (this.drawCalls[i].command) {
this.drawCalls[i].command();
} else {
if (!this.drawCalls[i].pick) continue;
meshInstance = this.drawCalls[i];
mesh = meshInstance.mesh;
material = meshInstance.material;
Expand All @@ -184,7 +185,7 @@ pc.extend(pc, function () {
var h = meshInstance.skinInstance.boneTexture.height;
boneTextureSizeId.setValue([w, h])
} else {
poseMatrixId.setValue(meshInstance.skinInstance.matrixPalette);
poseMatrixId.setValue(meshInstance.skinInstance.matrixPalette);
}
}

Expand Down Expand Up @@ -214,7 +215,7 @@ pc.extend(pc, function () {
* @function
* @name pc.Picker#resize
* @description Sets the resolution of the pick buffer. The pick buffer resolution does not need
* to match the resolution of the corresponding frame buffer use for general rendering of the
* to match the resolution of the corresponding frame buffer use for general rendering of the
* 3D scene. However, the lower the resolution of the pick buffer, the less accurate the selection
* results returned by pc.Picker#getSelection. On the other hand, smaller pick buffers will
* yield greater performance, so there is a trade off.
Expand Down
57 changes: 0 additions & 57 deletions src/scene/scene_pickmaterial.js

This file was deleted.

0 comments on commit 1bbacbf

Please sign in to comment.