boe666
Member
POLAND
Joined: Nov 21, 2018
Post Count: 21
Status:
Offline
|
|
Re: Export HTML5 plug-in
|
Before I ask and write more question - i checked this - it's not working. I thought i have to recalculate x,y from plain rec to virtual canvas (2d to 3d coordinates - x,y only of course). I was ready to check every x,y combination to check proper work getClosestItemsAt function. I change my code, this part:
function getMousePos(canvas, evt) { var rect = canvas.getBoundingClientRect(); console.log(rect); var x1 = evt.clientX - rect.x; var y1 = evt.clientY - rect.y; return { x: (x1), y: (y1) }; }
canvas.addEventListener("mouseup", function (e) { var mousePos = getMousePos(canvas, e); var x = mousePos.x; var y = mousePos.y; console.log('mousePos:'+x+','+y); var cams = HOME.getCamera(); console.log(cams); var obj = HPC.getComponent3D().getClosestItemAt(x, y); console.log("Finded objekt:"+obj); });
console after loading:
Error: WebGL warning: drawArrays: Drawing to a destination rect smaller than the viewport rect. (This warning will only be given once) viewmodel.min.js:20:53017 All items: viewHome.html:118:7 Array(98) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ] viewHome.html:119:4 All furnitures: viewHome.html:120:4 Array(80) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ] viewHome.html:121:4 WebGLRenderingContext { canvas: canvas#viewerCanvas.viewerComponent , drawingBufferWidth: 800, drawingBufferHeight: 600 } viewHome.html:133:3
console after click on canvas:
DOMRect { x: 11, y: 11, width: 802, height: 602, top: 11, right: 813, bottom: 613, left: 11 } viewHome.html:137:3 mousePos:640,214 viewHome.html:152:3 Object { properties: null, name: null, x: 329.2859606627597, y: 529.2522494347633, z: 1276.0331000000006, yaw: 4.714197, pitch: 1.5707964, fieldOfView: 1.0995575, time: 1492084800000, lens: 0, … } viewHome.html:154:3 Finded objekt:null viewHome.html:156:3 Error: WebGL warning: clear: This operation requires zeroing texture data. This is slow. viewmodel.min.js:20:55899 Error: WebGL warning: drawArrays: Texture level 0 would be read by TEXTURE_2D unit 0, but written by framebuffer attachment COLOR_ATTACHMENT0, which would be illegal feedback. viewmodel.min.js:20:53017 Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings) viewmodel.min.js:20:53017
make this errors problem? code is ok ? http://smarted.pl/sh3d/viewHome.html#
|
[Dec 12, 2018, 7:43:57 PM]
|
|
[Link]
|
|