Looking for the Tree in the backend 3D model of Three.js

Lately, I've been exploring various WebGL showcases and came across three.js, a widely popular framework that even has its own dedicated book by Toni Parsli. Upon examining the source code of three.js, I was surprised not to find any traditional scene tree structures like BSP or k-d-trees.

Instead, I discovered the "Flattened List" which appears to hold all the objects:

This revelation left me quite puzzled. Why use a flat data structure for storing the scene when trees would seem like a more optimal solution?

I wonder if I overlooked a tree structure within the source code or perhaps there's something about scene graph optimization that eludes me.

Additionally, I pondered whether the Flattened List serves as an intermediary object after pruning the scene graph. However, I couldn't find confirmation of this in the source code, despite indications on .

Answer №1

There was no need to incorporate a back-end tree structure into the system.

If a tree structure is required at the application level, consider checking out this GitHub repository or this code snippet.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Dynamically select checkbox groups based on items already listed in a textarea

Hello! Would you be able to review this example and provide guidance on how I can use jQuery to dynamically select the checkboxes that have the same text as in the textarea below? <br /> <br /> Default Items From Database <br /> < ...

Obtain Dates in a Uniform Structure

I have a function that retrieves the date based on specific conditions (last 30 days). const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); const startTime = start.toLocaleString().split(",")[0]; console.log(startTime) On M ...

Is there a CSS workaround for the "not" statement? Perhaps an alternative method like superfish?

I've searched online for a solution but haven't found one yet. I'm currently using the superfish dropdown menu and I want to round the top li items, excluding those with ul's inside. You can see a demo on this test page: Check out the ...

What is the best way to utilize the node.js module passport-google?

I'm currently working on a node.js web application that prompts users to sign in using their Gmail account. While following instructions provided at this website, I modified the URL from www.example.com to localhost and launched the application. Howev ...

Just hide the deleted message with a slideUp animation

I have implemented a PM system with a delete-message feature. The form I created checks for the message_id and message_title, posts to delete_message.php page, and deletes the message without refreshing the page through Javascript. There are two functions ...

The Importance of Strict Contextual Escaping in ReactJS

When making an API call, we receive a URL in the response. In Angular JS, we can ensure the safety of this URL by using $sce.trustAsResourceUrl. Is there an equivalent function to trustAsResourceUrl in React JS? In Angular, //Assuming 'response&apos ...

JavaScript - Issue encountered while reaching the bottom of the webpage

While conducting tests using Firebug/Firefox, I am trying to execute a simple command that will scroll the page to the bottom. Here is the command: window.scrollBy(0,3000); Seems straightforward, right? When testing on certain websites like Yahoo.com ...

Similar to the functionality of $.fn.load but without the need for jQuery

My goal is to dynamically load Jade content into a specific div when a button is clicked. After researching how to achieve this with jQuery, I found several posts recommending the use of the following code snippet: $('#div').load('/somePage& ...

Transmit a JSON object while simultaneously receiving the corresponding response

As part of a school project, I need to work with JSON. The server will process the file and send back a response in JSON format. This entire exchange needs to be done using JavaScript. I recently learned about the XMLHttpRequest object, but I'm still ...

Insert multiple text box values as a new entry in an SQL database

Currently, I am implementing a code snippet to incorporate additional text boxes within a form. The main purpose is to enable users to input multiple languages they are proficient in. <script> jQuery(function($) { var i = 0; ...

When the content within a dialog element exceeds the boundaries of the dialog, it will not be displayed

Issue Struggling with creating a dialog element that includes an x button for closing the <dialog> in the upper-right corner. My initial idea was to utilize absolute positioning and transforms to achieve this functionality, but encountered a setback ...

Angular allows for displaying objects within other objects using interpolation

Below is the object stored in EntryList variable within my component: { "id": 0, "startAddress": { "id": 6, "addressString": "addressString" }, "endAddress": { ...

Implementing the sorting feature in Angular JS to properly align sub sections with their correct parent sections

I'm facing an issue with the functionality of my sample code. Users can add sections and subsections within those sections, which are sortable using ui-sortable. However, after sorting the items, if I try to add a new sub-section to Section 2, it wron ...

Telerik Nested perspective

Here is the code snippet that I am currently working on, which involves a nested grid from Telerik: I've encountered an issue with using JavaScript to locate and interact with controls named "PreviousDate" and "DateofBirth". <%@ Page Language="c# ...

Exploring materials using a loop in Three.js

Searching for a specific material named COIN and assigning a new texture to it can be achieved by looping through the materials in an object. The goal is to find a match based on the material name, regardless of its index within the material array. object. ...

If there is a setTimeout, the sequence of the output will vary

Using a recursive function, I implemented the code to log the tree structure into console.log. To introduce delays during processing, I included setTimeout in the code. However, adding setTimeout resulted in a different output order during processing, with ...

I encountered a TypeError when trying to create a jQuery plugin after I made changes to the String

When attempting to create a jQuery plugin after modifying String.prototype, a TypeError may be encountered. This raises the question of whether this is a bug in jQuery. The issue arises with function ordering and now it is necessary to prioritize creating ...

What are the implications of declaring a controller as a variable within itself or utilizing $scope?

As I dive into learning and utilizing AngularJS, certain concepts still remain unclear to me. Here is my query: within my application, there is a controller that utilizes $http to fetch data from the backend upon initialization. Following a comprehensive ...

Custom React component - DataGrid

Just starting out in the world of React and attempting to create a custom component with parameters. I'm curious about the correct approach for achieving this. Here's my current code snippet - how do I properly pass Columns, ajax, and datasourc ...

Incorporating an HTML header into a QNetworkReply

I have implemented a customized QNetworkAccessManager and subclassed QNetworkReply to handle unique AJAX requests from a JavaScript application. It is functioning mostly as expected, but I have encountered an issue where my network replies seem to be missi ...