From a1b5cd43472bc26f73db90e0b0732f57434bc41c Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 24 Mar 2018 19:39:11 +0100 Subject: [PATCH] send uv data with intersect --- src/game-lib-d3-raycaster.js | 6 +++++- src/game-lib-image.js | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/game-lib-d3-raycaster.js b/src/game-lib-d3-raycaster.js index 60197f8..869fe2d 100644 --- a/src/game-lib-d3-raycaster.js +++ b/src/game-lib-d3-raycaster.js @@ -177,7 +177,11 @@ GameLib.D3.Raycaster.prototype.getIntersectedObjects = function(meshes) { mesh: mesh, distance : intersects[0].distance, face: mesh.geometry.faces[intersects[0].faceIndex], - faceIndex: intersects[0].faceIndex + faceIndex: intersects[0].faceIndex, + uv : { + x : intersects[0].uv.x, + y : intersects[0].uv.y + } } ); } diff --git a/src/game-lib-image.js b/src/game-lib-image.js index 615492e..efda900 100644 --- a/src/game-lib-image.js +++ b/src/game-lib-image.js @@ -160,7 +160,7 @@ GameLib.Image.prototype.getPixelData = function() { var imageData = context.getImageData(0, 0, this.width, this.height); var pixels = imageData.data; - + return pixels; }; @@ -177,6 +177,7 @@ GameLib.Image.prototype.getHeightData = function() { var pixels = this.getPixelData(); + var data = new Float32Array( this.width * this.height ); var height, i, j = 0;