Open morgoth990 opened 2 years ago
You can implement IPool
yourself and pass an instance of it to the Tess
constructor. I don't know if using JIT or not is detectable to remove this code from the DefaultTypePool
at compile time and return new T()
instead, I can accept a PR if you find a way to do that.
Just read your issue again, I'm also not sure why Creator
can't be replaced with new T()
.
I have tested some cases with hundreds of complex contours and seem to work fine without any noticeable performance changes
+1 Compiling this library for Unity on WebGL causes issues because of the Pool class.
+1
291614 03-23 11:09:14.573 11793 11880 E Unity : System.TypeInitializationException: The type initializer for 'LibTessDotNet.DefaultTypePool<LibTessDotNet.Mesh>' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
System.TypeInitializationException: The type initializer for 'LibTessDotNet.DefaultTypePool<LibTessDotNet.Mesh>' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
291787 03-23 11:09:14.576 11793 11880 E Unity : System.NullReferenceException: Object reference not set to an instance of an object.
+1
291614 03-23 11:09:14.573 11793 11880 E Unity : System.TypeInitializationException: The type initializer for 'LibTessDotNet.DefaultTypePool<LibTessDotNet.Mesh>' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
System.TypeInitializationException: The type initializer for 'LibTessDotNet.DefaultTypePool<LibTessDotNet.Mesh>' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object. 291787 03-23 11:09:14.576 11793 11880 E Unity : System.NullReferenceException: Object reference not set to an instance of an object.
I am in this repos for different reasons, but also working in a Unity WebGL project. Have not seen this problem yet, but likely it might be aggressive stripping. Did you try to manually inform the compiler to keep some of the classes? The same can happen if you add a SphereCollider with code only for example.
I'm compiling the library in a project without JIT compilation. On an older version everything was working fine but now I'm receiving an exception in DefaultTypePool.Creator.
The Creator is compiling at runtime but without JIT compilation can't work. Is the Creator needed? Can't DefaultTypePool.Get() just return new T() ?