aalavandhaann / blueprint-js

The Javascript es6 version of the original furnishup/blueprint3d. Need some royalty free low poly models for the inventory. Can someone help me with this?
MIT License
493 stars 156 forks source link

Importing Floorplan generated from Polygons, generates error "Duplicate point 0:0" #51

Closed guy16510 closed 4 years ago

guy16510 commented 4 years ago

Describe the bug I modeled JSON to mirror exactly the output of a 'design.Blueprint3d' file. When doing that I get a three.js error Duplicate point 0:0

Would you have an example of loading a custom polygon into the framework, without using the UI editor?

Thank you

aalavandhaann commented 4 years ago

Can you please share the json file?

guy16510 commented 4 years ago

Here was the JSON I was using. I generate this on my own, and run the

blueprint3d.model.loadSerialized (JSON.stringify (JSON_BELOW));

Really appreciate the help!

"{"floorplan":{"corners":{"eb6a5efc-ff2a-4150-ba4c-9d12ea82c6be":{"x":436.6492141913143,"y":62.82721362855489},"7362c5d9-68eb-4b89-a656-12f8562b185b":{"x":436.6492141913143,"y":77.48690180161014},"e1671a74-d3ee-4aee-83ba-97e099018279":{"x":334.0314136234578,"y":77.48690180161014},"3cd1af81-75f8-4409-87ec-037c5b9f315b":{"x":334.0314136234578,"y":224.08376688863243},"7331dad7-5bfe-48ca-bff4-a5fbe9751b5d":{"x":363.35078164780316,"y":224.08376688863243},"28b4ccc2-da43-4df1-b36f-f62d9e6c5f3c":{"x":363.35078164780316,"y":253.40313491297775},"cbe89f59-54ba-4d6b-9998-7a5d620c08e0":{"x":334.0314136234578,"y":253.40313491297775},"6582d9f3-5f83-4cb4-a945-f23f1be766b4":{"x":334.0314136234578,"y":400},"e1629387-bd95-41c3-be7f-c8c9caf9c30b":{"x":407.3298420060863,"y":400},"7f52c287-0681-4522-be98-04cd07179b7c":{"x":407.3298420060863,"y":443.9790561974006},"26b298f1-8d99-45be-8cca-7b774c9938aa":{"x":465.9685863765422,"y":443.9790561974006},"4b864bf1-acaf-461b-84b1-12141963e6e9":{"x":465.9685863765422,"y":62.82721362855489},"504c010a-baec-4735-965c-470174dbdb80":{"x":436.6492141913143,"y":62.82721362855489}},"walls":[{"corner1":"504c010a-baec-4735-965c-470174dbdb80","corner2":"eb6a5efc-ff2a-4150-ba4c-9d12ea82c6be","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"7362c5d9-68eb-4b89-a656-12f8562b185b","corner2":"e1671a74-d3ee-4aee-83ba-97e099018279","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"e1671a74-d3ee-4aee-83ba-97e099018279","corner2":"3cd1af81-75f8-4409-87ec-037c5b9f315b","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"3cd1af81-75f8-4409-87ec-037c5b9f315b","corner2":"7331dad7-5bfe-48ca-bff4-a5fbe9751b5d","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"7331dad7-5bfe-48ca-bff4-a5fbe9751b5d","corner2":"28b4ccc2-da43-4df1-b36f-f62d9e6c5f3c","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"28b4ccc2-da43-4df1-b36f-f62d9e6c5f3c","corner2":"cbe89f59-54ba-4d6b-9998-7a5d620c08e0","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"cbe89f59-54ba-4d6b-9998-7a5d620c08e0","corner2":"6582d9f3-5f83-4cb4-a945-f23f1be766b4","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"6582d9f3-5f83-4cb4-a945-f23f1be766b4","corner2":"e1629387-bd95-41c3-be7f-c8c9caf9c30b","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"e1629387-bd95-41c3-be7f-c8c9caf9c30b","corner2":"7f52c287-0681-4522-be98-04cd07179b7c","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"7f52c287-0681-4522-be98-04cd07179b7c","corner2":"26b298f1-8d99-45be-8cca-7b774c9938aa","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"26b298f1-8d99-45be-8cca-7b774c9938aa","corner2":"4b864bf1-acaf-461b-84b1-12141963e6e9","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"4b864bf1-acaf-461b-84b1-12141963e6e9","corner2":"504c010a-baec-4735-965c-470174dbdb80","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}},{"corner1":"504c010a-baec-4735-965c-470174dbdb80","corner2":"eb6a5efc-ff2a-4150-ba4c-9d12ea82c6be","frontTexture":{"url":"rooms/textures/wallmap.png","stretch":true,"scale":0},"backTexture":{"url":"rooms/textures/walllightmap.png","stretch":true,"scale":null}}],"wallTextures":[],"floorTextures":{},"newFloorTextures":{"eb6a5efc-ff2a-4150-ba4c-9d12ea82c6be,7362c5d9-68eb-4b89-a656-12f8562b185b,e1671a74-d3ee-4aee-83ba-97e099018279,3cd1af81-75f8-4409-87ec-037c5b9f315b,7331dad7-5bfe-48ca-bff4-a5fbe9751b5d,28b4ccc2-da43-4df1-b36f-f62d9e6c5f3c,cbe89f59-54ba-4d6b-9998-7a5d620c08e0,6582d9f3-5f83-4cb4-a945-f23f1be766b4,e1629387-bd95-41c3-be7f-c8c9caf9c30b,7f52c287-0681-4522-be98-04cd07179b7c,26b298f1-8d99-45be-8cca-7b774c9938aa,4b864bf1-acaf-461b-84b1-12141963e6e9,504c010a-baec-4735-965c-470174dbdb80":{"url":"rooms/textures/light_fine_wood.jpg","scale":null}}},"items":[]}"

I believe I am generating the polygons correctly, since it is the same function I use to generate canvas drawing in vanilla javascript.

Hey I figured it out.

guy16510 commented 4 years ago

Closing the issue. I messed up the points (had too many, the last 1 references the first one which is not needed). I also needed to update the walls.