//private constructor private DataSource4DS(int key, string rootpath, int activeRangeBegin, int activeRangeEnd, OUT_RANGE_MODE outRangeMode, ref bool success, ref string errorMsg) { this.FDVUUID = 0; success = true; //Create sequence with native plugin GCHandle errorMsgHandle = GCHandle.Alloc(errorMsg, GCHandleType.Pinned); this.FDVUUID = Bridge4DS.CreateSequence(key, rootpath, activeRangeBegin, activeRangeEnd, outRangeMode, errorMsgHandle.AddrOfPinnedObject()); errorMsg = Marshal.PtrToStringAnsi(errorMsgHandle.AddrOfPinnedObject()); if (this.FDVUUID == 0) { success = false; } //Get sequence info if (success) { #if (UNITY_ANDROID || UNITY_IOS || UNITY_LUMIN) && !UNITY_EDITOR Bridge4DS.AddASTCSupport(this.FDVUUID); #else Bridge4DS.AddDXTSupport(this.FDVUUID); #endif this.TextureSize = Bridge4DS.GetTextureSize(this.FDVUUID); if (this.TextureSize == 0) { this.TextureSize = 1024; //put 1024 by default => will crash if we have 2048 texture and it's not written in xml fi } int textureEncoding = Bridge4DS.GetTextureEncoding(this.FDVUUID); switch (textureEncoding) { case 5: case 120: this.TextureFormat = TextureFormat.ETC_RGB4; break; case 6: case 130: this.TextureFormat = TextureFormat.PVRTC_RGB4; break; case 4: case 131: this.TextureFormat = TextureFormat.PVRTC_RGB2; break; case 1: case 100: #if (UNITY_ANDROID || UNITY_IOS || UNITY_LUMIN) && !UNITY_EDITOR this.TextureFormat = TextureFormat.RGBA32; #else this.TextureFormat = TextureFormat.DXT1; #endif break; case 8: case 164: #if (UNITY_ANDROID || UNITY_IOS || UNITY_LUMIN) && !UNITY_EDITOR this.TextureFormat = TextureFormat.ASTC_8x8; #else this.TextureFormat = TextureFormat.RGBA32; #endif break; default: #if UNITY_IOS this.TextureFormat = TextureFormat.PVRTC_RGB4; #elif UNITY_ANDROID this.TextureFormat = TextureFormat.ETC_RGB4; #else this.TextureFormat = TextureFormat.DXT1; #endif break; } this.MaxVertices = Bridge4DS.GetSequenceMaxVertices(this.FDVUUID); if (this.MaxVertices == 0) { this.MaxVertices = 65535; } this.MaxTriangles = Bridge4DS.GetSequenceMaxTriangles(this.FDVUUID); if (this.MaxTriangles == 0) { this.MaxTriangles = 65535; } this.FrameRate = (float)Bridge4DS.GetSequenceFramerate(this.FDVUUID); } }