Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 31
Posts: 31   Pages: 4   [ Previous Page | 1 2 3 4 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 18132 times and has 30 replies Next Thread
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Can I check this getClosestItemAt method ? Where is object's coordinates ? If I write x an y direct in code - this method still return null. I take x y coordinates from js console after selected object by code. i.e.:
selecting object:

HOME.setSelectedItems(itemSel);
console.log(itemSel);

and I take x y from itemSel[0].x and itemSel[0].y
I write this to my listener (from now always return this coordinates), and still i have null after use getClosestItemAt(x,y).

I thought i have to translate x,y from mouse, to have always the same coordinates, independed from actual view of camera, coresponding with object's x and y.
[Dec 11, 2018, 2:35:58 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Or maybe this is the problem. Shown after click on canvas.

Error: WebGL warning: drawArrays: Feedback loop detected between tex target 0x0de1, tex unit 0, levels 0-0; and framebuffer attachment 0x8ce0, level 0.
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

[Dec 11, 2018, 3:00:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

The problem is that you read too quickly the setSelectedItems jsdoc sad
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 11, 2018, 4:00:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

I don't understand. First of all I read all furnitures to table (FURNITURES[]). After this i print the links to select every funriture ( from this table). After click i do this:

var HOME = HPC.getHome();
var FURNITURES = HOME.getFurniture();

var itemSel = [FURNITURES[a]];
HOME.setSelectedItems(itemSel);
console.log(itemSel);
console.log("Selected by Link: ID:" + a +", name:"+itemSel[0].x);
var itemSel2 = HOME.getSelectedItems();
console.log("Read selected:" + a +", name:"+itemSel2[0].x);

every furniture has his own x and y coordinates. In console I have all object (with many data) in room (every furniture) after console.log(FURNITURES);
This is not problem with to fast reading.
How can I read proper x and y for one furniture ? (to check getClosestItemsAt)
[Dec 11, 2018, 5:13:27 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Maybe my questions are stupid and for many of You - "groundless", but I realy want understand structure of sweethome3d (in HTML5). Most (in my opinion - almost all) posts on this forum concerns on java version and problems with aplication ( directly on "painting" models). Can you show me the way to do this ? For example - if I confirm what x,y coordinates work with getClosestItemsAt, I will find the way how to calculate x,y depend of actual camera view. I want to eliminate errors before I started, I want to be sure I'm not making a simple mistake.
[Dec 12, 2018, 8:17:16 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Your questions are not stupid, but most contributors in the forum are Sweet Home 3D users, not programmers (and even less JavaScript programmers). If you want to understand how to use Sweet Home 3D JS, learn how to use the debugger in your browser, this will help you in many cases.
By the way, getClosestItemsAt method takes in parameter 2D coordinates, so translating to canvas space just consist of substracting rect.x and rect.y from e.clientX and e.clientY. Measuring pixel locations at screen with your mouse pointer would have given you the solution...
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 12, 2018, 6:16:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
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] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

somebody can can check the code ? Now it's ok ? If ok, why it not working ? Maybe the errors are the problem ? Ho to eliminate this errors ?
[Dec 15, 2018, 3:28:29 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Somebody ????
[Dec 18, 2018, 9:48:14 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
boe666
Member



POLAND
Joined: Nov 21, 2018
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export HTML5 plug-in

Maybe, in first days of new year, somebody show my indolence.. I realy don't know why .getClosestItemAt(x, y) doesn't work....
[Jan 3, 2019, 2:07:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 31   Pages: 4   [ Previous Page | 1 2 3 4 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved