sczerwinski / wavefront-obj-intellij-plugin

IntelliJ platform plugin for Wavefront OBJ format
https://plugins.jetbrains.com/plugin/14843-wavefront-obj
Apache License 2.0
13 stars 1 forks source link

Cannot load meshes #489

Closed peci1 closed 1 year ago

peci1 commented 1 year ago

Steps

  1. Install the plugin into CLion 2023.1.2
  2. Open an OBJ file
  3. Choose Solid Shading (it is selected by default for me)
  4. The mesh is not rendered and the following exception is shown:
java.lang.IllegalArgumentException: Failed requirement. ``` java.lang.IllegalArgumentException: Failed requirement. at graphics.glimpse.types.Vec2$Companion.fromFloatList(Vec2.kt:331) at graphics.glimpse.meshes.MeshDataBuilder.addTextureCoordinates(MeshDataBuilder.kt:59) at it.czerwinski.intellij.wavefront.editor.gl.meshes.SolidFacesMeshFactory.create(SolidFacesMeshFactory.kt:34) at it.czerwinski.intellij.wavefront.editor.gl.meshes.ModelMeshesManager.createFacesMeshes(ModelMeshesManager.kt:61) at it.czerwinski.intellij.wavefront.editor.gl.meshes.ModelMeshesManager.initialize(ModelMeshesManager.kt:46) at it.czerwinski.intellij.wavefront.editor.gl.ObjPreviewScene.createModelMeshes(ObjPreviewScene.kt:135) at it.czerwinski.intellij.wavefront.editor.gl.ObjPreviewScene.initialize(ObjPreviewScene.kt:130) at it.czerwinski.intellij.wavefront.editor.gl.BaseScene.onCreate(BaseScene.kt:95) at graphics.glimpse.ui.GlimpsePanel$GlimpseEventListener.init(GlimpsePanel.kt:67) at jogamp.opengl.GLDrawableHelper.reshape(GLDrawableHelper.java:749) at com.jogamp.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:1442) at com.jogamp.opengl.awt.GLJPanel$10.run(GLJPanel.java:1521) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.opengl.awt.GLJPanel$OffscreenBackend.doPaintComponent(GLJPanel.java:2095) at com.jogamp.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:569) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1115) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at com.intellij.openapi.fileEditor.impl.EditorTabs.paintChildren(EditorTabbedContainer.kt:575) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:955) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1124) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5312) at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:247) at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1347) at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5260) at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5070) at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:882) at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:865) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:865) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:838) at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:787) at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1909) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:758) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$7(IdeEventQueue.kt:570) at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1446) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:570) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:380) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) ```

Unfortunately, I cannot share the problematic OBJ files. But this is their general structure:

# WaveFront *.obj file (generated by Autodesk ATF)

mtllib library.mtl

g Object1

v 465.644423 247.500000 612.100000
# ...
vt 0.707107 8.751580 0.000000
# ...
vn -0.034458 0.093876 0.000000
# ...
usemtl 191,191,191
f 14/1/1 1/2/2 15/3/3
# ...
# 1752 vertices
# 5081 texture params
# 4992 normals
# 3544 facets

# 8 groups

Displaying as Wireframe works.

I've noticed that deleting all f statements, I'm able to display in Solid shading mode, but the view is empty.

IDE Details

CLion 2023.1.2
Build #CL-231.8770.66, built on April 27, 2023
Licensed to Martin Pecka
Subscription is active until March 26, 2024.
For educational use only.
Runtime version: 17.0.6+10-b829.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.2.10-060210-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 6000M
Cores: 16
Registry:
    debugger.new.tool.window.layout=true
    run.processes.with.pty=TRUE
    ide.experimental.ui=true
    debugger.attach.dialog.enabled=true
    clion.clangd.max.memory=6000
    cidr.max.intellisense.file.length=3000000

Non-Bundled Plugins:
    com.jetbrains.plugins.ini4idea (231.8770.71)
    GLSL (1.24)
    com.nasller.CodeGlancePro (1.6.2)
    de.netnexus.camelcaseplugin (3.0.12)
    ros-integrate (0.1.7)
    it.czerwinski.intellij.wavefront (1.4.0-eap.1)
    org.plugin.dot.id (1.4.1)
    CMD Support (1.0.5)
    org.jetbrains.plugins.rest (231.8770.3)
    com.github.johnthagen.cppcheck (1.6.2)
    org.intellij.RegexpTester (1.0.8)
    org.asciidoctor.intellij.asciidoc (0.38.14)
    com.github.itechbear.clion.cpplint (1.0.7)

Current Desktop: ubuntu:GNOME

Stack Trace

No stack trace in IDE errors.

peci1 commented 1 year ago

This happened both in 1.4.0eap version and 1.3.1 stable.

sczerwinski commented 1 year ago

The reason is 3D texture coordinates, which are not supported in any of these versions:

vt 0.707107 8.751580 0.000000

Funny thing, I just made extensive changes in this part of code last night, and should be working in 452b9e03cad0584cca94f26192715ec1abec5e0a.

I'll include it in v1.4.0-eap.2 once it's released (probably within a week).

peci1 commented 1 year ago

Oh, great timing :-D I tested current master branch and it works! Thanks for the plugin.