1

I have some countries polygon. I want to draw them on top of my sphere with three js, but when I'm trying to draw these polygons, fps drop down, at 3fps....

Someone told me to create juste ONE geometry and include all the polygons into it, did you have an example?

What I'm doing:

foreach countrie in countries 
  geometry = new THREE.shapeGeometry();
  geometry.push(vectorArray);
  var mesh = new Mesh(geometry);
  globe.Add(mesh);

With over 250 countries, Three js just creates over 38k buffer. Strange behaviour, without any control, we shouldn't be able to create such buffers... so where am I wrong? I need help.

1 Answer 1

2

The three.js class THREE.GeometryUtils has a number of helpful methods for situations like these...

In particular, there is a merge method that will combine two Geometry objects into one. Assume that you have three geometry objects, country1, country2, country3. Then you could do something like:

temp = THREE.GeometryUtils.merge( country1, country2 );

allCountries = THREE.GeometryUtils.merge( temp, country3 );

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.