├── .gitignore ├── Assets ├── CameraMove.cs ├── CameraMove.cs.meta ├── ReaderOSGB.meta ├── ReaderOSGB │ ├── GeometryData.cs │ ├── GeometryData.cs.meta │ ├── GeometryUtils.cs │ ├── GeometryUtils.cs.meta │ ├── ObjectBase.cs │ ├── ObjectBase.cs.meta │ ├── PagedData.cs │ ├── PagedData.cs.meta │ ├── ReaderOSGB.cs │ ├── ReaderOSGB.cs.meta │ ├── TaskManager.cs │ ├── TaskManager.cs.meta │ ├── TextureUtils.cs │ ├── TextureUtils.cs.meta │ ├── osg_Array.cs │ ├── osg_Array.cs.meta │ ├── osg_BufferData.cs │ ├── osg_BufferData.cs.meta │ ├── osg_BufferObject.cs │ ├── osg_BufferObject.cs.meta │ ├── osg_Callback.cs │ ├── osg_Callback.cs.meta │ ├── osg_ClusterCullingCallback.cs │ ├── osg_ClusterCullingCallback.cs.meta │ ├── osg_CoordinateSystemNode.cs │ ├── osg_CoordinateSystemNode.cs.meta │ ├── osg_DrawArrays.cs │ ├── osg_DrawArrays.cs.meta │ ├── osg_DrawElementsUByte.cs │ ├── osg_DrawElementsUByte.cs.meta │ ├── osg_DrawElementsUInt.cs │ ├── osg_DrawElementsUInt.cs.meta │ ├── osg_DrawElementsUShort.cs │ ├── osg_DrawElementsUShort.cs.meta │ ├── osg_Drawable.cs │ ├── osg_Drawable.cs.meta │ ├── osg_Drawable_2.cs │ ├── osg_Drawable_2.cs.meta │ ├── osg_ElementBufferObject.cs │ ├── osg_ElementBufferObject.cs.meta │ ├── osg_EllipsoidModel.cs │ ├── osg_EllipsoidModel.cs.meta │ ├── osg_Geode.cs │ ├── osg_Geode.cs.meta │ ├── osg_Geometry.cs │ ├── osg_Geometry.cs.meta │ ├── osg_Geometry_2.cs │ ├── osg_Geometry_2.cs.meta │ ├── osg_Group.cs │ ├── osg_Group.cs.meta │ ├── osg_LOD.cs │ ├── osg_LOD.cs.meta │ ├── osg_Material.cs │ ├── osg_Material.cs.meta │ ├── osg_MatrixTransform.cs │ ├── osg_MatrixTransform.cs.meta │ ├── osg_Node.cs │ ├── osg_Node.cs.meta │ ├── osg_NodeCallback.cs │ ├── osg_NodeCallback.cs.meta │ ├── osg_Object.cs │ ├── osg_Object.cs.meta │ ├── osg_PagedLOD.cs │ ├── osg_PagedLOD.cs.meta │ ├── osg_PrimitiveSet.cs │ ├── osg_PrimitiveSet.cs.meta │ ├── osg_ShadeModel.cs │ ├── osg_ShadeModel.cs.meta │ ├── osg_StateAttribute.cs │ ├── osg_StateAttribute.cs.meta │ ├── osg_StateSet.cs │ ├── osg_StateSet.cs.meta │ ├── osg_Texture.cs │ ├── osg_Texture.cs.meta │ ├── osg_Texture2D.cs │ ├── osg_Texture2D.cs.meta │ ├── osg_Transform.cs │ ├── osg_Transform.cs.meta │ ├── osg_Vec2Array.cs │ ├── osg_Vec2Array.cs.meta │ ├── osg_Vec3Array.cs │ ├── osg_Vec3Array.cs.meta │ ├── osg_Vec4Array.cs │ ├── osg_Vec4Array.cs.meta │ ├── osg_Vec4ubArray.cs │ ├── osg_Vec4ubArray.cs.meta │ ├── osg_VertexBufferObject.cs │ └── osg_VertexBufferObject.cs.meta ├── Scenes.meta └── Scenes │ ├── osgb_loader.unity │ ├── osgb_loader.unity.meta │ ├── osgb_loaderSettings.lighting │ └── osgb_loaderSettings.lighting.meta ├── LICENSE ├── NativePlugin ├── CMakeLists.txt ├── Export.cpp ├── Export.h ├── InterfaceBase.h ├── Intersector.cpp ├── Intersector.h ├── PluginsAPI │ ├── IUnityEventQueue.h │ ├── IUnityGraphics.h │ ├── IUnityGraphicsD3D11.h │ ├── IUnityGraphicsD3D12.h │ ├── IUnityGraphicsD3D9.h │ ├── IUnityGraphicsMetal.h │ └── IUnityInterface.h ├── UpdateDatabasePager.cpp └── UpdateDatabasePager.h ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── AutoStreamingSettings.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── MemorySettings.asset ├── NavMeshAreas.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── SceneTemplateSettings.json ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset ├── XRSettings.asset └── boot.config ├── README.md └── UserSettings ├── EditorUserSettings.asset └── Layouts └── default-2021.dwlt /.gitignore: -------------------------------------------------------------------------------- 1 | /Library 2 | /Temp 3 | /Logs 4 | /obj 5 | /.vs 6 | -------------------------------------------------------------------------------- /Assets/CameraMove.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class CameraMove : MonoBehaviour 7 | { 8 | public float MRotationSpeed ; 9 | public float MMoveSpeed ; 10 | public float keySpeed ; 11 | 12 | private Vector3 rotaVector3; 13 | 14 | private float xspeed = -2f;//旋转速度 15 | private float yspeed = 4f; 16 | 17 | private double lastKickTime; // 上一次鼠标抬起的时间(用来处理双击) 18 | public bool _cameraRotation = false; 19 | 20 | public float moveSpeed = 150; // 设置相机移动速度 21 | 22 | public bool isOperationCamera = true;//摄像机移动开关 23 | private Vector3 currentVelocity; 24 | 25 | private void Start() 26 | { 27 | MRotationSpeed = sliderValue(PlayerPrefs.GetFloat("MRotationSpeed", 100)); 28 | MMoveSpeed = sliderValue(PlayerPrefs.GetFloat("MMoveSpeed", 100)); 29 | keySpeed = sliderValue(PlayerPrefs.GetFloat("keySpeed", 100)); 30 | 31 | rotaVector3 = transform.localEulerAngles; 32 | lastKickTime = Time.realtimeSinceStartup; 33 | 34 | } 35 | void Update() 36 | { 37 | if (isOperationCamera) 38 | { 39 | //旋转 40 | //if (Input.GetMouseButton(1)) 41 | { 42 | if (Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.forward * 5*keySpeed); } 43 | if (Input.GetKey(KeyCode.A)) { transform.Translate(Vector3.left * 5 * keySpeed); } 44 | if (Input.GetKey(KeyCode.S)) { transform.Translate(Vector3.back * 5 * keySpeed); } 45 | if (Input.GetKey(KeyCode.D)) { transform.Translate(Vector3.right * 5 * keySpeed); } 46 | if (Input.GetKey(KeyCode.Q)) { transform.Translate(Vector3.up * 5 * keySpeed); } 47 | if (Input.GetKey(KeyCode.E)) { transform.Translate(Vector3.down * 5 * keySpeed); } 48 | } 49 | //Vector3 oldCameraPosition = transform.position; 50 | // 当按住鼠标中键的时候 51 | if (Input.GetMouseButton(2)) 52 | { 53 | MoveCamera(); 54 | } 55 | else if (Input.GetMouseButton(0)) 56 | { 57 | float y = Input.GetAxis("Mouse X") * xspeed; 58 | float x = Input.GetAxis("Mouse Y") * xspeed; 59 | 60 | this.transform.Rotate(new Vector3(x,y,0)); 61 | 62 | Vector3 startPos = transform.position; 63 | 64 | 65 | } 66 | 67 | MouseZoomCamera(); 68 | 69 | } 70 | } 71 | 72 | public void MouseZoomCamera() 73 | { 74 | float wheel = Input.GetAxis("Mouse ScrollWheel"); 75 | if (wheel > 0.25f|| wheel < -0.25f) 76 | { 77 | wheel *= Time.deltaTime * 500*MMoveSpeed; 78 | } 79 | else 80 | { 81 | wheel *= Time.deltaTime *100 * MMoveSpeed; 82 | } 83 | 84 | //改变相机的位置 85 | transform.Translate(Vector3.forward * wheel); 86 | 87 | } 88 | public void MoveCamera() 89 | { 90 | float h = Input.GetAxis("Mouse X") * moveSpeed * Time.deltaTime/2.0f*0.5f; 91 | float v = Input.GetAxis("Mouse Y") * moveSpeed * Time.deltaTime/2.0f*0.5f; 92 | // 设置当前摄像机移动,z轴并不改变 93 | this.transform.Translate(-h, -v, 0, Space.Self); 94 | } 95 | 96 | public void stopMove() 97 | { 98 | _cameraRotation = false; 99 | } 100 | public float sliderValue(float m_slider) 101 | { 102 | float Num = 1; 103 | if (m_slider <= 100) 104 | { 105 | Num = (((float)m_slider) / 100); 106 | } 107 | else if (m_slider > 100) 108 | { 109 | Num = ((int)m_slider - 100) / 2; 110 | } 111 | if (Num == 0) 112 | { 113 | Num = 1; 114 | } 115 | return Num; 116 | } 117 | 118 | } -------------------------------------------------------------------------------- /Assets/CameraMove.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2f7988a25f36d94fa11627ed6ce6bb2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55b3029120fdfcc469d449eb09f81c82 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/GeometryData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class GeometryData : MonoBehaviour 9 | { 10 | public int _mode, _maxIndex = 0; 11 | public List _vec2Array; 12 | public List _vec3Array; 13 | public List _vec4Array; 14 | public List _vec4ubArray; 15 | public List _indices = new List(); 16 | 17 | public void addPrimitiveIndices(List localIndices) 18 | { 19 | switch (_mode) 20 | { 21 | case 4: // TRIANGLES 22 | _indices.AddRange(localIndices); 23 | break; 24 | case 5: // TRIANGLE_STRIP 25 | for (int i = 2; i < localIndices.Count; ++i) 26 | { 27 | if ((i % 2) == 0) 28 | { 29 | _indices.Add(localIndices[i - 2]); 30 | _indices.Add(localIndices[i - 1]); 31 | } 32 | else 33 | { 34 | _indices.Add(localIndices[i - 1]); 35 | _indices.Add(localIndices[i - 2]); 36 | } 37 | _indices.Add(localIndices[i]); 38 | } 39 | break; 40 | case 6: // TRIANGLE_FAN 41 | for (int i = 2; i < localIndices.Count; ++i) 42 | { 43 | _indices.Add(localIndices[0]); 44 | _indices.Add(localIndices[i - 1]); 45 | _indices.Add(localIndices[i]); 46 | } 47 | break; 48 | default: 49 | Debug.LogWarning("Unsupported primitive mode " + _mode); 50 | break; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/GeometryData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ac34b43b2555bb4aa5e5a107ef1077f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/GeometryUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5784ca201c5a68241ac0fbac4c5c2b9c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/ObjectBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class ObjectBase 9 | { 10 | #if UNITY_WEBGL || UNITY_EDITOR 11 | public static Dictionary> ctorFunc = 12 | new Dictionary>() { 13 | { "osg_Object", () => { return new osg_Object(); } }, 14 | { "osg_LOD", () => { return new osg_LOD(); } }, 15 | { "osg_Node", () => { return new osg_Node(); } }, 16 | { "osg_PagedLOD", () => { return new osg_PagedLOD(); } }, 17 | { "osg_Group", () => { return new osg_Group(); } }, 18 | { "osg_Transform", () => { return new osg_Transform(); } }, 19 | { "osg_MatrixTransform", () => { return new osg_MatrixTransform(); } }, 20 | { "osg_Geode", () => { return new osg_Geode(); } }, 21 | { "osg_Drawable", () => { return new osg_Drawable(); } }, 22 | { "osg_Drawable_2", () => { return new osg_Drawable_2(); } }, 23 | { "osg_Geometry", () => { return new osg_Geometry(); } }, 24 | { "osg_Geometry_2", () => { return new osg_Geometry_2(); } }, 25 | { "osg_BufferData", () => { return new osg_BufferData(); } }, 26 | { "osg_DrawArrays", () => { return new osg_DrawArrays(); } }, 27 | { "osg_DrawElementsUByte", () => { return new osg_DrawElementsUByte(); } }, 28 | { "osg_DrawElementsUShort", () => { return new osg_DrawElementsUShort(); } }, 29 | { "osg_DrawElementsUInt", () => { return new osg_DrawElementsUInt(); } }, 30 | { "osg_Vec2Array", () => { return new osg_Vec2Array(); } }, 31 | { "osg_Vec3Array", () => { return new osg_Vec3Array(); } }, 32 | { "osg_Vec4Array", () => { return new osg_Vec4Array(); } }, 33 | { "osg_Vec4ubArray", () => { return new osg_Vec4ubArray(); } }, 34 | { "osg_StateSet", () => { return new osg_StateSet(); } }, 35 | { "osg_StateAttribute", () => { return new osg_StateAttribute(); } }, 36 | { "osg_Material", () => { return new osg_Material(); } }, 37 | { "osg_Texture", () => { return new osg_Texture(); } }, 38 | { "osg_Texture2D", () => { return new osg_Texture2D(); } }, 39 | }; 40 | #endif 41 | 42 | public static string ReadString(BinaryReader reader) 43 | { 44 | int strLength = reader.ReadInt32(); 45 | byte[] bytes = reader.ReadBytes(strLength); 46 | return System.Text.Encoding.UTF8.GetString(bytes); 47 | //char[] compressor = reader.ReadChars(strLength); 48 | //return new string(compressor); 49 | } 50 | 51 | public static long ReadBracket(BinaryReader reader, ReaderOSGB owner) 52 | { 53 | if (owner._useBrackets) 54 | { 55 | if (owner._version > 148) return reader.ReadInt64(); 56 | else return reader.ReadInt32(); 57 | } 58 | return -1; 59 | } 60 | 61 | public static Texture2D LoadImage(Object gameObj, BinaryReader reader, ReaderOSGB owner) 62 | { 63 | Texture2D tex2D = null; 64 | if (owner._version > 94) { string className = ReadString(reader); } 65 | 66 | uint id = reader.ReadUInt32(); 67 | if (owner._sharedTextures.ContainsKey(id)) 68 | return owner._sharedTextures[id]; 69 | 70 | string fileName = ReadString(reader); 71 | int writeHint = reader.ReadInt32(); 72 | int decision = reader.ReadInt32(); 73 | switch (decision) 74 | { 75 | case 0: // IMAGE_INLINE_DATA 76 | { 77 | int origin = reader.ReadInt32(); 78 | int s = reader.ReadInt32(); 79 | int t = reader.ReadInt32(); 80 | int r = reader.ReadInt32(); 81 | int internalFormat = reader.ReadInt32(); 82 | int pixelFormat = reader.ReadInt32(); 83 | int dataType = reader.ReadInt32(); 84 | int packing = reader.ReadInt32(); 85 | int mode = reader.ReadInt32(); 86 | 87 | uint size = reader.ReadUInt32(); 88 | byte[] imageData = reader.ReadBytes((int)size); 89 | if (size > 0) 90 | { 91 | TextureFormat format = TextureFormat.RGB24; // TODO: other formats/data size 92 | if (dataType == 0x1401) 93 | { 94 | if (pixelFormat == 0x1907) format = TextureFormat.RGB24; // GL_RGB 95 | else if (pixelFormat == 0x1908) format = TextureFormat.RGBA32; // GL_RGBA 96 | else if (pixelFormat == 0x80E1) format = TextureFormat.BGRA32; // GL_BGRA 97 | else if (pixelFormat == 0x83F0) 98 | format = TextureFormat.DXT1; // GL_COMPRESSED_RGB_S3TC_DXT1_EXT 99 | else if (pixelFormat == 0x83F3) 100 | format = TextureFormat.DXT5; // GL_COMPRESSED_RGB_S3TC_DXT5_EXT 101 | else Debug.LogWarning("Unsupported texture pixel format " + pixelFormat); 102 | } 103 | else 104 | Debug.LogWarning("Unsupported texture data type " + dataType); 105 | 106 | tex2D = new Texture2D(s, t, format, false); 107 | tex2D.LoadRawTextureData(imageData); 108 | tex2D.Apply(); 109 | } 110 | 111 | uint numLevels = reader.ReadUInt32(); 112 | for (uint i = 0; i < numLevels; ++i) 113 | { 114 | uint levelDataSize = reader.ReadUInt32(); 115 | // TODO 116 | } 117 | } 118 | break; 119 | case 1: // IMAGE_INLINE_FILE 120 | { 121 | uint size = reader.ReadUInt32(); 122 | if (size > 0) 123 | { 124 | byte[] fileData = reader.ReadBytes((int)size); 125 | 126 | tex2D = new Texture2D(2, 2); 127 | tex2D.LoadImage(fileData); 128 | //File.WriteAllBytes("test.jpg", fileData); 129 | } 130 | } 131 | break; 132 | case 2: // IMAGE_EXTERNAL 133 | if (File.Exists(fileName)) 134 | { 135 | byte[] fileData = File.ReadAllBytes(fileName); 136 | tex2D = new Texture2D(2, 2); 137 | tex2D.LoadImage(fileData); 138 | } 139 | else 140 | Debug.LogWarning("Image file '" + fileName + "' not found"); 141 | break; 142 | default: break; 143 | } 144 | 145 | osg_Object classObj = new osg_Object(); 146 | classObj.read(gameObj, reader, owner); 147 | owner._sharedTextures[id] = tex2D; 148 | return tex2D; 149 | } 150 | 151 | public static bool LoadObject(Object gameObj, BinaryReader reader, ReaderOSGB owner) 152 | { 153 | string className = ReadString(reader); 154 | long blockSize = ReadBracket(reader, owner); 155 | uint id = reader.ReadUInt32(); 156 | className = className.Replace("::", "_"); 157 | 158 | if (owner._sharedObjects.ContainsKey(id)) 159 | { 160 | //Debug.Log("Shared object " + className + "-" + id); 161 | return true; // TODO: how to share nodes? 162 | } 163 | else 164 | owner._sharedObjects[id] = gameObj; 165 | 166 | if (owner._version < 154) 167 | { 168 | if (className == "osg_Geometry") className = "osg_Geometry_2"; 169 | else if (className == "osg_Drawable") className = "osg_Drawable_2"; 170 | } 171 | //\Debug.Log(className + " - " + id); 172 | 173 | #if UNITY_WEBGL || UNITY_EDITOR 174 | System.Func ctor = null; 175 | if (!ctorFunc.TryGetValue(className, out ctor)) 176 | { 177 | Debug.LogWarning("Object type " + className + " not implemented"); 178 | if (blockSize != -1) reader.BaseStream.Position += (blockSize - 4); 179 | return false; 180 | } 181 | 182 | ObjectBase classObj = ctor.Invoke(); 183 | #else 184 | System.Type classType = System.Type.GetType("osgEx." + className); 185 | if (classType == null) 186 | { 187 | Debug.LogWarning("Object type " + className + " not implemented"); 188 | if (blockSize != -1) reader.BaseStream.Position += (blockSize - 4); 189 | return false; 190 | } 191 | 192 | ObjectBase classObj = System.Activator.CreateInstance(classType) as ObjectBase; 193 | #endif 194 | if (classObj == null) 195 | { 196 | Debug.LogWarning("Object instance " + className + " failed to create"); 197 | if (blockSize != -1) reader.BaseStream.Position += (blockSize - 4); 198 | return false; 199 | } 200 | else 201 | return classObj.read(gameObj, reader, owner); 202 | } 203 | 204 | public virtual bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 205 | { Debug.LogWarning("Method read() not implemented"); return false; } 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/ObjectBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a92d5c63298b3dd48a06d1de58cfbbab 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/PagedData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class PagedData : MonoBehaviour 9 | { 10 | public enum RangeMode { Distance, PixelSize }; 11 | public RangeMode _rangeMode = RangeMode.Distance; 12 | public string _rootFileName = "", _databasePath = ""; 13 | public BoundingSphere _bounds; 14 | public ReaderOSGB _mainReader; 15 | 16 | public List _fileNames = new List(); 17 | public List _ranges = new List(); 18 | public List _pagedNodes = new List(); 19 | string _fullPathPrefix = ""; 20 | 21 | public string getFullFileName(int index) 22 | { return _fullPathPrefix + _fileNames[index]; } 23 | 24 | void Start() 25 | { 26 | _fullPathPrefix = Path.GetDirectoryName(_rootFileName) + Path.DirectorySeparatorChar; 27 | if (_databasePath.Length > 0) _fullPathPrefix += _databasePath + Path.DirectorySeparatorChar; 28 | while (_pagedNodes.Count < _fileNames.Count) _pagedNodes.Add(null); 29 | } 30 | 31 | void Update() 32 | { 33 | Camera mainCam = Camera.main; 34 | Matrix4x4 world2LocalOwner = _mainReader.transform.worldToLocalMatrix; 35 | Matrix4x4 local2World = this.transform.localToWorldMatrix * world2LocalOwner; 36 | Vector3 cameraPos = world2LocalOwner.MultiplyPoint(mainCam.transform.position); 37 | 38 | // Check LOD situation 39 | float rangeValue = 0.0f; 40 | if (_rangeMode == RangeMode.Distance) 41 | { 42 | Vector3 centerW = local2World.MultiplyPoint(_bounds.position); 43 | rangeValue = (cameraPos - centerW).magnitude; 44 | } 45 | else 46 | { 47 | Vector3 centerW = local2World.MultiplyPoint(_bounds.position); 48 | Bounds bb = new Bounds( 49 | centerW, new Vector3(_bounds.radius, _bounds.radius, _bounds.radius) * 2.0f); 50 | if (GeometryUtility.TestPlanesAABB(_mainReader._currentFrustum, bb)) 51 | { 52 | float distance = (centerW - cameraPos).magnitude; 53 | float slope = Mathf.Tan(mainCam.fieldOfView * Mathf.Deg2Rad * 0.5f); 54 | float projFactor = (0.5f * mainCam.pixelHeight) / (slope * distance); 55 | rangeValue = _bounds.radius * projFactor; // screenPixelRadius 56 | } 57 | else 58 | rangeValue = -1.0f; 59 | } 60 | 61 | // Find files to load/unload 62 | List filesToLoad = new List(); 63 | List filesToUnload = new List(); 64 | for (int i = 0; i < _ranges.Count; ++i) 65 | { 66 | string fileName = _fileNames[i]; 67 | if (fileName.Length == 0) continue; 68 | 69 | Vector2 range = _ranges[i]; 70 | bool unloaded = (_pagedNodes[i] == null); 71 | if (range[0] < rangeValue && rangeValue < range[1]) 72 | { if (unloaded) filesToLoad.Add(i); } 73 | else if (!unloaded) filesToUnload.Add(i); 74 | } 75 | 76 | // Update file loading/unloading status 77 | _mainReader.RequestLoadingAndUnloading(this, filesToLoad, filesToUnload); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/PagedData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fe22c53d0d6a7244a696d408a66511c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/ReaderOSGB.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 035950c1f19f7524f802d6aae32d9b93 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/TaskManager.cs: -------------------------------------------------------------------------------- 1 | /// TaskManager.cs 2 | /// 3 | /// This is a convenient coroutine API for Unity. 4 | /// 5 | /// Example usage: 6 | /// IEnumerator MyAwesomeTask() 7 | /// { 8 | /// while(true) { 9 | /// // ... 10 | /// yield return null; 11 | //// } 12 | /// } 13 | /// 14 | /// IEnumerator TaskKiller(float delay, Task t) 15 | /// { 16 | /// yield return new WaitForSeconds(delay); 17 | /// t.Stop(); 18 | /// } 19 | /// 20 | /// // From anywhere 21 | /// Task my_task = new Task(MyAwesomeTask()); 22 | /// new Task(TaskKiller(5, my_task)); 23 | /// 24 | /// The code above will schedule MyAwesomeTask() and keep it running 25 | /// concurrently until either it terminates on its own, or 5 seconds elapses 26 | /// and triggers the TaskKiller Task that was created. 27 | /// 28 | /// Note that to facilitate this API's behavior, a "TaskManager" GameObject is 29 | /// created lazily on first use of the Task API and placed in the scene root 30 | /// with the internal TaskManager component attached. All coroutine dispatch 31 | /// for Tasks is done through this component. 32 | 33 | using UnityEngine; 34 | using System.Collections; 35 | 36 | /// A Task object represents a coroutine. Tasks can be started, paused, and stopped. 37 | /// It is an error to attempt to start a task that has been stopped or which has 38 | /// naturally terminated. 39 | public class Task 40 | { 41 | /// Returns true if and only if the coroutine is running. Paused tasks 42 | /// are considered to be running. 43 | public bool Running 44 | { 45 | get 46 | { 47 | return task.Running; 48 | } 49 | } 50 | 51 | /// Returns true if and only if the coroutine is currently paused. 52 | public bool Paused 53 | { 54 | get 55 | { 56 | return task.Paused; 57 | } 58 | } 59 | 60 | /// Delegate for termination subscribers. manual is true if and only if 61 | /// the coroutine was stopped with an explicit call to Stop(). 62 | public delegate void FinishedHandler(bool manual); 63 | 64 | /// Termination event. Triggered when the coroutine completes execution. 65 | public event FinishedHandler Finished; 66 | 67 | /// Creates a new Task object for the given coroutine. 68 | /// 69 | /// If autoStart is true (default) the task is automatically started 70 | /// upon construction. 71 | public Task(IEnumerator c, bool autoStart = true) 72 | { 73 | task = TaskManager.CreateTask(c); 74 | task.Finished += TaskFinished; 75 | if (autoStart) 76 | Start(); 77 | } 78 | 79 | /// Begins execution of the coroutine 80 | public void Start() 81 | { 82 | task.Start(); 83 | } 84 | 85 | /// Discontinues execution of the coroutine at its next yield. 86 | public void Stop() 87 | { 88 | task.Stop(); 89 | } 90 | 91 | public void Pause() 92 | { 93 | task.Pause(); 94 | } 95 | 96 | public void Unpause() 97 | { 98 | task.Unpause(); 99 | } 100 | 101 | void TaskFinished(bool manual) 102 | { 103 | FinishedHandler handler = Finished; 104 | if (handler != null) 105 | handler(manual); 106 | } 107 | 108 | TaskManager.TaskState task; 109 | } 110 | 111 | class TaskManager : MonoBehaviour 112 | { 113 | public class TaskState 114 | { 115 | public bool Running 116 | { 117 | get 118 | { 119 | return running; 120 | } 121 | } 122 | 123 | public bool Paused 124 | { 125 | get 126 | { 127 | return paused; 128 | } 129 | } 130 | 131 | public delegate void FinishedHandler(bool manual); 132 | public event FinishedHandler Finished; 133 | 134 | IEnumerator coroutine; 135 | bool running; 136 | bool paused; 137 | bool stopped; 138 | 139 | public TaskState(IEnumerator c) 140 | { 141 | coroutine = c; 142 | } 143 | 144 | public void Pause() 145 | { 146 | paused = true; 147 | } 148 | 149 | public void Unpause() 150 | { 151 | paused = false; 152 | } 153 | 154 | public void Start() 155 | { 156 | running = true; 157 | singleton.StartCoroutine(CallWrapper()); 158 | } 159 | 160 | public void Stop() 161 | { 162 | stopped = true; 163 | running = false; 164 | } 165 | 166 | IEnumerator CallWrapper() 167 | { 168 | yield return null; 169 | IEnumerator e = coroutine; 170 | while (running) 171 | { 172 | if (paused) 173 | yield return null; 174 | else 175 | { 176 | if (e != null && e.MoveNext()) 177 | { 178 | yield return e.Current; 179 | } 180 | else 181 | { 182 | running = false; 183 | } 184 | } 185 | } 186 | 187 | FinishedHandler handler = Finished; 188 | if (handler != null) 189 | handler(stopped); 190 | } 191 | } 192 | 193 | static TaskManager singleton; 194 | 195 | public static TaskState CreateTask(IEnumerator coroutine) 196 | { 197 | if (singleton == null) 198 | { 199 | GameObject go = new GameObject("TaskManager"); 200 | singleton = go.AddComponent(); 201 | } 202 | return new TaskState(coroutine); 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/TaskManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57161b72115775d4c9e04eff1aa482c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/TextureUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Runtime.InteropServices; 6 | using UnityEngine; 7 | 8 | namespace osgEx 9 | { 10 | public class TextureUtils 11 | { 12 | public static void DecompressDXT1(byte[] input, int width, int height, byte[] output) 13 | { 14 | int offset = 0, bcw = (width + 3) / 4, bch = (height + 3) / 4; 15 | int clen_last = (width + 3) % 4 + 1; 16 | uint[] buffer = new uint[16]; 17 | int[] colors = new int[4]; 18 | for (int t = 0; t < bch; t++) 19 | { 20 | for (int s = 0; s < bcw; s++, offset += 8) 21 | { 22 | int r0, g0, b0, r1, g1, b1; 23 | int q0 = input[offset + 0] | input[offset + 1] << 8; 24 | int q1 = input[offset + 2] | input[offset + 3] << 8; 25 | Rgb565(q0, out r0, out g0, out b0); 26 | Rgb565(q1, out r1, out g1, out b1); 27 | colors[0] = Color(r0, g0, b0, 255); 28 | colors[1] = Color(r1, g1, b1, 255); 29 | if (q0 > q1) 30 | { 31 | colors[2] = Color((r0 * 2 + r1) / 3, (g0 * 2 + g1) / 3, (b0 * 2 + b1) / 3, 255); 32 | colors[3] = Color((r0 + r1 * 2) / 3, (g0 + g1 * 2) / 3, (b0 + b1 * 2) / 3, 255); 33 | } 34 | else 35 | colors[2] = Color((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, 255); 36 | 37 | uint d = BitConverter.ToUInt32(input, offset + 4); 38 | for (int i = 0; i < 16; i++, d >>= 2) 39 | buffer[i] = unchecked((uint)colors[d & 3]); 40 | 41 | int clen = (s < bcw - 1 ? 4 : clen_last) * 4; 42 | for (int i = 0, y = t * 4; i < 4 && y < height; i++, y++) 43 | Buffer.BlockCopy(buffer, i * 4 * 4, output, (y * width + s * 4) * 4, clen); 44 | } 45 | } 46 | } 47 | 48 | 49 | public static void DecompressDXT3(byte[] input, int width, int height, byte[] output) 50 | { 51 | int offset = 0, bcw = (width + 3) / 4, bch = (height + 3) / 4; 52 | int clen_last = (width + 3) % 4 + 1; 53 | uint[] buffer = new uint[16]; 54 | int[] colors = new int[4]; 55 | int[] alphas = new int[16]; 56 | for (int t = 0; t < bch; t++) 57 | { 58 | for (int s = 0; s < bcw; s++, offset += 16) 59 | { 60 | for (int i = 0; i < 4; i++) 61 | { 62 | int alpha = input[offset + i * 2] | input[offset + i * 2 + 1] << 8; 63 | alphas[i * 4 + 0] = (((alpha >> 0) & 0xF) * 0x11) << 24; 64 | alphas[i * 4 + 1] = (((alpha >> 4) & 0xF) * 0x11) << 24; 65 | alphas[i * 4 + 2] = (((alpha >> 8) & 0xF) * 0x11) << 24; 66 | alphas[i * 4 + 3] = (((alpha >> 12) & 0xF) * 0x11) << 24; 67 | } 68 | 69 | int r0, g0, b0, r1, g1, b1; 70 | int q0 = input[offset + 8] | input[offset + 9] << 8; 71 | int q1 = input[offset + 10] | input[offset + 11] << 8; 72 | Rgb565(q0, out r0, out g0, out b0); 73 | Rgb565(q1, out r1, out g1, out b1); 74 | colors[0] = Color(r0, g0, b0, 0); 75 | colors[1] = Color(r1, g1, b1, 0); 76 | if (q0 > q1) 77 | { 78 | colors[2] = Color((r0 * 2 + r1) / 3, (g0 * 2 + g1) / 3, (b0 * 2 + b1) / 3, 0); 79 | colors[3] = Color((r0 + r1 * 2) / 3, (g0 + g1 * 2) / 3, (b0 + b1 * 2) / 3, 0); 80 | } 81 | else 82 | colors[2] = Color((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, 0); 83 | 84 | uint d = BitConverter.ToUInt32(input, offset + 12); 85 | for (int i = 0; i < 16; i++, d >>= 2) 86 | buffer[i] = unchecked((uint)(colors[d & 3] | alphas[i])); 87 | 88 | int clen = (s < bcw - 1 ? 4 : clen_last) * 4; 89 | for (int i = 0, y = t * 4; i < 4 && y < height; i++, y++) 90 | Buffer.BlockCopy(buffer, i * 4 * 4, output, (y * width + s * 4) * 4, clen); 91 | } 92 | } 93 | } 94 | 95 | public static void DecompressDXT5(byte[] input, int width, int height, byte[] output) 96 | { 97 | int offset = 0, bcw = (width + 3) / 4, bch = (height + 3) / 4; 98 | int clen_last = (width + 3) % 4 + 1; 99 | uint[] buffer = new uint[16]; 100 | int[] colors = new int[4]; 101 | int[] alphas = new int[8]; 102 | for (int t = 0; t < bch; t++) 103 | { 104 | for (int s = 0; s < bcw; s++, offset += 16) 105 | { 106 | alphas[0] = input[offset + 0]; 107 | alphas[1] = input[offset + 1]; 108 | if (alphas[0] > alphas[1]) 109 | { 110 | alphas[2] = (alphas[0] * 6 + alphas[1]) / 7; 111 | alphas[3] = (alphas[0] * 5 + alphas[1] * 2) / 7; 112 | alphas[4] = (alphas[0] * 4 + alphas[1] * 3) / 7; 113 | alphas[5] = (alphas[0] * 3 + alphas[1] * 4) / 7; 114 | alphas[6] = (alphas[0] * 2 + alphas[1] * 5) / 7; 115 | alphas[7] = (alphas[0] + alphas[1] * 6) / 7; 116 | } 117 | else 118 | { 119 | alphas[2] = (alphas[0] * 4 + alphas[1]) / 5; 120 | alphas[3] = (alphas[0] * 3 + alphas[1] * 2) / 5; 121 | alphas[4] = (alphas[0] * 2 + alphas[1] * 3) / 5; 122 | alphas[5] = (alphas[0] + alphas[1] * 4) / 5; 123 | alphas[7] = 255; 124 | } 125 | 126 | for (int i = 0; i < 8; i++) 127 | alphas[i] <<= 24; 128 | 129 | int r0, g0, b0, r1, g1, b1; 130 | int q0 = input[offset + 8] | input[offset + 9] << 8; 131 | int q1 = input[offset + 10] | input[offset + 11] << 8; 132 | Rgb565(q0, out r0, out g0, out b0); 133 | Rgb565(q1, out r1, out g1, out b1); 134 | colors[0] = Color(r0, g0, b0, 0); 135 | colors[1] = Color(r1, g1, b1, 0); 136 | if (q0 > q1) 137 | { 138 | colors[2] = Color((r0 * 2 + r1) / 3, (g0 * 2 + g1) / 3, (b0 * 2 + b1) / 3, 0); 139 | colors[3] = Color((r0 + r1 * 2) / 3, (g0 + g1 * 2) / 3, (b0 + b1 * 2) / 3, 0); 140 | } 141 | else 142 | colors[2] = Color((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, 0); 143 | 144 | ulong da = BitConverter.ToUInt64(input, offset) >> 16; 145 | uint dc = BitConverter.ToUInt32(input, offset + 12); 146 | for (int i = 0; i < 16; i++, da >>= 3, dc >>= 2) 147 | buffer[i] = unchecked((uint)(alphas[da & 7] | colors[dc & 3])); 148 | 149 | int clen = (s < bcw - 1 ? 4 : clen_last) * 4; 150 | for (int i = 0, y = t * 4; i < 4 && y < height; i++, y++) 151 | Buffer.BlockCopy(buffer, i * 4 * 4, output, (y * width + s * 4) * 4, clen); 152 | } 153 | } 154 | } 155 | 156 | private static void Rgb565(int c, out int r, out int g, out int b) 157 | { 158 | r = (c & 0xf800) >> 8; 159 | g = (c & 0x07e0) >> 3; 160 | b = (c & 0x001f) << 3; 161 | r |= r >> 5; g |= g >> 6; b |= b >> 5; 162 | } 163 | 164 | private static int Color(int r, int g, int b, int a) 165 | { return r << 16 | g << 8 | b | a << 24; } 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/TextureUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f48cda5dd3011f247b9d57ea167ae4ec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Array.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Array : osg_BufferData // FIXME: version >= 147 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | int binding = reader.ReadInt32(); // Binding 16 | bool normalize = reader.ReadBoolean(); // Normalize 17 | bool preserveDataType = reader.ReadBoolean(); // PreserveDataType 18 | 19 | return true; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Array.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3dc3d3d7bfc16f54b9fc6692bebd3ef8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_BufferData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_BufferData : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | if (owner._version >= 147) 16 | { 17 | bool hasBufferObject = reader.ReadBoolean(); // BufferObject 18 | if (hasBufferObject) LoadObject(gameObj, reader, owner); 19 | } 20 | return true; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_BufferData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b4c96f01c9ea094998fb799e8a33412 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_BufferObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_BufferObject : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | int type = reader.ReadInt32(); // _type 16 | int usage = reader.ReadInt32(); // _usage 17 | bool cdr = reader.ReadBoolean(); // CopyDataAndReleaseGLBufferObject 18 | if (owner._version >= 201) 19 | { 20 | int mappingBitField = reader.ReadInt32(); // _mappingBitField 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_BufferObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ce5069c9025dd444a7bc31594d514b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Callback.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Callback : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasNested = reader.ReadBoolean(); // _nestedCallback 16 | if (hasNested) LoadObject(gameObj, reader, owner); 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Callback.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db3f11042ed92e1449ee90db2e1fa438 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ClusterCullingCallback.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_ClusterCullingCallback : osg_NodeCallback 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | Vector3 cp = new Vector3(reader.ReadSingle(), reader.ReadSingle(), 16 | reader.ReadSingle()); // _controlPoint 17 | Vector3 normal = new Vector3(reader.ReadSingle(), reader.ReadSingle(), 18 | reader.ReadSingle()); // _normal 19 | float radius = reader.ReadSingle(); // _radius 20 | float deviation = reader.ReadSingle(); // _deviation 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ClusterCullingCallback.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2860ab2fc574ab4d8fff9b817b0f1f3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_CoordinateSystemNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_CoordinateSystemNode : osg_Group 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | string format = ReadString(reader); // _format 16 | string cs = ReadString(reader); // _cs 17 | 18 | bool hasEllipsoid = reader.ReadBoolean(); // _ellipsoidModel 19 | if (hasEllipsoid) LoadObject(gameObj, reader, owner); 20 | return true; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_CoordinateSystemNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38e7bdbe726a5904ca1ab02e10823cc3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawArrays.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_DrawArrays : osg_PrimitiveSet 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int first = reader.ReadInt32(); // First 17 | int count = reader.ReadInt32(); // Count 18 | 19 | GeometryData gd = parentObj.GetComponent(); 20 | if (gd != null) 21 | { 22 | List localIndices = new List(); 23 | for (int i = 0; i < count; ++i) 24 | { 25 | int id = first + i; localIndices.Add(id); 26 | if (gd._maxIndex < id) gd._maxIndex = id; 27 | } 28 | gd.addPrimitiveIndices(localIndices); 29 | } 30 | return true; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawArrays.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49b442b29e7e4364abd095e923c4fe82 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUByte.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_DrawElementsUByte : osg_PrimitiveSet 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | GeometryData gd = parentObj.GetComponent(); 17 | if (gd != null) 18 | { 19 | List localIndices = new List(); 20 | int numElements = reader.ReadInt32(); 21 | for (uint n = 0; n < numElements; ++n) 22 | { 23 | uint value = reader.ReadByte(); localIndices.Add((int)value); 24 | if (gd._maxIndex < (int)value) gd._maxIndex = (int)value; 25 | } 26 | gd.addPrimitiveIndices(localIndices); 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUByte.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dd4a3e56460b564fa82001bfd34ce12 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUInt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_DrawElementsUInt : osg_PrimitiveSet 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | GeometryData gd = parentObj.GetComponent(); 17 | if (gd != null) 18 | { 19 | List localIndices = new List(); 20 | int numElements = reader.ReadInt32(); 21 | for (uint n = 0; n < numElements; ++n) 22 | { 23 | uint value = reader.ReadUInt32(); localIndices.Add((int)value); 24 | if (gd._maxIndex < (int)value) gd._maxIndex = (int)value; 25 | } 26 | gd.addPrimitiveIndices(localIndices); 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUInt.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8cf4ecbb7e56274684251e99da854c0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUShort.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_DrawElementsUShort : osg_PrimitiveSet 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | GeometryData gd = parentObj.GetComponent(); 17 | if (gd != null) 18 | { 19 | List localIndices = new List(); 20 | int numElements = reader.ReadInt32(); 21 | for (uint n = 0; n < numElements; ++n) 22 | { 23 | uint value = reader.ReadUInt16(); localIndices.Add((int)value); 24 | if (gd._maxIndex < (int)value) gd._maxIndex = (int)value; 25 | } 26 | gd.addPrimitiveIndices(localIndices); 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_DrawElementsUShort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da09fc44616bffe41919cbc7d4335243 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Drawable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Drawable : osg_Node 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasInitBound = reader.ReadBoolean(); // _initialBound 16 | if (hasInitBound) 17 | { 18 | long blockSize = ReadBracket(reader, owner); 19 | Vector3 boundMin = new Vector3( 20 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), (float)reader.ReadDouble()); 21 | Vector3 boundMax = new Vector3( 22 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), (float)reader.ReadDouble()); 23 | } 24 | 25 | bool hasComputeBoundCB = reader.ReadBoolean(); // _computeBoundCallback 26 | if (hasComputeBoundCB) LoadObject(gameObj, reader, owner); 27 | 28 | bool hasShape = reader.ReadBoolean(); // _shape 29 | if (hasShape) LoadObject(gameObj, reader, owner); 30 | 31 | bool enableDisplaylists = reader.ReadBoolean(); // _supportsDisplayList 32 | bool useDisplaylists = reader.ReadBoolean(); // _useDisplayList 33 | bool useVBO = reader.ReadBoolean(); // _useVertexBufferObjects 34 | 35 | if (owner._version >= 142) 36 | { 37 | int nodeMask = reader.ReadInt32(); // _nodeMask 38 | } 39 | 40 | if (owner._version >= 145) 41 | { 42 | bool active = reader.ReadBoolean(); // _cullingActive 43 | } 44 | return true; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Drawable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9f5a316de7192f4fb72b1a38852d702 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Drawable_2.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Drawable_2 : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasStateSet = reader.ReadBoolean(); // _stateset 16 | if (hasStateSet) LoadObject(gameObj, reader, owner); 17 | 18 | bool hasInitBound = reader.ReadBoolean(); // _initialBound 19 | if (hasInitBound) 20 | { 21 | long blockSize = ReadBracket(reader, owner); 22 | Vector3 boundMin = new Vector3( 23 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), (float)reader.ReadDouble()); 24 | Vector3 boundMax = new Vector3( 25 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), (float)reader.ReadDouble()); 26 | } 27 | 28 | bool hasComputeBoundCB = reader.ReadBoolean(); // _computeBoundCallback 29 | if (hasComputeBoundCB) LoadObject(gameObj, reader, owner); 30 | 31 | bool hasShape = reader.ReadBoolean(); // _shape 32 | if (hasShape) LoadObject(gameObj, reader, owner); 33 | 34 | bool enableDisplaylists = reader.ReadBoolean(); // _supportsDisplayList 35 | bool useDisplaylists = reader.ReadBoolean(); // _useDisplayList 36 | bool useVBO = reader.ReadBoolean(); // _useVertexBufferObjects 37 | 38 | bool hasUpdateCB = reader.ReadBoolean(); // _updateCallback 39 | if (hasUpdateCB) LoadObject(gameObj, reader, owner); 40 | 41 | bool hasEventCB = reader.ReadBoolean(); // _eventCallback 42 | if (hasEventCB) LoadObject(gameObj, reader, owner); 43 | 44 | bool hasCullCB = reader.ReadBoolean(); // _cullCallback 45 | if (hasCullCB) LoadObject(gameObj, reader, owner); 46 | 47 | bool hasDrawCB = reader.ReadBoolean(); // _drawCallback 48 | if (hasDrawCB) LoadObject(gameObj, reader, owner); 49 | 50 | return true; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Drawable_2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd9d039dcde1f314c8c3b9bada7947ca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ElementBufferObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_ElementBufferObject : osg_BufferObject 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ElementBufferObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ca464a92c024664b8639f24e3b958b0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_EllipsoidModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_EllipsoidModel : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | double radiusE = reader.ReadDouble(); // _radiusEquator 16 | double radiusP = reader.ReadDouble(); // _radiusPolar 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_EllipsoidModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6a4f6f8514066f45824d0e5736290bb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Geode : osg_Node 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | bool hasChildren = reader.ReadBoolean(); // _drawables 17 | if (hasChildren) 18 | { 19 | uint numChildren = reader.ReadUInt32(); 20 | long blockSize = ReadBracket(reader, owner); 21 | for (uint i = 0; i < numChildren; ++i) 22 | { 23 | GameObject drawable = new GameObject("Drawable_" + i.ToString()); 24 | if (parentObj && LoadObject(drawable, reader, owner)) 25 | drawable.transform.SetParent(parentObj.transform, false); 26 | } 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ae8ca7a7d4f9c447a572b9a28b1d249 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geometry.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Runtime.InteropServices; 5 | using UnityEngine; 6 | using UnityEngine.Rendering; 7 | 8 | namespace osgEx 9 | { 10 | public class osg_Geometry : osg_Drawable 11 | { 12 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 13 | { 14 | GameObject parentObj = gameObj as GameObject; 15 | if (!base.read(gameObj, reader, owner)) 16 | return false; 17 | 18 | Mesh mesh = new Mesh(); 19 | mesh.name = parentObj.name + "_Mesh"; 20 | 21 | // _primitives 22 | uint numPrimitives = reader.ReadUInt32(); 23 | GeometryData gd = parentObj.AddComponent(); 24 | for (uint i = 0; i < numPrimitives; ++i) LoadObject(parentObj, reader, owner); 25 | 26 | // just a temperatory method to enable triangles applied 27 | mesh.vertices = new Vector3[gd._maxIndex + 1]; 28 | mesh.triangles = gd._indices.ToArray(); 29 | 30 | bool hasNormals = false, hasData = reader.ReadBoolean(); // _vertexData 31 | if (hasData) 32 | { 33 | if (LoadObject(parentObj, reader, owner)) 34 | mesh.vertices = gd._vec3Array.ToArray(); 35 | } 36 | 37 | hasData = reader.ReadBoolean(); // _normalData 38 | if (hasData) 39 | { 40 | if (LoadObject(parentObj, reader, owner)) 41 | { mesh.normals = gd._vec3Array.ToArray(); hasNormals = true; } 42 | } 43 | 44 | hasData = reader.ReadBoolean(); // _colorData 45 | if (hasData) LoadObject(parentObj, reader, owner); 46 | hasData = reader.ReadBoolean(); // _secondaryColorData 47 | if (hasData) LoadObject(parentObj, reader, owner); 48 | hasData = reader.ReadBoolean(); // _fogCoordData 49 | if (hasData) LoadObject(parentObj, reader, owner); 50 | 51 | uint numArrayData = reader.ReadUInt32(); // _texCoordList 52 | for (uint i = 0; i < numArrayData; ++i) 53 | { 54 | if (LoadObject(parentObj, reader, owner)) 55 | { 56 | if (i == 0) mesh.uv = gd._vec2Array.ToArray(); 57 | else mesh.uv2 = gd._vec2Array.ToArray(); 58 | } 59 | } 60 | 61 | numArrayData = reader.ReadUInt32(); // _vertexAttribList 62 | for (uint i = 0; i < numArrayData; ++i) LoadObject(parentObj, reader, owner); 63 | 64 | // Mesh related components 65 | if (!hasNormals) mesh.RecalculateNormals(); 66 | mesh.RecalculateBounds(); 67 | Object.Destroy(gd); 68 | 69 | parentObj.AddComponent().sharedMesh = mesh; 70 | if (mesh.vertexCount > 3 && owner._withMeshCollider) 71 | { 72 | MeshCollider collider = parentObj.AddComponent(); 73 | collider.sharedMesh = mesh; 74 | collider.convex = true; 75 | } 76 | 77 | MeshRenderer renderer = parentObj.AddComponent(); 78 | renderer.sharedMaterial = GameObject.Instantiate(owner._template); 79 | renderer.sharedMaterial.mainTexture = owner._preloadedTexture; 80 | return true; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geometry.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 218666f2bc4efb34796f6e5ce452c0b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geometry_2.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Geometry_2 : osg_Drawable_2 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | Mesh mesh = new Mesh(); 17 | mesh.name = parentObj.name + "_Mesh"; 18 | 19 | // _primitives 20 | uint numPrimitives = reader.ReadUInt32(), maxIndex = 0; 21 | GeometryData gd = parentObj.AddComponent(); 22 | for (uint i = 0; i < numPrimitives; ++i) 23 | { 24 | if (owner._version < 112) 25 | { 26 | uint id = GeometryUtils.readPrimitive(ref gd._indices, reader, owner); 27 | if (maxIndex < id) maxIndex = id; 28 | } 29 | else 30 | LoadObject(parentObj, reader, owner); 31 | } 32 | 33 | // just a temperatory method to enable triangles applied 34 | mesh.vertices = new Vector3[maxIndex + 1]; 35 | mesh.triangles = gd._indices.ToArray(); 36 | 37 | bool hasNormals = false; 38 | if (owner._version < 112) 39 | { 40 | bool hasArrayData = reader.ReadBoolean(); // _vertexData 41 | if (hasArrayData) GeometryUtils.readArrayData("vertex", mesh, reader, owner); 42 | 43 | hasArrayData = reader.ReadBoolean(); // _normalData 44 | if (hasArrayData) 45 | { 46 | GeometryUtils.readArrayData("normal", mesh, reader, owner); 47 | hasNormals = true; 48 | } 49 | 50 | hasArrayData = reader.ReadBoolean(); // _colorData 51 | if (hasArrayData) GeometryUtils.readArrayData("color", mesh, reader, owner); 52 | 53 | hasArrayData = reader.ReadBoolean(); // _secondaryColorData 54 | if (hasArrayData) GeometryUtils.readArrayData("secondaryColor", mesh, reader, owner); 55 | 56 | hasArrayData = reader.ReadBoolean(); // _fogCoordData 57 | if (hasArrayData) GeometryUtils.readArrayData("fogCoord", mesh, reader, owner); 58 | 59 | hasArrayData = reader.ReadBoolean(); // _texCoordList 60 | if (hasArrayData) GeometryUtils.readArrayListData("texCoord", mesh, reader, owner); 61 | 62 | hasArrayData = reader.ReadBoolean(); // _vertexAttribList 63 | if (hasArrayData) GeometryUtils.readArrayListData("vertexAttrib", mesh, reader, owner); 64 | 65 | bool hasFastPath = reader.ReadBoolean(); // _fastPathHint 66 | if (hasFastPath) { } // { bool fastPathHint = reader.ReadBoolean(); } 67 | } 68 | else 69 | { 70 | bool hasData = reader.ReadBoolean(); // _vertexData 71 | if (hasData) 72 | { 73 | if (LoadObject(parentObj, reader, owner)) 74 | mesh.vertices = gd._vec3Array.ToArray(); 75 | } 76 | 77 | hasData = reader.ReadBoolean(); // _normalData 78 | if (hasData) 79 | { 80 | if (LoadObject(parentObj, reader, owner)) 81 | { mesh.normals = gd._vec3Array.ToArray(); hasNormals = true; } 82 | } 83 | 84 | hasData = reader.ReadBoolean(); // _colorData 85 | if (hasData) LoadObject(parentObj, reader, owner); 86 | hasData = reader.ReadBoolean(); // _secondaryColorData 87 | if (hasData) LoadObject(parentObj, reader, owner); 88 | hasData = reader.ReadBoolean(); // _fogCoordData 89 | if (hasData) LoadObject(parentObj, reader, owner); 90 | 91 | uint numArrayData = reader.ReadUInt32(); // _texCoordList 92 | for (uint i = 0; i < numArrayData; ++i) 93 | { 94 | if (LoadObject(parentObj, reader, owner)) 95 | { 96 | if (i == 0) mesh.uv = gd._vec2Array.ToArray(); 97 | else mesh.uv2 = gd._vec2Array.ToArray(); 98 | } 99 | } 100 | 101 | numArrayData = reader.ReadUInt32(); // _vertexAttribList 102 | for (uint i = 0; i < numArrayData; ++i) LoadObject(parentObj, reader, owner); 103 | } 104 | 105 | // Mesh related components 106 | if (!hasNormals) mesh.RecalculateNormals(); 107 | mesh.RecalculateBounds(); 108 | Object.Destroy(gd); 109 | 110 | parentObj.AddComponent().sharedMesh = mesh; 111 | if (mesh.vertexCount > 3) 112 | { 113 | MeshCollider collider = parentObj.AddComponent(); 114 | collider.sharedMesh = mesh; 115 | collider.convex = true; 116 | } 117 | 118 | MeshRenderer renderer = parentObj.AddComponent(); 119 | renderer.sharedMaterial = GameObject.Instantiate(owner._template); 120 | renderer.sharedMaterial.mainTexture = owner._preloadedTexture; 121 | return true; 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Geometry_2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f4f37396ae288d4bb1aeb75595dceb7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Group.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Group : osg_Node 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | bool hasChildren = reader.ReadBoolean(); // _children 17 | if (hasChildren) 18 | { 19 | uint numChildren = reader.ReadUInt32(); 20 | long blockSize = ReadBracket(reader, owner); 21 | for (uint i = 0; i < numChildren; ++i) 22 | { 23 | GameObject children = new GameObject("Child_" + i.ToString()); 24 | if (parentObj && LoadObject(children, reader, owner)) 25 | children.transform.SetParent(parentObj.transform, false); 26 | } 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Group.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b938c0f9f47656b41a900a2397ede4b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_LOD.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_LOD : osg_Node 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | PagedData pagedData = parentObj.AddComponent(); 17 | pagedData._mainReader = owner; 18 | 19 | int centerMode = reader.ReadInt32(); // _centerMode 20 | 21 | bool hasUserCenter = reader.ReadBoolean(); // _userDefinedCenter, _radius 22 | if (hasUserCenter) 23 | { 24 | double centerX = reader.ReadDouble(); 25 | double centerY = reader.ReadDouble(); 26 | double centerZ = reader.ReadDouble(); 27 | double radius = reader.ReadDouble(); 28 | 29 | pagedData._bounds = new BoundingSphere( 30 | new Vector3((float)centerX, (float)centerY, (float)centerZ), (float)radius); 31 | } 32 | // TODO: _bounds in default center mode? 33 | 34 | int rangeMode = reader.ReadInt32(); // _rangeMode 35 | pagedData._rangeMode = (rangeMode > 0) 36 | ? PagedData.RangeMode.PixelSize : PagedData.RangeMode.Distance; 37 | 38 | bool hasRanges = reader.ReadBoolean(); // _rangeList 39 | if (hasRanges) 40 | { 41 | uint numRanges = reader.ReadUInt32(); 42 | long blockSize = ReadBracket(reader, owner); 43 | for (uint i = 0; i < numRanges; ++i) 44 | { 45 | float minR = reader.ReadSingle(); 46 | float maxR = reader.ReadSingle(); 47 | pagedData._ranges.Add(new Vector2(minR, maxR)); 48 | } 49 | } 50 | 51 | return true; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_LOD.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb27e4d370d1aa94da4f01db7aae575a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Material.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Material : osg_StateAttribute 9 | { 10 | void readMaterialProperty(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | bool frontAndBack = reader.ReadBoolean(); 13 | Vector4 frontProp = new Vector4( 14 | reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); 15 | Vector4 backProp = new Vector4( 16 | reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); 17 | } 18 | 19 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 20 | { 21 | if (!base.read(gameObj, reader, owner)) 22 | return false; 23 | 24 | int colorMode = reader.ReadInt32(); // _colorMode 25 | 26 | bool hasMtlProp = reader.ReadBoolean(); // _ambient 27 | if (hasMtlProp) readMaterialProperty(gameObj, reader, owner); 28 | 29 | hasMtlProp = reader.ReadBoolean(); // _diffuse 30 | if (hasMtlProp) readMaterialProperty(gameObj, reader, owner); 31 | 32 | hasMtlProp = reader.ReadBoolean(); // _specular 33 | if (hasMtlProp) readMaterialProperty(gameObj, reader, owner); 34 | 35 | hasMtlProp = reader.ReadBoolean(); // _emission 36 | if (hasMtlProp) readMaterialProperty(gameObj, reader, owner); 37 | 38 | hasMtlProp = reader.ReadBoolean(); // _shininess 39 | if (hasMtlProp) 40 | { 41 | bool frontAndBack = reader.ReadBoolean(); 42 | float frontValue = reader.ReadSingle(); 43 | float backValue = reader.ReadSingle(); 44 | } 45 | 46 | return true; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Material.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38b37ca47b5ff764997631dea40891ca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_MatrixTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_MatrixTransform : osg_Transform 9 | { 10 | public static Vector3 ExtractTranslationFromMatrix(ref Matrix4x4 matrix) 11 | { 12 | Vector3 translate; 13 | translate.x = matrix.m03; 14 | translate.y = matrix.m13; 15 | translate.z = matrix.m23; 16 | return translate; 17 | } 18 | 19 | public static Quaternion ExtractRotationFromMatrix(ref Matrix4x4 matrix) 20 | { 21 | Vector3 forward, upwards; 22 | forward.x = matrix.m02; forward.y = matrix.m12; forward.z = matrix.m22; 23 | upwards.x = matrix.m01; upwards.y = matrix.m11; upwards.z = matrix.m21; 24 | return Quaternion.LookRotation(forward, upwards); 25 | } 26 | 27 | public static Vector3 ExtractScaleFromMatrix(ref Matrix4x4 matrix) 28 | { 29 | Vector3 scale; 30 | scale.x = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude; 31 | scale.y = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude; 32 | scale.z = new Vector4(matrix.m02, matrix.m12, matrix.m22, matrix.m32).magnitude; 33 | return scale; 34 | } 35 | 36 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 37 | { 38 | GameObject parentObj = gameObj as GameObject; 39 | if (!base.read(gameObj, reader, owner)) 40 | return false; 41 | 42 | // _matrix 43 | long blockSize = ReadBracket(reader, owner); 44 | 45 | Matrix4x4 matrix = new Matrix4x4(); 46 | matrix.m00 = (float)reader.ReadDouble(); matrix.m10 = (float)reader.ReadDouble(); 47 | matrix.m20 = (float)reader.ReadDouble(); matrix.m30 = (float)reader.ReadDouble(); 48 | matrix.m01 = (float)reader.ReadDouble(); matrix.m11 = (float)reader.ReadDouble(); 49 | matrix.m21 = (float)reader.ReadDouble(); matrix.m31 = (float)reader.ReadDouble(); 50 | matrix.m02 = (float)reader.ReadDouble(); matrix.m12 = (float)reader.ReadDouble(); 51 | matrix.m22 = (float)reader.ReadDouble(); matrix.m32 = (float)reader.ReadDouble(); 52 | matrix.m03 = (float)reader.ReadDouble(); matrix.m13 = (float)reader.ReadDouble(); 53 | matrix.m23 = (float)reader.ReadDouble(); matrix.m33 = (float)reader.ReadDouble(); 54 | 55 | parentObj.transform.localPosition = ExtractTranslationFromMatrix(ref matrix); 56 | parentObj.transform.localRotation = ExtractRotationFromMatrix(ref matrix); 57 | parentObj.transform.localScale = ExtractScaleFromMatrix(ref matrix); 58 | return true; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_MatrixTransform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0dfff355a002644e98e89ee97ba9ffd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Node.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Node : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasInitBound = reader.ReadBoolean(); // _initialBound 16 | if (hasInitBound) 17 | { 18 | long blockSize = ReadBracket(reader, owner); 19 | Vector3 boudCenter = new Vector3( 20 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), (float)reader.ReadDouble()); 21 | double radius = reader.ReadDouble(); 22 | } 23 | 24 | bool hasComputeBoundCB = reader.ReadBoolean(); // _computeBoundCallback 25 | if (hasComputeBoundCB) LoadObject(gameObj, reader, owner); 26 | 27 | bool hasUpdateCB = reader.ReadBoolean(); // _updateCallback 28 | if (hasUpdateCB) LoadObject(gameObj, reader, owner); 29 | 30 | bool hasEventCB = reader.ReadBoolean(); // _eventCallback 31 | if (hasEventCB) LoadObject(gameObj, reader, owner); 32 | 33 | bool hasCullCB = reader.ReadBoolean(); // _cullCallback 34 | if (hasCullCB) LoadObject(gameObj, reader, owner); 35 | 36 | bool cullingActive = reader.ReadBoolean(); // _cullingActive 37 | int nodeMask = reader.ReadInt32(); // _nodeMask 38 | 39 | bool hasStateSet = reader.ReadBoolean(); // _stateset 40 | if (hasStateSet) LoadObject(gameObj, reader, owner); 41 | 42 | return true; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Node.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e86425b1048f0d847a4126e856f6db67 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_NodeCallback.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_NodeCallback : osg_Callback 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_NodeCallback.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b5bc7081bffd1942a54ad3a38cb4223 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Object.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Object : ObjectBase 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | string name = ReadString(reader); // _name 13 | int dataVariance = reader.ReadInt32(); // _dataVariance 14 | 15 | bool hasUserData = reader.ReadBoolean(); // _userData 16 | if (hasUserData) 17 | { 18 | Debug.LogWarning("_userData not implemented"); 19 | return false; 20 | } 21 | 22 | if (name.Length > 0) gameObj.name = name; 23 | else if (gameObj.name.Contains("Child")) 24 | { 25 | string objName = gameObj.name; 26 | gameObj.name = objName.Replace("Child", this.GetType().Name); 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Object.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03a7f2382012ddd4a8ba2fae00d8f654 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_PagedLOD.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_PagedLOD : osg_LOD 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | PagedData pagedData = parentObj.GetComponent(); 17 | pagedData._rootFileName = owner._currentFileName; 18 | 19 | bool hasPath = reader.ReadBoolean(); // _databasePath 20 | if (hasPath) 21 | { 22 | bool notEmptyPath = reader.ReadBoolean(); 23 | if (notEmptyPath) 24 | { 25 | string databasePath = ReadString(reader); 26 | if (pagedData != null) pagedData._databasePath = databasePath; 27 | } 28 | } 29 | 30 | //int numFrames = reader.ReadInt32(); // _frameNumberOfLastTraversal 31 | int numExpired = reader.ReadInt32(); // _numChildrenThatCannotBeExpired 32 | bool disableExternalPaging = reader.ReadBoolean(); // _disableExternalChildrenPaging 33 | 34 | bool hasRangeData = reader.ReadBoolean(); // _perRangeDataList 35 | if (hasRangeData) 36 | { 37 | uint numRanges = reader.ReadUInt32(); 38 | long blockSize = ReadBracket(reader, owner); 39 | for (uint i = 0; i < numRanges; ++i) 40 | { 41 | string pagedFile = ReadString(reader); 42 | //Debug.Log(i + ": " + pagedFile); 43 | if (pagedData != null) pagedData._fileNames.Add(pagedFile); 44 | } 45 | 46 | uint numPriorityOffsets = reader.ReadUInt32(); 47 | blockSize = ReadBracket(reader, owner); 48 | for (uint i = 0; i < numPriorityOffsets; ++i) 49 | { 50 | float offset = reader.ReadSingle(); 51 | float scale = reader.ReadSingle(); 52 | } 53 | } 54 | 55 | bool hasChildren = reader.ReadBoolean(); // _children (preloaded) 56 | if (hasChildren) 57 | { 58 | uint numChildren = reader.ReadUInt32(); 59 | long blockSize = ReadBracket(reader, owner); 60 | for (uint i = 0; i < numChildren; ++i) 61 | { 62 | GameObject children = new GameObject("Child_" + i.ToString()); 63 | if (parentObj && LoadObject(children, reader, owner)) 64 | children.transform.SetParent(parentObj.transform, false); 65 | if (pagedData != null) pagedData._pagedNodes.Add(children); 66 | } 67 | } 68 | 69 | return true; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_PagedLOD.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edc47f420a4659445ae39f81e4c54be7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_PrimitiveSet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_PrimitiveSet : osg_BufferData // FIXME: version >= 147 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int numInstances = reader.ReadInt32(); // NumInstances 17 | int mode = reader.ReadInt32(); // Mode 18 | 19 | GeometryData gd = parentObj.GetComponent(); 20 | if (gd != null) gd._mode = mode; 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_PrimitiveSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95c41e7afa140bf4284a14e1beb96306 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ShadeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_ShadeModel : osg_StateAttribute 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | int shadeMode = reader.ReadInt32(); // _mode 16 | return true; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_ShadeModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da11e72966cded541b598731593baba9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_StateAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_StateAttribute : osg_Object 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasUpdateCB = reader.ReadBoolean(); // _updateCallback 16 | if (hasUpdateCB) LoadObject(gameObj, reader, owner); 17 | 18 | bool hasEventCB = reader.ReadBoolean(); // _eventCallback 19 | if (hasEventCB) LoadObject(gameObj, reader, owner); 20 | 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_StateAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6953032eb89231f48af579d6a92b6748 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_StateSet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_StateSet : osg_Object 9 | { 10 | void readModes(Object gameObj, BinaryReader reader, ReaderOSGB owner, bool asTexMode) 11 | { 12 | int numTexUnits = asTexMode ? reader.ReadInt32() : 1; 13 | if (asTexMode) ReadBracket(reader, owner); 14 | 15 | for (int u = 0; u < numTexUnits; ++u) 16 | { 17 | int numModes = reader.ReadInt32(); 18 | if (numModes > 0) 19 | { 20 | long blockSize = ReadBracket(reader, owner); 21 | for (int i = 0; i < numModes; ++i) 22 | { 23 | int glEnum = reader.ReadInt32(); 24 | int value = reader.ReadInt32(); 25 | } 26 | } 27 | } 28 | } 29 | 30 | void readAttributes(Object gameObj, BinaryReader reader, ReaderOSGB owner, bool asTexAttr) 31 | { 32 | int numTexUnits = asTexAttr ? reader.ReadInt32() : 1; 33 | if (asTexAttr) { long blockSize = ReadBracket(reader, owner); } 34 | 35 | for (int u = 0; u < numTexUnits; ++u) 36 | { 37 | int numAttrs = reader.ReadInt32(); 38 | if (numAttrs > 0) 39 | { 40 | long blockSize = ReadBracket(reader, owner); 41 | for (int i = 0; i < numAttrs; ++i) 42 | { 43 | LoadObject(gameObj, reader, owner); 44 | int value = reader.ReadInt32(); 45 | } 46 | } 47 | } 48 | } 49 | 50 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 51 | { 52 | if (!base.read(gameObj, reader, owner)) 53 | return false; 54 | 55 | bool hasModes = reader.ReadBoolean(); // _modeList 56 | if (hasModes) readModes(gameObj, reader, owner, false); 57 | 58 | bool hasAttrs = reader.ReadBoolean(); // _attributeList 59 | if (hasAttrs) readAttributes(gameObj, reader, owner, false); 60 | 61 | hasModes = reader.ReadBoolean(); // _textureModeList 62 | if (hasModes) readModes(gameObj, reader, owner, true); 63 | 64 | hasAttrs = reader.ReadBoolean(); // _textureAttributeList 65 | if (hasAttrs) readAttributes(gameObj, reader, owner, true); 66 | 67 | bool hasUniforms = reader.ReadBoolean(); // _uniformList 68 | if (hasUniforms) 69 | { 70 | int numUniforms = reader.ReadInt32(); 71 | long blockSize = ReadBracket(reader, owner); 72 | for (int i = 0; i < numUniforms; ++i) 73 | { 74 | LoadObject(gameObj, reader, owner); 75 | int value = reader.ReadInt32(); 76 | } 77 | } 78 | 79 | int renderingHint = reader.ReadInt32(); // _renderingHint 80 | int binMode = reader.ReadInt32(); // _binMode 81 | int binNumber = reader.ReadInt32(); // _binNum 82 | string binName = ReadString(reader); // _binName 83 | bool nestedBin = reader.ReadBoolean(); // _nestRenderBins 84 | 85 | bool hasUpdateCB = reader.ReadBoolean(); // _updateCallback 86 | if (hasUpdateCB) LoadObject(gameObj, reader, owner); 87 | 88 | bool hasEventCB = reader.ReadBoolean(); // _eventCallback 89 | if (hasEventCB) LoadObject(gameObj, reader, owner); 90 | 91 | if (owner._version >= 151) 92 | { 93 | bool hasDefListData = reader.ReadBoolean(); // _defineList 94 | if (hasDefListData) 95 | { 96 | Debug.LogWarning("_defineList not implemented"); 97 | return false; 98 | } 99 | } 100 | return true; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_StateSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e511e2ff62d2054c8f2bbe202e29a4e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Texture.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Texture : osg_StateAttribute 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasWrap = reader.ReadBoolean(); // _wrap_s 16 | if (hasWrap) { int wrapS = reader.ReadInt32(); } 17 | 18 | hasWrap = reader.ReadBoolean(); // _wrap_r 19 | if (hasWrap) { int wrapR = reader.ReadInt32(); } 20 | 21 | hasWrap = reader.ReadBoolean(); // _wrap_t 22 | if (hasWrap) { int wrapT = reader.ReadInt32(); } 23 | 24 | bool hasFilter = reader.ReadBoolean(); // _min_filter 25 | if (hasFilter) { int minFilter = reader.ReadInt32(); } 26 | 27 | hasFilter = reader.ReadBoolean(); // _mag_filter 28 | if (hasFilter) { int magFilter = reader.ReadInt32(); } 29 | 30 | float maxAnisotropy = reader.ReadSingle(); // _maxAnisotropy 31 | bool useHardwareMipmap = reader.ReadBoolean(); // _useHardwareMipMapGeneration 32 | bool unrefImageAfterApply = reader.ReadBoolean(); // _unrefImageDataAfterApply 33 | bool clientStorageHint = reader.ReadBoolean(); // _clientStorageHint 34 | bool resizeNPOT = reader.ReadBoolean(); // _resizeNonPowerOfTwoHint 35 | Vector4 borderColor = new Vector4( // _borderColor 36 | (float)reader.ReadDouble(), (float)reader.ReadDouble(), 37 | (float)reader.ReadDouble(), (float)reader.ReadDouble()); 38 | int borderWidth = reader.ReadInt32(); // _borderWidth 39 | int formatMode = reader.ReadInt32(); // _internalFormatMode 40 | 41 | bool hasInternalFormat = reader.ReadBoolean(); // _internalFormat 42 | if (hasInternalFormat) { int internalFormat = reader.ReadInt32(); } 43 | 44 | bool hasSourceFormat = reader.ReadBoolean(); // _sourceFormat 45 | if (hasSourceFormat) { int sourceFormat = reader.ReadInt32(); } 46 | 47 | bool hasSourceType = reader.ReadBoolean(); // _sourceType 48 | if (hasSourceType) { int sourceType = reader.ReadInt32(); } 49 | 50 | bool useShadowCompare = reader.ReadBoolean(); // _use_shadow_comparison 51 | int shadowCompareFunc = reader.ReadInt32(); // _shadow_compare_func 52 | int shadowTextureMode = reader.ReadInt32(); // _shadow_texture_mode 53 | float shadowAmbient = reader.ReadSingle(); // _shadow_ambient 54 | 55 | if (owner._version >= 95 && owner._version < 153) 56 | { 57 | bool hasImageAttachment = reader.ReadBoolean(); // _imageAttachment 58 | if (hasImageAttachment) 59 | { 60 | int unit = reader.ReadInt32(); 61 | int level = reader.ReadInt32(); 62 | bool layered = reader.ReadBoolean(); 63 | int layer = reader.ReadInt32(); 64 | int access = reader.ReadInt32(); 65 | int format = reader.ReadInt32(); 66 | } 67 | } 68 | 69 | if (owner._version >= 98) 70 | { 71 | bool hasSwizzle = reader.ReadBoolean(); // _swizzle 72 | if (hasSwizzle) { string swizzle = ReadString(reader); } 73 | } 74 | 75 | if (owner._version >= 155) 76 | { 77 | float minLOD = reader.ReadSingle(); // _minLOD 78 | float maxLOD = reader.ReadSingle(); // _maxLOD 79 | float lodBias = reader.ReadSingle(); // _lodBias 80 | } 81 | return true; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Texture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fbcd1360a92f3b44a9899863c3941c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Texture2D.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Texture2D : osg_Texture 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | bool hasImage = reader.ReadBoolean(); // _image 16 | if (hasImage) 17 | owner._preloadedTexture = LoadImage(gameObj, reader, owner); 18 | 19 | int texWidth = reader.ReadInt32(); 20 | int texHeight = reader.ReadInt32(); 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Texture2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe9205d4b9949ed4cacce5d085367219 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Transform.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Transform : osg_Group 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int referenceFrame = reader.ReadInt32(); // _referenceFrame 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Transform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27587d9e6ec794b448afb2d974b503b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec2Array.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Vec2Array : osg_Array 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int numData = reader.ReadInt32(); 17 | List vArray = new List(); 18 | for (int i = 0; i < numData; ++i) 19 | { 20 | Vector2 v = new Vector2(reader.ReadSingle(), reader.ReadSingle()); 21 | vArray.Add(v); 22 | } 23 | 24 | GeometryData gd = parentObj.GetComponent(); 25 | if (gd != null) gd._vec2Array = vArray; 26 | return true; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec2Array.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54da8dcc601b35949aeca4d029d43ef3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec3Array.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Vec3Array : osg_Array 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int numData = reader.ReadInt32(); 17 | List vArray = new List(); 18 | for (int i = 0; i < numData; ++i) 19 | { 20 | Vector3 v = new Vector3(reader.ReadSingle(), 21 | reader.ReadSingle(), reader.ReadSingle()); 22 | vArray.Add(v); 23 | } 24 | 25 | GeometryData gd = parentObj.GetComponent(); 26 | if (gd != null) gd._vec3Array = vArray; 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec3Array.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18d034c87c805cb4f82ed01a9ec3abb1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec4Array.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Vec4Array : osg_Array 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int numData = reader.ReadInt32(); 17 | List vArray = new List(); 18 | for (int i = 0; i < numData; ++i) 19 | { 20 | Vector4 v = new Vector4(reader.ReadSingle(), reader.ReadSingle(), 21 | reader.ReadSingle(), reader.ReadSingle()); 22 | vArray.Add(v); 23 | } 24 | 25 | GeometryData gd = parentObj.GetComponent(); 26 | if (gd != null) gd._vec4Array = vArray; 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec4Array.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86c2ed8b2b9818e4596c3472b63ed80f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec4ubArray.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_Vec4ubArray : osg_Array 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | GameObject parentObj = gameObj as GameObject; 13 | if (!base.read(gameObj, reader, owner)) 14 | return false; 15 | 16 | int numData = reader.ReadInt32(); 17 | List vArray = new List(); 18 | for (int i = 0; i < numData; ++i) 19 | { 20 | Color v = new Color( 21 | (float)reader.ReadByte() / 255.0f, (float)reader.ReadByte() / 255.0f, 22 | (float)reader.ReadByte() / 255.0f, (float)reader.ReadByte() / 255.0f); 23 | vArray.Add(v); 24 | } 25 | 26 | GeometryData gd = parentObj.GetComponent(); 27 | if (gd != null) gd._vec4ubArray = vArray; 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_Vec4ubArray.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40e1fbfa41c9b0f498c16529c46b64b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_VertexBufferObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace osgEx 7 | { 8 | public class osg_VertexBufferObject : osg_BufferObject 9 | { 10 | public override bool read(Object gameObj, BinaryReader reader, ReaderOSGB owner) 11 | { 12 | if (!base.read(gameObj, reader, owner)) 13 | return false; 14 | 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/ReaderOSGB/osg_VertexBufferObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd642012eea6c9343abe1c9dea979eec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f49ce312b173b1409cb658393272984 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/osgb_loader.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/osgb_loaderSettings.lighting: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!850595691 &4890085278179872738 4 | LightingSettings: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: osgb_loaderSettings 10 | serializedVersion: 3 11 | m_GIWorkflowMode: 1 12 | m_EnableBakedLightmaps: 1 13 | m_EnableRealtimeLightmaps: 0 14 | m_RealtimeEnvironmentLighting: 1 15 | m_BounceScale: 1 16 | m_AlbedoBoost: 1 17 | m_IndirectOutputScale: 1 18 | m_UsingShadowmask: 1 19 | m_BakeBackend: 1 20 | m_LightmapMaxSize: 1024 21 | m_BakeResolution: 40 22 | m_Padding: 2 23 | m_TextureCompression: 1 24 | m_AO: 0 25 | m_AOMaxDistance: 1 26 | m_CompAOExponent: 1 27 | m_CompAOExponentDirect: 0 28 | m_ExtractAO: 0 29 | m_MixedBakeMode: 2 30 | m_LightmapsBakeMode: 1 31 | m_FilterMode: 1 32 | m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} 33 | m_ExportTrainingData: 0 34 | m_TrainingDataDestination: TrainingData 35 | m_RealtimeResolution: 2 36 | m_ForceWhiteAlbedo: 0 37 | m_ForceUpdates: 0 38 | m_FinalGather: 0 39 | m_FinalGatherRayCount: 256 40 | m_FinalGatherFiltering: 1 41 | m_PVRCulling: 1 42 | m_PVRSampling: 1 43 | m_PVRDirectSampleCount: 32 44 | m_PVRSampleCount: 500 45 | m_PVREnvironmentSampleCount: 500 46 | m_PVREnvironmentReferencePointCount: 2048 47 | m_LightProbeSampleCountMultiplier: 4 48 | m_PVRBounces: 2 49 | m_PVRMinBounces: 2 50 | m_PVREnvironmentMIS: 0 51 | m_PVRFilteringMode: 2 52 | m_PVRDenoiserTypeDirect: 0 53 | m_PVRDenoiserTypeIndirect: 0 54 | m_PVRDenoiserTypeAO: 0 55 | m_PVRFilterTypeDirect: 0 56 | m_PVRFilterTypeIndirect: 0 57 | m_PVRFilterTypeAO: 0 58 | m_PVRFilteringGaussRadiusDirect: 1 59 | m_PVRFilteringGaussRadiusIndirect: 5 60 | m_PVRFilteringGaussRadiusAO: 2 61 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 62 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 63 | m_PVRFilteringAtrousPositionSigmaAO: 1 64 | -------------------------------------------------------------------------------- /Assets/Scenes/osgb_loaderSettings.lighting.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2540d425038a7594aafef457588f4bfb 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 4890085278179872738 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Rui Wang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NativePlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.1) 2 | PROJECT(OSG_Unity_Plugin) 3 | 4 | SET(CMAKE_DEBUG_POSTFIX "d") 5 | SET(CMAKE_CXX_STANDARD 11) 6 | SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR};${CMAKE_MODULE_PATH}") 7 | 8 | MACRO(NEW_LIBRARY LIBRARY_NAME LIBRARY_TYPE) 9 | ADD_LIBRARY(${LIBRARY_NAME} ${LIBRARY_TYPE} ${LIBRARY_FILES}) 10 | 11 | SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") 12 | SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib" 13 | ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib" 14 | LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib" 15 | LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib" 16 | RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin" 17 | RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin") 18 | 19 | INSTALL(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 20 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 21 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) 22 | 23 | TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PUBLIC ${EXTERNAL_INCLUDES}) 24 | TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${EXTERNAL_LIBRARIES}) 25 | ENDMACRO(NEW_LIBRARY) 26 | 27 | IF(NOT WIN32) 28 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic") 29 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -std=c++11") 30 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register") 31 | ENDIF(NOT WIN32) 32 | 33 | IF(MSVC) 34 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj") 35 | SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") 36 | ENDIF(MSVC) 37 | 38 | FIND_PACKAGE(OpenGL) 39 | INCLUDE_DIRECTORIES(. ${OPENGL_INCLUDE_DIR}) 40 | ADD_DEFINITIONS(-DBUILD_UNITY_PLUGIN) 41 | 42 | FIND_PATH(OSG_INCLUDE_DIR osg/Referenced 43 | PATHS 44 | $ENV{OSG_ROOT}/include 45 | $ENV{OSG_DIR}/include 46 | /usr/include 47 | /usr/local/include 48 | ) 49 | 50 | FIND_PATH(OSG_LIB_DIR libosg.so osg.lib 51 | PATHS 52 | $ENV{OSG_ROOT}/lib 53 | $ENV{OSG_DIR}/lib 54 | /usr/lib 55 | /usr/local/lib 56 | ) 57 | 58 | FIND_PATH(OSG_3RDPARTY_LIB_DIR libjpeg.lib 59 | PATHS 60 | $ENV{OSG_ROOT}/lib 61 | $ENV{OSG_DIR}/lib 62 | /usr/lib 63 | /usr/local/lib 64 | ) 65 | 66 | MACRO(LINK_OSG_LIBRARY) 67 | FOREACH(OSG_LIB_NAME ${ARGN}) 68 | TARGET_LINK_LIBRARIES(${LIB_NAME} debug ${OSG_PREFIX}${OSG_LIB_NAME}d 69 | optimized ${OSG_PREFIX}${OSG_LIB_NAME}) 70 | ENDFOREACH() 71 | ENDMACRO(LINK_OSG_LIBRARY) 72 | 73 | MACRO(LINK_OSG_PLUGIN) 74 | FOREACH(PLUGIN_NAME ${ARGN}) 75 | TARGET_LINK_LIBRARIES(${LIB_NAME} debug ${OSG_PLUGINS_PREFIX}osgdb_${PLUGIN_NAME}d 76 | optimized ${OSG_PLUGINS_PREFIX}osgdb_${PLUGIN_NAME}) 77 | ENDFOREACH() 78 | ENDMACRO(LINK_OSG_PLUGIN) 79 | 80 | MACRO(LINK_OSG_PLUGIN_DEP) 81 | FOREACH(DEP_NAME ${ARGN}) 82 | TARGET_LINK_LIBRARIES(${LIB_NAME} ${DEP_NAME}) 83 | ENDFOREACH() 84 | ENDMACRO(LINK_OSG_PLUGIN_DEP) 85 | 86 | IF(OSG_INCLUDE_DIR AND OSG_LIB_DIR) 87 | SET(LIB_NAME Mana_OpenSceneGraphLoader) 88 | SET(LIBRARY_FILES 89 | InterfaceBase.h 90 | Export.h 91 | Export.cpp 92 | UpdateDatabasePager.h 93 | UpdateDatabasePager.cpp 94 | Intersector.h 95 | Intersector.cpp 96 | ) 97 | SET(LIBRARY_HEADERS Export.h) 98 | 99 | INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR}) 100 | LINK_DIRECTORIES(${OSG_LIB_DIR} ${OSG_3RDPARTY_LIB_DIR}) 101 | NEW_LIBRARY(${LIB_NAME} SHARED) 102 | 103 | OPTION(OSG_USE_STATIC_BUILD "Use static OpenSceneGraph" OFF) 104 | IF (OSG_USE_STATIC_BUILD) 105 | ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) 106 | ENDIF() 107 | 108 | IF (WIN32) 109 | IF (OSG_USE_STATIC_BUILD) 110 | SET(OSG_PREFIX "osg160-" CACHE STRING "The prefix of OSG libraries") 111 | SET(OSG_PLUGINS_PREFIX "osgPlugins-3.7.0/" CACHE STRING "The prefix of OSG plugins") 112 | SET(OSG_OT_PREFIX "ot21-" CACHE STRING "The prefix of OpenThreads libraries") 113 | ELSE() 114 | SET(OSG_PREFIX "") 115 | SET(OSG_PLUGINS_PREFIX "") 116 | SET(OSG_OT_PREFIX "") 117 | ENDIF() 118 | 119 | TARGET_LINK_LIBRARIES(${LIB_NAME} ${OPENGL_gl_LIBRARY} debug ${OSG_OT_PREFIX}OpenThreadsd 120 | optimized ${OSG_OT_PREFIX}OpenThreads) 121 | LINK_OSG_LIBRARY(osg osgDB osgUtil osgGA osgText osgSim osgTerrain osgViewer) 122 | IF (OSG_USE_STATIC_BUILD) 123 | LINK_OSG_PLUGIN(3ds bmp dds gif ive jpeg obj openflight osg png rgb shp stl tga txp vtf 124 | deprecated_osg deprecated_osgsim deprecated_osgterrain 125 | serializers_osg serializers_osgsim serializers_osgterrain) 126 | LINK_OSG_PLUGIN_DEP(libjpeg libpng libungif zlib) 127 | ENDIF() 128 | ENDIF(WIN32) 129 | 130 | IF(APPLE) 131 | #TARGET_LINK_LIBRARIES(${LIB_NAME} ...) 132 | ENDIF(APPLE) 133 | 134 | TARGET_LINK_LIBRARIES(${LIB_NAME} ${OPENGL_gl_LIBRARY}) 135 | TARGET_COMPILE_OPTIONS(${LIB_NAME} PUBLIC -D_SCL_SECURE_NO_WARNINGS) 136 | IF(APPLE) 137 | TARGET_LINK_LIBRARIES(${LIB_NAME} objc) 138 | ENDIF(APPLE) 139 | ENDIF(OSG_INCLUDE_DIR AND OSG_LIB_DIR) 140 | -------------------------------------------------------------------------------- /NativePlugin/Export.h: -------------------------------------------------------------------------------- 1 | #ifndef OSG_LOADER_EXPORT_HPP 2 | #define OSG_LOADER_EXPORT_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define MANA_PLUGIN_NAME "[Mana_OpenSceneGraphLoader]" 11 | #define MANA_PLUGIN_VERSION 100 12 | typedef void (*UserLogFunction)(const char*, int); 13 | 14 | extern "C" 15 | { 16 | UNITY_INTERFACE_EXPORT const char* UNITY_INTERFACE_API getPluginName(); 17 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API getPluginVersion(); 18 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API setUserLogFunction(UserLogFunction func); 19 | 20 | // Read functions 21 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API requestNodeFile(const char* file); 22 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API takeNewlyAddedNodes(int root, int* count); 23 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API takeNewlyRemovedNodes(int root, int* count); 24 | 25 | // Data obtain functions 26 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API beginReadNode(int id); 27 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API beginReadPagedNode(int id, int location); 28 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API endReadNode(bool eraseNodeData); 29 | 30 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API updatePagedNodeState(int id, int* count); 31 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API removeNode(int id); 32 | 33 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readNodeLocalTransform(int subID, int* count); 34 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API readNodeLocalTransformDecomposition( 35 | int subID, float* pos, float* quat, float* scale); 36 | 37 | UNITY_INTERFACE_EXPORT const char* UNITY_INTERFACE_API readNodeNameAndType(int subID, int* type); 38 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API readNodeChildrenCount(int subID); 39 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API readNodeChildren(int subID, int* count); 40 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API readNodeGlobalID(int subID); 41 | 42 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API readMeshCount(int subID); 43 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API readMeshes(int subID, int* count); 44 | 45 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readMeshWorldTransform(int subID, int* count); 46 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API readPrimitiveCounts(int subID, int* pts, int* lines, int* tris); 47 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API readPoints(int subID, int* count); 48 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API readLines(int subID, int* count); 49 | UNITY_INTERFACE_EXPORT int* UNITY_INTERFACE_API readTriangles(int subID, int* count); 50 | 51 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API readVertexCount(int subID); 52 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readVertices(int subID, int* count); 53 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readVertexColors(int subID, int* count); 54 | UNITY_INTERFACE_EXPORT char* UNITY_INTERFACE_API readVertexColorsUB(int subID, int* count); 55 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readNormals(int subID, int* count); 56 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API readUV(int subID, int channel, int* count); 57 | 58 | UNITY_INTERFACE_EXPORT const char* UNITY_INTERFACE_API readTextureName(int subID); 59 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API readTextureSize(int subID, int* w, int* h); 60 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API readTextureFormat(int subID, int* wrapMode); 61 | UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API readTexture(int subID, int* dataSize); 62 | 63 | // Intersection with linesegment: beginIntersectWithLineSegment(xyz, xyz, ref n, bool) 64 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API beginIntersectWithLineSegment( 65 | float* start, float* end, float pointChkBias, bool pointsOnly, bool readAll); 66 | // Intersection with polytope: beginIntersectWithPolytope((xyz * m),(d * m), m, ref n, bool) 67 | UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API beginIntersectWithPolytope( 68 | float* planeNormals, float* distances, int planeCount, bool pointsOnly, bool readAll); 69 | 70 | // Intersection result: position (xyz * n), color (rgba * n) 71 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API getIntersectedPositions(int* resultCount); 72 | UNITY_INTERFACE_EXPORT float* UNITY_INTERFACE_API getIntersectedColors(int* resultCount); 73 | 74 | // Must always use a begin/end pair 75 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API endIntersection(); 76 | 77 | // Global updating functions 78 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API setEyePosition(float x, float y, float z); 79 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API setViewTarget(float x, float y, float z); 80 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API setCameraUpDirection(float x, float y, float z); 81 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API setCameraProperties(float width, float height, float vFov, 82 | float zNear, float zFar, float lodScale); 83 | UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API updateDatabasePager(float deltaTime); 84 | UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API closeAll(); 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /NativePlugin/InterfaceBase.h: -------------------------------------------------------------------------------- 1 | #ifndef INTERFACE_BASE_HPP 2 | #define INTERFACE_BASE_HPP 3 | 4 | #ifdef BUILD_UNITY_PLUGIN 5 | #include 6 | #else 7 | #if defined(__CYGWIN32__) 8 | #define UNITY_INTERFACE_API __stdcall 9 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 10 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 11 | #define UNITY_INTERFACE_API __stdcall 12 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 13 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) 14 | #define UNITY_INTERFACE_API 15 | #define UNITY_INTERFACE_EXPORT 16 | #else 17 | #define UNITY_INTERFACE_API 18 | #define UNITY_INTERFACE_EXPORT 19 | #endif 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /NativePlugin/Intersector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "Intersector.h" 5 | #include "Export.h" 6 | 7 | osg::ref_ptr ReadIntersectionFileCallback::readNodeFile(const std::string& filename) 8 | { 9 | return osgDB::readNodeFile(filename, options.get()); 10 | } 11 | 12 | void IntersectionVisitorEx::apply(osg::PagedLOD& plod) 13 | { 14 | if (_readCallback.valid()) 15 | { 16 | ReadIntersectionFileCallback* rfc = static_cast(_readCallback.get()); 17 | rfc->options = static_cast(plod.getDatabaseOptions()); // for EPT data... 18 | } 19 | osgUtil::IntersectionVisitor::apply(plod); 20 | } 21 | 22 | osgUtil::Intersector* PointIntersector::clone(osgUtil::IntersectionVisitor& iv) 23 | { 24 | if (_coordinateFrame == MODEL && iv.getModelMatrix() == 0) 25 | { 26 | osg::ref_ptr cloned = new PointIntersector(_start, _end); 27 | cloned->_parent = this; cloned->_pickBias = _pickBias; 28 | return cloned.release(); 29 | } 30 | 31 | osg::Matrix matrix; 32 | switch (_coordinateFrame) 33 | { 34 | case WINDOW: 35 | if (iv.getWindowMatrix()) matrix.preMult(*iv.getWindowMatrix()); 36 | if (iv.getProjectionMatrix()) matrix.preMult(*iv.getProjectionMatrix()); 37 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 38 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 39 | break; 40 | case PROJECTION: 41 | if (iv.getProjectionMatrix()) matrix.preMult(*iv.getProjectionMatrix()); 42 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 43 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 44 | break; 45 | case VIEW: 46 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 47 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 48 | break; 49 | case MODEL: 50 | if (iv.getModelMatrix()) matrix = *iv.getModelMatrix(); 51 | break; 52 | } 53 | 54 | osg::Matrix inverse = osg::Matrix::inverse(matrix); 55 | osg::ref_ptr cloned = new PointIntersector(_start * inverse, _end * inverse); 56 | cloned->_parent = this; cloned->_pickBias = _pickBias; 57 | return cloned.release(); 58 | } 59 | 60 | void PointIntersector::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable) 61 | { 62 | osg::BoundingBox bb = drawable->getBoundingBox(); 63 | bb.xMin() -= _pickBias; bb.xMax() += _pickBias; 64 | bb.yMin() -= _pickBias; bb.yMax() += _pickBias; 65 | bb.zMin() -= _pickBias; bb.zMax() += _pickBias; 66 | 67 | osg::Vec3d s(_start), e(_end); 68 | if (!intersectAndClip(s, e, bb)) return; 69 | if (iv.getDoDummyTraversal()) return; 70 | 71 | osg::Geometry* geometry = drawable->asGeometry(); 72 | if (geometry) 73 | { 74 | osg::Vec3Array* vertices = dynamic_cast(geometry->getVertexArray()); 75 | if (!vertices) return; 76 | 77 | osg::Vec3d dir = e - s; 78 | double invLength = 1.0 / dir.length(); 79 | for (unsigned int i = 0; i < vertices->size(); ++i) 80 | { 81 | double distance = fabs((((*vertices)[i] - s) ^ dir).length()); 82 | distance *= invLength; 83 | if (_pickBias < distance) continue; 84 | 85 | Intersection hit; 86 | hit.ratio = distance; 87 | hit.nodePath = iv.getNodePath(); 88 | hit.drawable = drawable; 89 | hit.matrix = iv.getModelMatrix(); 90 | hit.localIntersectionPoint = (*vertices)[i]; 91 | hit.indexList.push_back(i); 92 | insertIntersection(hit); 93 | } 94 | } 95 | } 96 | 97 | osgUtil::Intersector* PointIntersector2::clone(osgUtil::IntersectionVisitor& iv) 98 | { 99 | if (_coordinateFrame == MODEL && iv.getModelMatrix() == 0) 100 | { 101 | osg::ref_ptr cloned = new PointIntersector2(_polytope); 102 | cloned->_parent = this; cloned->allPoints = allPoints; cloned->allColors = allColors; 103 | return cloned.release(); 104 | } 105 | 106 | osg::Matrix matrix; 107 | switch (_coordinateFrame) 108 | { 109 | case WINDOW: 110 | if (iv.getWindowMatrix()) matrix.preMult(*iv.getWindowMatrix()); 111 | if (iv.getProjectionMatrix()) matrix.preMult(*iv.getProjectionMatrix()); 112 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 113 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 114 | break; 115 | case PROJECTION: 116 | if (iv.getProjectionMatrix()) matrix.preMult(*iv.getProjectionMatrix()); 117 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 118 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 119 | break; 120 | case VIEW: 121 | if (iv.getViewMatrix()) matrix.preMult(*iv.getViewMatrix()); 122 | if (iv.getModelMatrix()) matrix.preMult(*iv.getModelMatrix()); 123 | break; 124 | case MODEL: 125 | if (iv.getModelMatrix()) matrix = *iv.getModelMatrix(); 126 | break; 127 | } 128 | 129 | osg::Polytope transformedPolytope; 130 | transformedPolytope.setAndTransformProvidingInverse(_polytope, matrix); 131 | osg::ref_ptr cloned = new PointIntersector2(transformedPolytope); 132 | cloned->_parent = this; cloned->allPoints = allPoints; cloned->allColors = allColors; 133 | return cloned.release(); 134 | } 135 | 136 | void PointIntersector2::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable) 137 | { 138 | osg::Geometry* geom = drawable->asGeometry(); 139 | if (!allPoints || !geom || !(geom && geom->getVertexArray())) return; 140 | if (!_polytope.contains(drawable->getBoundingBox())) return; 141 | 142 | Intersection hit; 143 | hit.nodePath = iv.getNodePath(); 144 | hit.drawable = drawable; 145 | hit.matrix = iv.getModelMatrix(); 146 | 147 | osg::Vec3Array* va = static_cast(geom->getVertexArray()); 148 | osg::Vec4Array* ca = dynamic_cast(geom->getColorArray()); 149 | osg::Vec4ubArray* caub = dynamic_cast(geom->getColorArray()); 150 | 151 | osg::Matrix m = hit.matrix.valid() ? *hit.matrix : osg::Matrix(); 152 | osg::Vec3 center; int numData = 0; 153 | for (unsigned int i = 0; i < va->size(); ++i) 154 | { 155 | const osg::Vec3& v = (*va)[i]; 156 | if (_polytope.contains(v)) 157 | { 158 | center += v; 159 | allPoints->push_back(v * m); 160 | if (ca) 161 | allColors->push_back((*ca)[i]); 162 | else if (caub) 163 | { 164 | const osg::Vec4ub& c = (*caub)[i]; 165 | allColors->push_back(osg::Vec4((float)c[0] / 255.0f, (float)c[1] / 255.0f, 166 | (float)c[2] / 255.0f, (float)c[3] / 255.0f)); 167 | } 168 | numData++; 169 | } 170 | } 171 | hit.localIntersectionPoint = center / (float)numData; 172 | insertIntersection(hit); 173 | } 174 | 175 | extern std::map g_nodeRootIdMap; 176 | extern osg::ref_ptr g_nodeRoot; 177 | extern void printUserLog(int level, const char* format, ...); 178 | 179 | struct InteresctionResult 180 | { 181 | std::vector allPoints; 182 | std::vector allColors; 183 | }; 184 | static InteresctionResult g_intersection; 185 | static osg::ref_ptr g_readCallback = new ReadIntersectionFileCallback; 186 | 187 | int UNITY_INTERFACE_API beginIntersectWithLineSegment(float* s, float* e, float pointChkBias, 188 | bool pointsOnly, bool readAll) 189 | { 190 | osg::Vec3 start(s[0], s[1], s[2]), end(e[0], e[1], e[2]); 191 | osg::ref_ptr intersector = pointsOnly 192 | ? new PointIntersector(start, end) 193 | : new osgUtil::LineSegmentIntersector(osgUtil::Intersector::MODEL, start, end); 194 | if (pointsOnly) 195 | ((PointIntersector*)intersector.get())->setPickBias(pointChkBias); 196 | 197 | IntersectionVisitorEx iv(intersector.get()); 198 | iv.setReadCallback(readAll ? g_readCallback.get() : NULL); 199 | intersector->setIntersectionLimit(osgUtil::Intersector::LIMIT_NEAREST); 200 | g_nodeRoot->accept(iv); 201 | 202 | static float result[3] = { 0.0f }; 203 | if (intersector->containsIntersections()) 204 | { 205 | osgUtil::LineSegmentIntersector::Intersections& all = intersector->getIntersections(); 206 | for (osgUtil::LineSegmentIntersector::Intersections::const_iterator itr = all.begin(); 207 | itr != all.end(); ++itr) 208 | { 209 | const osgUtil::LineSegmentIntersector::Intersection& is = *itr; 210 | g_intersection.allPoints.push_back(is.getWorldIntersectPoint()); 211 | } 212 | return g_intersection.allPoints.size(); 213 | } 214 | return 0; 215 | } 216 | 217 | int UNITY_INTERFACE_API beginIntersectWithPolytope(float* planeNormals, float* distances, int planeCount, 218 | bool pointsOnly, bool readAll) 219 | { 220 | osg::Polytope polytope; 221 | for (int i = 0; i < planeCount; ++i) 222 | { 223 | int index = i * 3; 224 | osg::Vec3 n(planeNormals[index + 0], planeNormals[index + 1], planeNormals[index + 2]); 225 | polytope.add(osg::Plane(n, distances[i])); 226 | } 227 | 228 | osg::ref_ptr intersector = pointsOnly 229 | ? new PointIntersector2(polytope) 230 | : new osgUtil::PolytopeIntersector(osgUtil::Intersector::MODEL, polytope); 231 | if (pointsOnly) 232 | { 233 | ((PointIntersector2*)intersector.get())->allPoints = &(g_intersection.allPoints); 234 | ((PointIntersector2*)intersector.get())->allColors = &(g_intersection.allColors); 235 | } 236 | 237 | IntersectionVisitorEx iv(intersector.get()); 238 | iv.setReadCallback(readAll ? g_readCallback.get() : NULL); 239 | g_nodeRoot->accept(iv); 240 | if (intersector->containsIntersections()) 241 | { 242 | if (!pointsOnly) 243 | { 244 | osgUtil::PolytopeIntersector::Intersections& all = intersector->getIntersections(); 245 | for (osgUtil::PolytopeIntersector::Intersections::const_iterator itr = all.begin(); 246 | itr != all.end(); ++itr) 247 | { 248 | const osgUtil::PolytopeIntersector::Intersection& is = *itr; 249 | g_intersection.allPoints.push_back(is.localIntersectionPoint); 250 | } 251 | } 252 | return g_intersection.allPoints.size(); 253 | } 254 | return 0; 255 | } 256 | 257 | float* UNITY_INTERFACE_API getIntersectedPositions(int* resultCount) 258 | { 259 | if (resultCount) *resultCount = g_intersection.allPoints.size(); 260 | if (g_intersection.allPoints.empty()) return NULL; 261 | return (float*)&(g_intersection.allPoints[0]); 262 | } 263 | 264 | float* UNITY_INTERFACE_API getIntersectedColors(int* resultCount) 265 | { 266 | if (resultCount) *resultCount = g_intersection.allColors.size(); 267 | if (g_intersection.allColors.empty()) return NULL; 268 | return (float*)&(g_intersection.allColors[0]); 269 | } 270 | 271 | void UNITY_INTERFACE_API endIntersection() 272 | { 273 | g_intersection.allPoints.clear(); 274 | g_intersection.allColors.clear(); 275 | } 276 | -------------------------------------------------------------------------------- /NativePlugin/Intersector.h: -------------------------------------------------------------------------------- 1 | #ifndef OSG_LOADER_INTERSECTOR_HPP 2 | #define OSG_LOADER_INTERSECTOR_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | struct ReadIntersectionFileCallback : public osgUtil::IntersectionVisitor::ReadCallback 11 | { 12 | virtual osg::ref_ptr readNodeFile(const std::string& filename); 13 | osg::ref_ptr options; 14 | }; 15 | 16 | class IntersectionVisitorEx : public osgUtil::IntersectionVisitor 17 | { 18 | public: 19 | IntersectionVisitorEx(osgUtil::Intersector* i) : osgUtil::IntersectionVisitor(i) {} 20 | virtual void apply(osg::PagedLOD& plod); 21 | }; 22 | 23 | class PointIntersector : public osgUtil::LineSegmentIntersector 24 | { 25 | public: 26 | PointIntersector() 27 | : osgUtil::LineSegmentIntersector(MODEL, 0.0, 0.0), _pickBias(0.01f) {} 28 | PointIntersector(const osg::Vec3& start, const osg::Vec3& end) 29 | : osgUtil::LineSegmentIntersector(MODEL, start, end), _pickBias(0.01f) {} 30 | PointIntersector(CoordinateFrame cf, double x, double y) 31 | : osgUtil::LineSegmentIntersector(cf, x, y), _pickBias(0.01f) {} 32 | 33 | void setPickBias(float bias) { _pickBias = bias; } 34 | float getPickBias() const { return _pickBias; } 35 | 36 | virtual Intersector* clone(osgUtil::IntersectionVisitor& iv); 37 | virtual void intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable); 38 | 39 | protected: 40 | virtual ~PointIntersector() {} 41 | float _pickBias; 42 | }; 43 | 44 | class PointIntersector2 : public osgUtil::PolytopeIntersector 45 | { 46 | public: 47 | PointIntersector2(const osg::Polytope& polytope) 48 | : PolytopeIntersector(MODEL, polytope), allPoints(NULL), allColors(NULL) {} 49 | PointIntersector2(CoordinateFrame cf, const osg::Polytope& polytope) 50 | : PolytopeIntersector(cf, polytope), allPoints(NULL), allColors(NULL) {} 51 | PointIntersector2(CoordinateFrame cf, double xMin, double yMin, double xMax, double yMax) 52 | : PolytopeIntersector(cf, xMin, yMin, xMax, yMax), allPoints(NULL), allColors(NULL) {} 53 | 54 | virtual Intersector* clone(osgUtil::IntersectionVisitor& iv); 55 | virtual void intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable); 56 | 57 | std::vector* allPoints; 58 | std::vector* allColors; 59 | 60 | protected: 61 | virtual ~PointIntersector2() {} 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed 7 | kUnityGfxRendererD3D9 = 1, // Direct3D 9 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 12 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 13 | kUnityGfxRendererGXM = 12, // PlayStation Vita 14 | kUnityGfxRendererPS4 = 13, // PlayStation 4 15 | kUnityGfxRendererXboxOne = 14, // Xbox One 16 | kUnityGfxRendererMetal = 16, // iOS Metal 17 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 18 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 19 | kUnityGfxRendererVulkan = 21, // Vulkan 20 | } UnityGfxRenderer; 21 | 22 | typedef enum UnityGfxDeviceEventType 23 | { 24 | kUnityGfxDeviceEventInitialize = 0, 25 | kUnityGfxDeviceEventShutdown = 1, 26 | kUnityGfxDeviceEventBeforeReset = 2, 27 | kUnityGfxDeviceEventAfterReset = 3, 28 | } UnityGfxDeviceEventType; 29 | 30 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 31 | 32 | // Should only be used on the rendering thread unless noted otherwise. 33 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 34 | { 35 | UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 36 | 37 | // This callback will be called when graphics device is created, destroyed, reset, etc. 38 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 39 | // when the graphics device is already created. 40 | void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 41 | void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 42 | }; 43 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics) 44 | 45 | 46 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 47 | // Provide them with an address to a function of this signature. 48 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 49 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityGraphicsD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | struct RenderSurfaceBase; 5 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 6 | 7 | // Should only be used on the rendering thread unless noted otherwise. 8 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) 9 | { 10 | ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); 11 | 12 | ID3D11Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 13 | }; 14 | UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL, 0xBF76967F07EFB177ULL, IUnityGraphicsD3D11) 15 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityGraphicsD3D12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | #ifndef __cplusplus 4 | #include 5 | #endif 6 | 7 | typedef struct UnityGraphicsD3D12ResourceState UnityGraphicsD3D12ResourceState; 8 | struct UnityGraphicsD3D12ResourceState 9 | { 10 | ID3D12Resource* resource; // Resource to barrier. 11 | D3D12_RESOURCE_STATES expected; // Expected resource state before this command list is executed. 12 | D3D12_RESOURCE_STATES current; // State this resource will be in after this command list is executed. 13 | }; 14 | 15 | typedef struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues UnityGraphicsD3D12PhysicalVideoMemoryControlValues; 16 | struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues // all values in bytes 17 | { 18 | UINT64 reservation; // Minimum required physical memory for an application [default = 64MB]. 19 | UINT64 systemMemoryThreshold; // If free physical video memory drops below this threshold, resources will be allocated in system memory. [default = 64MB] 20 | UINT64 residencyThreshold; // Minimum free physical video memory needed to start bringing evicted resources back after shrunken video memory budget expands again. [default = 128MB] 21 | }; 22 | 23 | // Should only be used on the rendering/submission thread. 24 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v4) 25 | { 26 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 27 | 28 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 29 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 30 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 31 | 32 | // Executes a given command list on a worker thread. 33 | // [Optional] Declares expected and post-execution resource states. 34 | // Returns the fence value. 35 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 36 | 37 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 38 | 39 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 40 | }; 41 | UNITY_REGISTER_INTERFACE_GUID(0X498FFCC13EC94006ULL, 0XB18F8B0FF67778C8ULL, IUnityGraphicsD3D12v4) 42 | 43 | // Should only be used on the rendering/submission thread. 44 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v3) 45 | { 46 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 47 | 48 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 49 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 50 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 51 | 52 | // Executes a given command list on a worker thread. 53 | // [Optional] Declares expected and post-execution resource states. 54 | // Returns the fence value. 55 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 56 | 57 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 58 | }; 59 | UNITY_REGISTER_INTERFACE_GUID(0x57C3FAFE59E5E843ULL, 0xBF4F5998474BB600ULL, IUnityGraphicsD3D12v3) 60 | 61 | // Should only be used on the rendering/submission thread. 62 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v2) 63 | { 64 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 65 | 66 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 67 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 68 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 69 | 70 | // Executes a given command list on a worker thread. 71 | // [Optional] Declares expected and post-execution resource states. 72 | // Returns the fence value. 73 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 74 | }; 75 | UNITY_REGISTER_INTERFACE_GUID(0xEC39D2F18446C745ULL, 0xB1A2626641D6B11FULL, IUnityGraphicsD3D12v2) 76 | 77 | 78 | // Obsolete 79 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) 80 | { 81 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 82 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 83 | 84 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 85 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 86 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 87 | 88 | // Returns the state a resource will be in after the last command list is executed 89 | bool(UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES * outState); 90 | // Specifies the state a resource will be in after a plugin command list with resource barriers is executed 91 | void(UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES state); 92 | }; 93 | UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL, 0xBD295B6F2A38D9DEULL, IUnityGraphicsD3D12) 94 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityGraphicsD3D9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) 6 | { 7 | IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); 8 | IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); 9 | }; 10 | UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL, 0xAC825B19B6F82AC3ULL, IUnityGraphicsD3D9) 11 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityGraphicsMetal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | #ifndef __OBJC__ 5 | #error metal plugin is objc code. 6 | #endif 7 | #ifndef __clang__ 8 | #error only clang compiler is supported. 9 | #endif 10 | 11 | @class NSBundle; 12 | @protocol MTLDevice; 13 | @protocol MTLCommandBuffer; 14 | @protocol MTLCommandEncoder; 15 | @protocol MTLTexture; 16 | 17 | struct RenderSurfaceBase; 18 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 19 | 20 | // Should only be used on the rendering thread unless noted otherwise. 21 | UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal) 22 | { 23 | NSBundle* (UNITY_INTERFACE_API * MetalBundle)(); 24 | id(UNITY_INTERFACE_API * MetalDevice)(); 25 | 26 | id(UNITY_INTERFACE_API * CurrentCommandBuffer)(); 27 | 28 | // for custom rendering support there are two scenarios: 29 | // you want to use current in-flight MTLCommandEncoder (NB: it might be nil) 30 | id(UNITY_INTERFACE_API * CurrentCommandEncoder)(); 31 | // or you might want to create your own encoder. 32 | // In that case you should end unity's encoder before creating your own and end yours before returning control to unity 33 | void(UNITY_INTERFACE_API * EndCurrentCommandEncoder)(); 34 | 35 | // converting trampoline UnityRenderBufferHandle into native RenderBuffer 36 | UnityRenderBuffer(UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle); 37 | 38 | // access to RenderBuffer's texure 39 | // NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr 40 | // AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer 41 | // StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer 42 | id(UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 43 | id(UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer); 44 | id(UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer); 45 | }; 46 | UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL, 0x9A62C4B5B9876117ULL, IUnityGraphicsMetal) 47 | -------------------------------------------------------------------------------- /NativePlugin/PluginsAPI/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | // IUnityInterface is a registry of interfaces we choose to expose to plugins. 22 | // 23 | // USAGE: 24 | // --------- 25 | // To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: 26 | // 27 | // IMyInterface * ptr = registry->Get(); 28 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 | 30 | // Unity Interface GUID 31 | // Ensures global uniqueness. 32 | // 33 | // Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. 34 | // The net result should compile down to passing around the GUID. 35 | // 36 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. 37 | // The interface structure and the registration GUID are all that is required to expose the interface to other systems. 38 | struct UnityInterfaceGUID 39 | { 40 | #ifdef __cplusplus 41 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 42 | : m_GUIDHigh(high) 43 | , m_GUIDLow(low) 44 | { 45 | } 46 | 47 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 48 | { 49 | m_GUIDHigh = other.m_GUIDHigh; 50 | m_GUIDLow = other.m_GUIDLow; 51 | } 52 | 53 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 54 | { 55 | m_GUIDHigh = other.m_GUIDHigh; 56 | m_GUIDLow = other.m_GUIDLow; 57 | return *this; 58 | } 59 | 60 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 61 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 62 | #endif 63 | unsigned long long m_GUIDHigh; 64 | unsigned long long m_GUIDLow; 65 | }; 66 | #ifdef __cplusplus 67 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 68 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 69 | inline bool operator<(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 70 | inline bool operator>(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 71 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator<(left, right); } 72 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator>(left, right); } 73 | #else 74 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 75 | #endif 76 | 77 | 78 | #ifdef __cplusplus 79 | #define UNITY_DECLARE_INTERFACE(NAME) \ 80 | struct NAME : IUnityInterface 81 | 82 | // Generic version of GetUnityInterfaceGUID to allow us to specialize it 83 | // per interface below. The generic version has no actual implementation 84 | // on purpose. 85 | // 86 | // If you get errors about return values related to this method then 87 | // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with 88 | // your interface, or it is not visible at some point when you are 89 | // trying to retrieve or add an interface. 90 | template 91 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); 92 | 93 | // This is the macro you provide in your public interface header 94 | // outside of a namespace to allow us to map between type and GUID 95 | // without the user having to worry about it when attempting to 96 | // add or retrieve and interface from the registry. 97 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 98 | template<> \ 99 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 100 | { \ 101 | return UnityInterfaceGUID(HASHH,HASHL); \ 102 | } 103 | 104 | // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in 105 | // a particular namespace. As long as the namespace is visible at the time you call 106 | // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template 107 | // calls this will work fine, only the macro here needs to have the additional parameter 108 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ 109 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 110 | template<> \ 111 | inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ 112 | { \ 113 | return UnityInterfaceGUID(HASHH,HASHL); \ 114 | } 115 | 116 | // These macros allow for C compatibility in user code. 117 | #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() 118 | 119 | 120 | #else 121 | #define UNITY_DECLARE_INTERFACE(NAME) \ 122 | typedef struct NAME NAME; \ 123 | struct NAME 124 | 125 | // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that 126 | // can see a header containing this constant. However, it's only for C compatibility and thus should have 127 | // minimal impact. 128 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 129 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 130 | 131 | // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are 132 | // not going to be usable from C. 133 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) 134 | 135 | // These macros allow for C compatibility in user code. 136 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 137 | #endif 138 | 139 | // Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where 140 | // this may be needed. Unity code itself does not need this. 141 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterfaceSplit (UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDHigh, UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDLow); 142 | 143 | 144 | #ifdef __cplusplus 145 | struct IUnityInterface 146 | { 147 | }; 148 | #else 149 | typedef void IUnityInterface; 150 | #endif 151 | 152 | 153 | typedef struct IUnityInterfaces 154 | { 155 | // Returns an interface matching the guid. 156 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 157 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 158 | 159 | // Registers a new interface. 160 | void(UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface * ptr); 161 | 162 | // Split APIs for C 163 | IUnityInterface* (UNITY_INTERFACE_API * GetInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow); 164 | void(UNITY_INTERFACE_API * RegisterInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow, IUnityInterface * ptr); 165 | 166 | #ifdef __cplusplus 167 | // Helper for GetInterface. 168 | template 169 | INTERFACE* Get() 170 | { 171 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 172 | } 173 | 174 | // Helper for RegisterInterface. 175 | template 176 | void Register(IUnityInterface* ptr) 177 | { 178 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 179 | } 180 | 181 | #endif 182 | } IUnityInterfaces; 183 | 184 | 185 | #ifdef __cplusplus 186 | extern "C" { 187 | #endif 188 | 189 | // If exported by a plugin, this function will be called when the plugin is loaded. 190 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 191 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 192 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | -------------------------------------------------------------------------------- /NativePlugin/UpdateDatabasePager.h: -------------------------------------------------------------------------------- 1 | #ifndef OSG_LOADER_UPDATEDATABASEPAGER_HPP 2 | #define OSG_LOADER_UPDATEDATABASEPAGER_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class DatabasePagerBridge : public osgDB::DatabasePager 15 | { 16 | public: 17 | virtual void updateSceneGraph(const osg::FrameStamp& frameStamp); 18 | void addLoadedDataToBridge(const osg::FrameStamp& frameStamp); 19 | void removeExpiredSubgraphsFromBridge(const osg::FrameStamp& frameStamp); 20 | }; 21 | 22 | class ExtendedPagedLOD : public osg::PagedLOD 23 | { 24 | public: 25 | ExtendedPagedLOD() : osg::PagedLOD(), lastTraversedChildID(-1) {} 26 | ExtendedPagedLOD(const osg::PagedLOD& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) 27 | : osg::PagedLOD(copy, copyop) {} 28 | 29 | virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, osg::NodeList& removedChildren); 30 | virtual void traverse(osg::NodeVisitor& nv); 31 | 32 | std::vector lastTraversedChildID; 33 | }; 34 | 35 | class SceneViewVisitor : public osg::NodeVisitor 36 | { 37 | public: 38 | SceneViewVisitor() : osg::NodeVisitor(CULL_VISITOR, TRAVERSE_ACTIVE_CHILDREN) 39 | { 40 | _viewport = new osg::Viewport; 41 | _pixelSizeVector.set(0.0f, 0.0f, 0.0f, 1.0f); _lodScale = 1.0f; 42 | } 43 | META_NodeVisitor("ManaVR", "SceneViewVisitor") 44 | 45 | void setEyePoint(const osg::Vec3& p) { _eye = p; } 46 | void setViewPoint(const osg::Vec3& p) { _viewPoint = p; } 47 | void setCameraUp(const osg::Vec3& p) { _up = p; } 48 | const osg::Vec3& getCameraUp() const { return _up; } 49 | 50 | void setLODScale(float v) { _lodScale = v; } 51 | float getLODScale() const { return _lodScale; } 52 | 53 | void computePixelSizeVector(float width, float height, const osg::Matrix& P, const osg::Matrix& M) 54 | { 55 | _viewport->width() = width; _viewport->height() = height; 56 | _pixelSizeVector = osg::CullingSet::computePixelSizeVector(*_viewport, P, M); 57 | } 58 | 59 | float clampedPixelSize(const osg::BoundingSphere& bs) 60 | { return fabs(bs.radius() / (bs.center() * _pixelSizeVector)); } 61 | 62 | virtual osg::Vec3 getEyePoint() const { return _eye; } 63 | virtual osg::Vec3 getViewPoint() const { return _viewPoint; } 64 | virtual void reset() {} 65 | 66 | virtual float getDistanceToEyePoint(const osg::Vec3& pos, bool useLODScale) const 67 | { 68 | if (useLODScale) return (pos- _eye).length() * getLODScale(); 69 | else return (pos - _eye).length(); 70 | } 71 | 72 | virtual float getDistanceToViewPoint(const osg::Vec3& pos, bool useLODScale) const 73 | { 74 | if (useLODScale) return (pos - _eye).length() * getLODScale(); 75 | else return (pos - _eye).length(); 76 | } 77 | 78 | virtual float getDistanceFromEyePoint(const osg::Vec3& pos, bool useLODScale) const 79 | { /*NOT IMPLEMENTED*/return 0.0f; } 80 | 81 | protected: 82 | osg::ref_ptr _viewport; 83 | osg::Vec3 _eye, _viewPoint, _up; 84 | osg::Vec4 _pixelSizeVector; 85 | float _lodScale; 86 | }; 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.17.7", 4 | "com.unity.ide.rider": "3.0.16", 5 | "com.unity.ide.visualstudio": "2.0.16", 6 | "com.unity.ide.vscode": "1.2.5", 7 | "com.unity.test-framework": "1.1.31", 8 | "com.unity.textmeshpro": "3.0.6", 9 | "com.unity.timeline": "1.6.4", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": { 4 | "version": "1.17.7", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.services.core": "1.0.1" 9 | }, 10 | "url": "https://packages.unity.cn" 11 | }, 12 | "com.unity.ext.nunit": { 13 | "version": "1.0.6", 14 | "depth": 1, 15 | "source": "registry", 16 | "dependencies": {}, 17 | "url": "https://packages.unity.cn" 18 | }, 19 | "com.unity.ide.rider": { 20 | "version": "3.0.16", 21 | "depth": 0, 22 | "source": "registry", 23 | "dependencies": { 24 | "com.unity.ext.nunit": "1.0.6" 25 | }, 26 | "url": "https://packages.unity.cn" 27 | }, 28 | "com.unity.ide.visualstudio": { 29 | "version": "2.0.16", 30 | "depth": 0, 31 | "source": "registry", 32 | "dependencies": { 33 | "com.unity.test-framework": "1.1.9" 34 | }, 35 | "url": "https://packages.unity.cn" 36 | }, 37 | "com.unity.ide.vscode": { 38 | "version": "1.2.5", 39 | "depth": 0, 40 | "source": "registry", 41 | "dependencies": {}, 42 | "url": "https://packages.unity.cn" 43 | }, 44 | "com.unity.nuget.newtonsoft-json": { 45 | "version": "3.0.2", 46 | "depth": 2, 47 | "source": "registry", 48 | "dependencies": {}, 49 | "url": "https://packages.unity.cn" 50 | }, 51 | "com.unity.services.core": { 52 | "version": "1.6.0", 53 | "depth": 1, 54 | "source": "registry", 55 | "dependencies": { 56 | "com.unity.modules.unitywebrequest": "1.0.0", 57 | "com.unity.nuget.newtonsoft-json": "3.0.2", 58 | "com.unity.modules.androidjni": "1.0.0" 59 | }, 60 | "url": "https://packages.unity.cn" 61 | }, 62 | "com.unity.test-framework": { 63 | "version": "1.1.31", 64 | "depth": 0, 65 | "source": "registry", 66 | "dependencies": { 67 | "com.unity.ext.nunit": "1.0.6", 68 | "com.unity.modules.imgui": "1.0.0", 69 | "com.unity.modules.jsonserialize": "1.0.0" 70 | }, 71 | "url": "https://packages.unity.cn" 72 | }, 73 | "com.unity.textmeshpro": { 74 | "version": "3.0.6", 75 | "depth": 0, 76 | "source": "registry", 77 | "dependencies": { 78 | "com.unity.ugui": "1.0.0" 79 | }, 80 | "url": "https://packages.unity.cn" 81 | }, 82 | "com.unity.timeline": { 83 | "version": "1.6.4", 84 | "depth": 0, 85 | "source": "registry", 86 | "dependencies": { 87 | "com.unity.modules.director": "1.0.0", 88 | "com.unity.modules.animation": "1.0.0", 89 | "com.unity.modules.audio": "1.0.0", 90 | "com.unity.modules.particlesystem": "1.0.0" 91 | }, 92 | "url": "https://packages.unity.cn" 93 | }, 94 | "com.unity.ugui": { 95 | "version": "1.0.0", 96 | "depth": 0, 97 | "source": "builtin", 98 | "dependencies": { 99 | "com.unity.modules.ui": "1.0.0", 100 | "com.unity.modules.imgui": "1.0.0" 101 | } 102 | }, 103 | "com.unity.modules.ai": { 104 | "version": "1.0.0", 105 | "depth": 0, 106 | "source": "builtin", 107 | "dependencies": {} 108 | }, 109 | "com.unity.modules.androidjni": { 110 | "version": "1.0.0", 111 | "depth": 0, 112 | "source": "builtin", 113 | "dependencies": {} 114 | }, 115 | "com.unity.modules.animation": { 116 | "version": "1.0.0", 117 | "depth": 0, 118 | "source": "builtin", 119 | "dependencies": {} 120 | }, 121 | "com.unity.modules.assetbundle": { 122 | "version": "1.0.0", 123 | "depth": 0, 124 | "source": "builtin", 125 | "dependencies": {} 126 | }, 127 | "com.unity.modules.audio": { 128 | "version": "1.0.0", 129 | "depth": 0, 130 | "source": "builtin", 131 | "dependencies": {} 132 | }, 133 | "com.unity.modules.cloth": { 134 | "version": "1.0.0", 135 | "depth": 0, 136 | "source": "builtin", 137 | "dependencies": { 138 | "com.unity.modules.physics": "1.0.0" 139 | } 140 | }, 141 | "com.unity.modules.director": { 142 | "version": "1.0.0", 143 | "depth": 0, 144 | "source": "builtin", 145 | "dependencies": { 146 | "com.unity.modules.audio": "1.0.0", 147 | "com.unity.modules.animation": "1.0.0" 148 | } 149 | }, 150 | "com.unity.modules.imageconversion": { 151 | "version": "1.0.0", 152 | "depth": 0, 153 | "source": "builtin", 154 | "dependencies": {} 155 | }, 156 | "com.unity.modules.imgui": { 157 | "version": "1.0.0", 158 | "depth": 0, 159 | "source": "builtin", 160 | "dependencies": {} 161 | }, 162 | "com.unity.modules.jsonserialize": { 163 | "version": "1.0.0", 164 | "depth": 0, 165 | "source": "builtin", 166 | "dependencies": {} 167 | }, 168 | "com.unity.modules.particlesystem": { 169 | "version": "1.0.0", 170 | "depth": 0, 171 | "source": "builtin", 172 | "dependencies": {} 173 | }, 174 | "com.unity.modules.physics": { 175 | "version": "1.0.0", 176 | "depth": 0, 177 | "source": "builtin", 178 | "dependencies": {} 179 | }, 180 | "com.unity.modules.physics2d": { 181 | "version": "1.0.0", 182 | "depth": 0, 183 | "source": "builtin", 184 | "dependencies": {} 185 | }, 186 | "com.unity.modules.screencapture": { 187 | "version": "1.0.0", 188 | "depth": 0, 189 | "source": "builtin", 190 | "dependencies": { 191 | "com.unity.modules.imageconversion": "1.0.0" 192 | } 193 | }, 194 | "com.unity.modules.subsystems": { 195 | "version": "1.0.0", 196 | "depth": 1, 197 | "source": "builtin", 198 | "dependencies": { 199 | "com.unity.modules.jsonserialize": "1.0.0" 200 | } 201 | }, 202 | "com.unity.modules.terrain": { 203 | "version": "1.0.0", 204 | "depth": 0, 205 | "source": "builtin", 206 | "dependencies": {} 207 | }, 208 | "com.unity.modules.terrainphysics": { 209 | "version": "1.0.0", 210 | "depth": 0, 211 | "source": "builtin", 212 | "dependencies": { 213 | "com.unity.modules.physics": "1.0.0", 214 | "com.unity.modules.terrain": "1.0.0" 215 | } 216 | }, 217 | "com.unity.modules.tilemap": { 218 | "version": "1.0.0", 219 | "depth": 0, 220 | "source": "builtin", 221 | "dependencies": { 222 | "com.unity.modules.physics2d": "1.0.0" 223 | } 224 | }, 225 | "com.unity.modules.ui": { 226 | "version": "1.0.0", 227 | "depth": 0, 228 | "source": "builtin", 229 | "dependencies": {} 230 | }, 231 | "com.unity.modules.uielements": { 232 | "version": "1.0.0", 233 | "depth": 0, 234 | "source": "builtin", 235 | "dependencies": { 236 | "com.unity.modules.ui": "1.0.0", 237 | "com.unity.modules.imgui": "1.0.0", 238 | "com.unity.modules.jsonserialize": "1.0.0", 239 | "com.unity.modules.uielementsnative": "1.0.0" 240 | } 241 | }, 242 | "com.unity.modules.uielementsnative": { 243 | "version": "1.0.0", 244 | "depth": 1, 245 | "source": "builtin", 246 | "dependencies": { 247 | "com.unity.modules.ui": "1.0.0", 248 | "com.unity.modules.imgui": "1.0.0", 249 | "com.unity.modules.jsonserialize": "1.0.0" 250 | } 251 | }, 252 | "com.unity.modules.umbra": { 253 | "version": "1.0.0", 254 | "depth": 0, 255 | "source": "builtin", 256 | "dependencies": {} 257 | }, 258 | "com.unity.modules.unityanalytics": { 259 | "version": "1.0.0", 260 | "depth": 0, 261 | "source": "builtin", 262 | "dependencies": { 263 | "com.unity.modules.unitywebrequest": "1.0.0", 264 | "com.unity.modules.jsonserialize": "1.0.0" 265 | } 266 | }, 267 | "com.unity.modules.unitywebrequest": { 268 | "version": "1.0.0", 269 | "depth": 0, 270 | "source": "builtin", 271 | "dependencies": {} 272 | }, 273 | "com.unity.modules.unitywebrequestassetbundle": { 274 | "version": "1.0.0", 275 | "depth": 0, 276 | "source": "builtin", 277 | "dependencies": { 278 | "com.unity.modules.assetbundle": "1.0.0", 279 | "com.unity.modules.unitywebrequest": "1.0.0" 280 | } 281 | }, 282 | "com.unity.modules.unitywebrequestaudio": { 283 | "version": "1.0.0", 284 | "depth": 0, 285 | "source": "builtin", 286 | "dependencies": { 287 | "com.unity.modules.unitywebrequest": "1.0.0", 288 | "com.unity.modules.audio": "1.0.0" 289 | } 290 | }, 291 | "com.unity.modules.unitywebrequesttexture": { 292 | "version": "1.0.0", 293 | "depth": 0, 294 | "source": "builtin", 295 | "dependencies": { 296 | "com.unity.modules.unitywebrequest": "1.0.0", 297 | "com.unity.modules.imageconversion": "1.0.0" 298 | } 299 | }, 300 | "com.unity.modules.unitywebrequestwww": { 301 | "version": "1.0.0", 302 | "depth": 0, 303 | "source": "builtin", 304 | "dependencies": { 305 | "com.unity.modules.unitywebrequest": "1.0.0", 306 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 307 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 308 | "com.unity.modules.audio": "1.0.0", 309 | "com.unity.modules.assetbundle": "1.0.0", 310 | "com.unity.modules.imageconversion": "1.0.0" 311 | } 312 | }, 313 | "com.unity.modules.vehicles": { 314 | "version": "1.0.0", 315 | "depth": 0, 316 | "source": "builtin", 317 | "dependencies": { 318 | "com.unity.modules.physics": "1.0.0" 319 | } 320 | }, 321 | "com.unity.modules.video": { 322 | "version": "1.0.0", 323 | "depth": 0, 324 | "source": "builtin", 325 | "dependencies": { 326 | "com.unity.modules.audio": "1.0.0", 327 | "com.unity.modules.ui": "1.0.0", 328 | "com.unity.modules.unitywebrequest": "1.0.0" 329 | } 330 | }, 331 | "com.unity.modules.vr": { 332 | "version": "1.0.0", 333 | "depth": 0, 334 | "source": "builtin", 335 | "dependencies": { 336 | "com.unity.modules.jsonserialize": "1.0.0", 337 | "com.unity.modules.physics": "1.0.0", 338 | "com.unity.modules.xr": "1.0.0" 339 | } 340 | }, 341 | "com.unity.modules.wind": { 342 | "version": "1.0.0", 343 | "depth": 0, 344 | "source": "builtin", 345 | "dependencies": {} 346 | }, 347 | "com.unity.modules.xr": { 348 | "version": "1.0.0", 349 | "depth": 0, 350 | "source": "builtin", 351 | "dependencies": { 352 | "com.unity.modules.physics": "1.0.0", 353 | "com.unity.modules.jsonserialize": "1.0.0", 354 | "com.unity.modules.subsystems": "1.0.0" 355 | } 356 | } 357 | } 358 | } 359 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/AutoStreamingSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1200 &1 4 | AutoStreamingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | mSearchMode: 15 8 | mCustomSearchFile: 9 | mTextureSearchString: 10 | mMeshSearchString: 11 | mTextures: [] 12 | mAudios: [] 13 | mMeshes: [] 14 | mScenes: [] 15 | mConfigCCD: 16 | useCCD: 0 17 | cosKey: 18 | projectGuid: 19 | bucketUuid: 20 | bucketName: 21 | badgeName: 22 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.cn 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_ConfigSource: 0 29 | m_UserSelectedRegistryName: 30 | m_UserAddingNewScopedRegistry: 0 31 | m_RegistryInfoDraft: 32 | m_Modified: 0 33 | m_ErrorMessage: 34 | m_UserModificationsInstanceId: -852 35 | m_OriginalInstanceId: -854 36 | m_LoadAssets: 0 37 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.3.16f1c1 2 | m_EditorVersionWithRevision: 2021.3.16f1c1 (56dbfdd6697f) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Stadia: 5 227 | Standalone: 5 228 | WebGL: 3 229 | Windows Store Apps: 5 230 | XboxOne: 5 231 | iPhone: 2 232 | tvOS: 2 233 | -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "ignore": false, 8 | "defaultInstantiationMode": 0, 9 | "supportsModification": true 10 | }, 11 | { 12 | "userAdded": false, 13 | "type": "UnityEditor.Animations.AnimatorController", 14 | "ignore": false, 15 | "defaultInstantiationMode": 0, 16 | "supportsModification": true 17 | }, 18 | { 19 | "userAdded": false, 20 | "type": "UnityEngine.AnimatorOverrideController", 21 | "ignore": false, 22 | "defaultInstantiationMode": 0, 23 | "supportsModification": true 24 | }, 25 | { 26 | "userAdded": false, 27 | "type": "UnityEditor.Audio.AudioMixerController", 28 | "ignore": false, 29 | "defaultInstantiationMode": 0, 30 | "supportsModification": true 31 | }, 32 | { 33 | "userAdded": false, 34 | "type": "UnityEngine.ComputeShader", 35 | "ignore": true, 36 | "defaultInstantiationMode": 1, 37 | "supportsModification": true 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEngine.Cubemap", 42 | "ignore": false, 43 | "defaultInstantiationMode": 0, 44 | "supportsModification": true 45 | }, 46 | { 47 | "userAdded": false, 48 | "type": "UnityEngine.GameObject", 49 | "ignore": false, 50 | "defaultInstantiationMode": 0, 51 | "supportsModification": true 52 | }, 53 | { 54 | "userAdded": false, 55 | "type": "UnityEditor.LightingDataAsset", 56 | "ignore": false, 57 | "defaultInstantiationMode": 0, 58 | "supportsModification": false 59 | }, 60 | { 61 | "userAdded": false, 62 | "type": "UnityEngine.LightingSettings", 63 | "ignore": false, 64 | "defaultInstantiationMode": 0, 65 | "supportsModification": true 66 | }, 67 | { 68 | "userAdded": false, 69 | "type": "UnityEngine.Material", 70 | "ignore": false, 71 | "defaultInstantiationMode": 0, 72 | "supportsModification": true 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEditor.MonoScript", 77 | "ignore": true, 78 | "defaultInstantiationMode": 1, 79 | "supportsModification": true 80 | }, 81 | { 82 | "userAdded": false, 83 | "type": "UnityEngine.PhysicMaterial", 84 | "ignore": false, 85 | "defaultInstantiationMode": 0, 86 | "supportsModification": true 87 | }, 88 | { 89 | "userAdded": false, 90 | "type": "UnityEngine.PhysicsMaterial2D", 91 | "ignore": false, 92 | "defaultInstantiationMode": 0, 93 | "supportsModification": true 94 | }, 95 | { 96 | "userAdded": false, 97 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 98 | "ignore": false, 99 | "defaultInstantiationMode": 0, 100 | "supportsModification": true 101 | }, 102 | { 103 | "userAdded": false, 104 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 105 | "ignore": false, 106 | "defaultInstantiationMode": 0, 107 | "supportsModification": true 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Rendering.VolumeProfile", 112 | "ignore": false, 113 | "defaultInstantiationMode": 0, 114 | "supportsModification": true 115 | }, 116 | { 117 | "userAdded": false, 118 | "type": "UnityEditor.SceneAsset", 119 | "ignore": false, 120 | "defaultInstantiationMode": 0, 121 | "supportsModification": false 122 | }, 123 | { 124 | "userAdded": false, 125 | "type": "UnityEngine.Shader", 126 | "ignore": true, 127 | "defaultInstantiationMode": 1, 128 | "supportsModification": true 129 | }, 130 | { 131 | "userAdded": false, 132 | "type": "UnityEngine.ShaderVariantCollection", 133 | "ignore": true, 134 | "defaultInstantiationMode": 1, 135 | "supportsModification": true 136 | }, 137 | { 138 | "userAdded": false, 139 | "type": "UnityEngine.Texture", 140 | "ignore": false, 141 | "defaultInstantiationMode": 0, 142 | "supportsModification": true 143 | }, 144 | { 145 | "userAdded": false, 146 | "type": "UnityEngine.Texture2D", 147 | "ignore": false, 148 | "defaultInstantiationMode": 0, 149 | "supportsModification": true 150 | }, 151 | { 152 | "userAdded": false, 153 | "type": "UnityEngine.Timeline.TimelineAsset", 154 | "ignore": false, 155 | "defaultInstantiationMode": 0, 156 | "supportsModification": true 157 | } 158 | ], 159 | "defaultDependencyTypeInfo": { 160 | "userAdded": false, 161 | "type": "", 162 | "ignore": false, 163 | "defaultInstantiationMode": 1, 164 | "supportsModification": true 165 | }, 166 | "newSceneOverride": 0 167 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /ProjectSettings/boot.config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/UnityOSGB/8599f601fc38f6a99893d2b500d2fdf65c01f61a/ProjectSettings/boot.config -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnityOSGB 2 | Load OSGB format into Unity in two ways: native plugin & c# binary reader 3 | -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedSceneGuid-0: 9 | value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a 10 | flags: 0 11 | vcSharedLogLevel: 12 | value: 0d5e400f0650 13 | flags: 0 14 | m_VCAutomaticAdd: 1 15 | m_VCDebugCom: 0 16 | m_VCDebugCmd: 0 17 | m_VCDebugOut: 0 18 | m_SemanticMergeMode: 2 19 | m_DesiredImportWorkerCount: 4 20 | m_StandbyImportWorkerCount: 2 21 | m_IdleImportWorkerShutdownDelay: 60000 22 | m_VCShowFailedCheckout: 1 23 | m_VCOverwriteFailedCheckoutAssets: 1 24 | m_VCProjectOverlayIcons: 1 25 | m_VCHierarchyOverlayIcons: 1 26 | m_VCOtherOverlayIcons: 1 27 | m_VCAllowAsyncUpdate: 0 28 | m_ArtifactGarbageCollection: 1 29 | --------------------------------------------------------------------------------