I need to place a specific number of circles on the scene.
var radius = 1;
var segments = 32;
var circleGeometry = new THREE.CircleGeometry( radius, segments);
function generateCircles(){
//scene.remove(circle);
var count=0;
while (1000> count) {
circle = new THREE.Mesh (circleGeometry, material);
scene.add (circle);
count ++;
}
}
Is this the most efficient way to achieve my goal?
In my code, I invoke this function. However, every time it is called, the performance becomes slower, possibly due to increased objects in the scene. What steps can I take to address this issue?
Whenever the function is called, I want all previously generated circles to be completely removed from memory before adding new ones. This will help improve application speed, as running the function multiple times results in an accumulation of circles that slows down execution.
By "slower", I mean that I am aiming for faster application performance. As more circles are added with each function call, I want them to be cleared sooner to make room for new ones. The presence of numerous circles in the scene hinders smooth execution.