fsinisi90
fsinisi90

Reputation: 1158

Difference between ObjLoader and ObjLoader2 in Three.js

What's the main difference between this two classes, ObjLoader and ObjLoader2?

In which case we should use one or another?

Why there are two classes? Is one more stable or efficient than the other?

It's not very clear for me when I read the documentation.

Upvotes: 11

Views: 4374

Answers (3)

phreakhead
phreakhead

Reputation: 15239

Found some interesting comparisons by the creator here:

╔════════════════════════════════════╦═══════════╦════════════╗
║ Feature                            ║ OBJLoader ║ OBJLoader2 ║
╠════════════════════════════════════╬═══════════╬════════════╣
║Handle all face types               ║     x     ║     x      ║
║Support for points and lines        ║     x     ║     x      ║
║Negative face indices               ║     x     ║     x      ║
║Support Ngons                       ║     x     ║     x      ║
║Flat/Smooth Multi-Materials         ║           ║     x      ║
║Indexed Rendering                   ║           ║     x      ║
║Handle Face-Type change inside group║           ║     x      ║
║Deactivate console logging          ║           ║     x      ║
║Load MTLs via MTLLoader if desired  ║           ║     x      ║
╚════════════════════════════════════╩═══════════╩════════════╝

Upvotes: 9

欧阳维杰
欧阳维杰

Reputation: 1768

For now, The main difference is that the OBJLoader2 supports web worker for asynchronous loading. And it offer a choice for user between syn and asyn.

Upvotes: 5

2pha
2pha

Reputation: 10155

I have sometimes wondered this too..
So I decided this time to jump down the rabbit hole (writing this post as I go down the hole).

This is what I have found.

  • The first commit of OBJLoader2 had the comment "Added Geometry2 based OBJLoader." by mrdoob as seen here.
  • Geometry2 seems to have been part of some experiments to combine the ease of use of Geometry with the performance of BufferGeometry. An issue mentioning Geometry2 can be viewed here.
  • There are recent commits for both OBJLoader and OBJLoader2.
  • All the recent commits seem to be from a single person (kaisalmen)

So, It seems to me that OBJLoader2 is meant to be a more performant loader for OBJ files. Having a look at The main commiter's github page reveals a repository specifically for the OBJLoader2 class.
There is documentation on the OBJLoader2 class in the authors github repository here

Upvotes: 11

Related Questions