diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..72c60f4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# Change Log + +## [1.0.0] - 2020-08-07 +Initial release. diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..da61d02 --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: de40421f0a20e354889cf7c8f5674355 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..128ee79 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Izayoi Jiichan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 0000000..2978648 --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 18f195aad8869974684774c7c64c960a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md new file mode 100644 index 0000000..d488e9d --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# VgoGltf + +VgoGltf is the basic and common definition of glTF. + +___ +## Storage + +- GltfHeader +- GltfChunk + +## Buffers + +- IByteBuffer +- ArraySegmentByteBuffer +- ReadOnlyArraySegmentByteBuffer + +## Enums + +- WebGL + - GltfBufferViewTarget + - GltfComponentType + - GltfCullFaceMode + - GltfMeshPrimitiveMode + - GltfTextureMagFilterMode + - GltfTextureMinFilterMode + - GltfTextureTarget + - GltfTextureWrapMode +- EnumString + - GltfAccessorType + - GltfAlphaMode + - GltfAnimationChannelPath + - GltfAnimationInterpolationType + - GltfCameraProjectionType + +## Structs + +- Color3 +- Color4 +- Matrix2 +- Matrix3 +- Vector4Uint +- Vector4Ushort + +## Framework + +- .NET Standard 2.0 +- .NET Framework 4.7 + +___ +Last updated: 7 August, 2020 +Editor: Izayoi Jiichan + +*Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.* diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..85e5c53 --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 627c994c39dadbf4185d555b568157be +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime.meta b/Runtime.meta new file mode 100644 index 0000000..3d6d8b9 --- /dev/null +++ b/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0267ca8b5832a1540ac51b02a96c0fef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Buffers.meta b/Runtime/Buffers.meta new file mode 100644 index 0000000..c1be831 --- /dev/null +++ b/Runtime/Buffers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8caaaec02279c4e4484d3be3e02a8603 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Buffers/ArraySegmentByteBuffer.cs b/Runtime/Buffers/ArraySegmentByteBuffer.cs new file mode 100644 index 0000000..3187c05 --- /dev/null +++ b/Runtime/Buffers/ArraySegmentByteBuffer.cs @@ -0,0 +1,196 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf.Buffers +// @Class : ArraySegmentByteBuffer +// ---------------------------------------------------------------------- +namespace VgoGltf.Buffers +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Array Segment Byte Buffer + /// + public class ArraySegmentByteBuffer : IByteBuffer + { + #region Fields + + /// The bytes in the buffer. + protected byte[] _Bytes; + + /// The default byte size to extend when the buffer runs out of size. + protected readonly int _DefaultExtendSize = 10 * 1024; + + #endregion + + #region Properties + + /// Gets or sets the number of bytes allocated for this buffer. + public int Capacity { get; private set; } + + /// Gets or sets the current length of the buffer in bytes. + public int Length { get; private set; } + + /// Gets the maximum capacity of this instance. + public int MaxCapacity { get; } = 2 * 1024 * 1024; + + #endregion + + #region Constructors + + /// + /// Create a new instance of ArraySegmentByteBuffer with capacity. + /// + /// Specifies the initial size of the buffer. + public ArraySegmentByteBuffer(int capacity) + { + if (capacity <= 0) + { + throw new ArgumentOutOfRangeException(nameof(capacity)); + } + + _Bytes = new byte[capacity]; + + Length = _Bytes.Length; + + Capacity = capacity; + } + + #endregion + + #region Public Methods + + /// + /// Appends data to the buffer. + /// + /// + /// + /// + /// Returns the size of the appended data. + public int Append(ArraySegment data, int stride = 0) where T : struct + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + if (data.Count == 0) + { + throw new ArgumentException(nameof(data)); + } + + int perDataSize = Marshal.SizeOf(typeof(T)); + + if (stride == 0) + { + stride = perDataSize; + } + else if (stride < 0) + { + throw new ArgumentOutOfRangeException(nameof(stride)); + } + else if (stride < perDataSize) + { + throw new InvalidOperationException(); + } + + int dataCount = data.Count; + + int dataSize = stride * dataCount; + + ExtendBufferIfNecessary(dataSize); + + if (stride == perDataSize) + { + using (Pin pin = Pin.Create(data)) + { + Marshal.Copy(pin.Ptr, _Bytes, Length, dataSize); + } + + Length += dataSize; + + return dataSize; + } + else + { + int start = Length; + + for (int index = 0; index < dataCount; index++) + { + ArraySegment src = new ArraySegment(data.Array, data.Offset + index, perDataSize); + + using (Pin pin = Pin.Create(src)) + { + Marshal.Copy(pin.Ptr, _Bytes, start + index * stride, perDataSize); + } + } + + Length += dataSize; + + return dataSize; + } + } + + /// + /// Get the used byte data in the buffer. + /// + /// Returns the used byte data. + public ArraySegment GetBytes() + { + //if (m_bytes == null) + //{ + // return new ArraySegment(); + //} + return new ArraySegment(_Bytes, 0, Length); + } + + /// + /// Writes the buffer data to a byte array. + /// + /// A new byte array. + public byte[] ToArray() + { + byte[] destinationArray = new byte[Length]; + + Array.Copy(sourceArray: _Bytes, destinationArray, Length); + + return destinationArray; + } + + #endregion + + #region Private Methods + + /// + /// Extend the buffer if necessary. + /// + /// The data size to be written. + private void ExtendBufferIfNecessary(int dataSizeToWrite) + { + if (Length + dataSizeToWrite > Capacity) + { + int extendSize = (dataSizeToWrite > _DefaultExtendSize) ? dataSizeToWrite : _DefaultExtendSize; + + ExtendBuffer(extendSize); + } + } + + /// + /// Extend the buffer. + /// + /// The size to extend. + private void ExtendBuffer(int extendSize) + { + int newCapacity = Length + extendSize; + + byte[] newBuffer = new byte[newCapacity]; + + Buffer.BlockCopy(_Bytes, 0, newBuffer, 0, Length); + + _Bytes = newBuffer; + + Capacity = newCapacity; + } + + #endregion + } +} \ No newline at end of file diff --git a/Runtime/Buffers/ArraySegmentByteBuffer.cs.meta b/Runtime/Buffers/ArraySegmentByteBuffer.cs.meta new file mode 100644 index 0000000..e6af9bd --- /dev/null +++ b/Runtime/Buffers/ArraySegmentByteBuffer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f74819af1e2367b458024dc55aa058b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Buffers/IByteBuffer.cs b/Runtime/Buffers/IByteBuffer.cs new file mode 100644 index 0000000..2ad9168 --- /dev/null +++ b/Runtime/Buffers/IByteBuffer.cs @@ -0,0 +1,49 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf.Buffers +// @Class : IByteBuffer +// ---------------------------------------------------------------------- +namespace VgoGltf.Buffers +{ + using System; + + /// + /// ByteBuffer Interface + /// + public interface IByteBuffer + { + #region Properties + + /// Gets or sets the number of bytes allocated for this buffer. + int Capacity { get; } + + /// Gets or sets the current length of the buffer in bytes. + int Length { get; } + + #endregion + + #region Public Methods + + /// + /// Appends data to the buffer. + /// + /// + /// + /// + /// Returns the size of the appended data. + int Append(ArraySegment data, int stride = 0) where T : struct; + + /// + /// Get the used byte data in the buffer. + /// + /// Returns the used byte data. + ArraySegment GetBytes(); + + /// + /// Writes the buffer data to a byte array. + /// + /// A new byte array. + byte[] ToArray(); + + #endregion + } +} diff --git a/Runtime/Buffers/IByteBuffer.cs.meta b/Runtime/Buffers/IByteBuffer.cs.meta new file mode 100644 index 0000000..aa2d978 --- /dev/null +++ b/Runtime/Buffers/IByteBuffer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 235b1ea94557fc6448772ad5c4586e78 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Buffers/Pin.cs b/Runtime/Buffers/Pin.cs new file mode 100644 index 0000000..b1de1cb --- /dev/null +++ b/Runtime/Buffers/Pin.cs @@ -0,0 +1,104 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf.Buffers +// @Class : Pin +// ---------------------------------------------------------------------- +namespace VgoGltf.Buffers +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Pin + /// + public static class Pin + { + /// + /// Create a Pin for the specified source. + /// + /// + /// + /// + public static Pin Create(ArraySegment src) where T : struct + { + return new Pin(src); + } + + /// + /// Create a Pin for the specified source. + /// + /// + /// + /// + public static Pin Create(T[] src) where T : struct + { + return new Pin(new ArraySegment(src)); + } + } + + /// + /// Pin + /// + /// + public class Pin : IDisposable where T : struct + { + /// + /// Create a new instance of Pin with src. + /// + /// + public Pin(ArraySegment src) + { + this.src = src; + pinnedArray = GCHandle.Alloc(src.Array, GCHandleType.Pinned); + } + + //~Pin() + //{ + // Dispose(false); + //} + + /// + protected bool disposedValue = false; + + /// + protected ArraySegment src; + + /// + protected GCHandle pinnedArray; + + /// + public int Length => src.Count * Marshal.SizeOf(typeof(T)); + + /// + public IntPtr Ptr => new IntPtr(pinnedArray.AddrOfPinnedObject().ToInt64() + src.Offset); + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + Dispose(true); + // GC.SuppressFinalize(this); + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposedValue == false) + { + if (disposing) + { + } + + if (pinnedArray.IsAllocated) + { + pinnedArray.Free(); + } + + disposedValue = true; + } + } + } +} diff --git a/Runtime/Buffers/Pin.cs.meta b/Runtime/Buffers/Pin.cs.meta new file mode 100644 index 0000000..c6c5cb4 --- /dev/null +++ b/Runtime/Buffers/Pin.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0de7606cddb41004eab6632f4dbef995 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs b/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs new file mode 100644 index 0000000..6bed06c --- /dev/null +++ b/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs @@ -0,0 +1,84 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf.Buffers +// @Class : ReadOnlyArraySegmentByteBuffer +// ---------------------------------------------------------------------- +namespace VgoGltf.Buffers +{ + using System; + + /// + /// Read only Array Segment Byte Buffer + /// + public class ReadOnlyArraySegmentByteBuffer : IByteBuffer + { + #region Fields + + /// The bytes in the buffer. + private readonly ArraySegment _Bytes; + + #endregion + + #region Properties + + /// Gets or sets the number of bytes allocated for this buffer. + public int Capacity => _Bytes.Count; + + /// Gets or sets the current length of the buffer in bytes. + public int Length { get; private set; } + + #endregion + + #region Constructors + + /// + /// Create a new instance of ReadOnlyArraySegmentByteBuffer with bytes. + /// + /// The data to store in the buffer. + public ReadOnlyArraySegmentByteBuffer(ArraySegment bytes) + { + _Bytes = bytes; + + Length = bytes.Count; + } + + #endregion + + #region Public Methods + + /// + /// Appends data to the buffer. + /// + /// + /// + /// + /// Returns the size of the appended data. + public int Append(ArraySegment data, int stride = 0) where T : struct + { + throw new NotImplementedException(); + } + + /// + /// Get the used byte data in the buffer. + /// + /// Returns the used byte data. + public ArraySegment GetBytes() + { + return _Bytes; + } + + /// + /// Writes the buffer data to a byte array. + /// + /// A new byte array. + public byte[] ToArray() + { + byte[] destinationArray = new byte[_Bytes.Count]; + + Array.Copy(sourceArray: _Bytes.Array, _Bytes.Offset, destinationArray, 0, _Bytes.Count); + + return destinationArray; + } + + #endregion + } +} \ No newline at end of file diff --git a/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs.meta b/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs.meta new file mode 100644 index 0000000..717fb67 --- /dev/null +++ b/Runtime/Buffers/ReadOnlyArraySegmentByteBuffer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba318b72f4029014ab2dfcfe72553cfb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Defines.meta b/Runtime/Defines.meta new file mode 100644 index 0000000..cf08206 --- /dev/null +++ b/Runtime/Defines.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 191a85bc607ef46488618480d2a1f751 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Defines/VertexKey.cs b/Runtime/Defines/VertexKey.cs new file mode 100644 index 0000000..63d9683 --- /dev/null +++ b/Runtime/Defines/VertexKey.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : VertexKey +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The vertex key name of mesh primitives. + public class VertexKey + { + /// POSITION + public const string Position = "POSITION"; + + /// NORMAL + public const string Normal = "NORMAL"; + + /// TANGENT + public const string Tangent = "TANGENT"; + + /// COLOR_0 + public const string Color0 = "COLOR_0"; + + /// COLOR_N + public const string ColorFormat = "COLOR_{0}"; + + /// TEXCOORD_0 + public const string TexCoord0 = "TEXCOORD_0"; + + /// TEXCOORD_1 + public const string TexCoord1 = "TEXCOORD_1"; + + /// TEXCOORD_2 + public const string TexCoord2 = "TEXCOORD_2"; + + /// TEXCOORD_3 + public const string TexCoord3 = "TEXCOORD_3"; + + /// TEXCOORD_N + public const string TexCoordFormat = "TEXCOORD_{0}"; + + /// JOINTS_0 + public const string Joints0 = "JOINTS_0"; + + /// JOINTS_N + public const string JointsFormat = "JOINTS_{0}"; + + /// WEIGHTS_0 + public const string Weights0 = "WEIGHTS_0"; + + /// WEIGHTS_N + public const string WeightsFormat = "WEIGHTS_{0}"; + } +} diff --git a/Runtime/Defines/VertexKey.cs.meta b/Runtime/Defines/VertexKey.cs.meta new file mode 100644 index 0000000..44428e9 --- /dev/null +++ b/Runtime/Defines/VertexKey.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 632eb10af60513f478e78f93589498d1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums.meta b/Runtime/Enums.meta new file mode 100644 index 0000000..42addb3 --- /dev/null +++ b/Runtime/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 447e8a1558b3923449083a962557bf20 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings.meta b/Runtime/Enums/EnumStrings.meta new file mode 100644 index 0000000..a88b22b --- /dev/null +++ b/Runtime/Enums/EnumStrings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2869a27ed0a9ca419acfdae39c37ddf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings/GltfAccessorType.cs b/Runtime/Enums/EnumStrings/GltfAccessorType.cs new file mode 100644 index 0000000..2c37d69 --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAccessorType.cs @@ -0,0 +1,25 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfAccessorType +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Accessor Type + public enum GltfAccessorType + { + /// Scalar + SCALAR, + /// Vector2 + VEC2, + /// Vector3 + VEC3, + /// Vector4 + VEC4, + /// Matrix2x2 + MAT2, + /// Matrix3x3 + MAT3, + /// Matrix4x4 + MAT4, + } +} diff --git a/Runtime/Enums/EnumStrings/GltfAccessorType.cs.meta b/Runtime/Enums/EnumStrings/GltfAccessorType.cs.meta new file mode 100644 index 0000000..1f4f7c2 --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAccessorType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e7b2dadada3049342baf96fad6dcc744 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings/GltfAlphaMode.cs b/Runtime/Enums/EnumStrings/GltfAlphaMode.cs new file mode 100644 index 0000000..d5be51e --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAlphaMode.cs @@ -0,0 +1,20 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfAlphaMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The alpha mode. + public enum GltfAlphaMode + { + /// The alpha value is ignored and the rendered output is fully opaque. + OPAQUE = 0, + /// The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value. + MASK, + /// The alpha value is used to composite the source and destination areas. + /// The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator). + BLEND, + /// MToon + BLEND_ZWRITE, + } +} diff --git a/Runtime/Enums/EnumStrings/GltfAlphaMode.cs.meta b/Runtime/Enums/EnumStrings/GltfAlphaMode.cs.meta new file mode 100644 index 0000000..45a64d0 --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAlphaMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e26d5edf965ff5d49bf2b38efbce800d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs b/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs new file mode 100644 index 0000000..6ff5969 --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs @@ -0,0 +1,19 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfAnimationChannelPath +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The animation channel path. + public enum GltfAnimationChannelPath + { + /// + rotation, + /// + scale, + /// + translation, + /// + weights, + } +} diff --git a/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs.meta b/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs.meta new file mode 100644 index 0000000..f6fa62b --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAnimationChannelPath.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9f9a59f474b1574faccb73d251b91c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs b/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs new file mode 100644 index 0000000..901cc6f --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfAnimationInterpolationType +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Interpolation algorithm. + public enum GltfAnimationInterpolationType + { + /// The animated values are linearly interpolated between keyframes. + /// + /// When targeting a rotation, spherical linear interpolation (slerp) should be used to interpolate quaternions. + /// The number output of elements must equal the number of input elements. + /// + LINEAR, + /// The animated values remain constant to the output of the first keyframe, until the next keyframe. + /// The number of output elements must equal the number of input elements. + STEP, + /// The animation's interpolation is computed using a cubic spline with specified tangents. + /// + /// The number of output elements must equal three times the number of input elements. + /// For each input element, the output stores three elements, an in-tangent, a spline vertex, and an out-tangent. + /// There must be at least two keyframes when using this interpolation. + /// + CUBICSPLINE, + } +} diff --git a/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs.meta b/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs.meta new file mode 100644 index 0000000..3344da6 --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfAnimationInterpolationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c4d9b5a59478bb4c804140f9a6c1c95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs b/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs new file mode 100644 index 0000000..a30438c --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs @@ -0,0 +1,15 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfCameraProjectionType +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Specifies if the camera uses a perspective or orthographic projection. + public enum GltfCameraProjectionType + { + /// perspective + perspective, + /// orthographic + orthographic, + } +} diff --git a/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs.meta b/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs.meta new file mode 100644 index 0000000..78f4a4e --- /dev/null +++ b/Runtime/Enums/EnumStrings/GltfCameraProjectionType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57a4e21081d869646965345b2f956405 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine.meta b/Runtime/Enums/UnityEngine.meta new file mode 100644 index 0000000..111921d --- /dev/null +++ b/Runtime/Enums/UnityEngine.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69d69793f384e75459f53cf55be78780 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine/CoreModule.cs b/Runtime/Enums/UnityEngine/CoreModule.cs new file mode 100644 index 0000000..bc3bac6 --- /dev/null +++ b/Runtime/Enums/UnityEngine/CoreModule.cs @@ -0,0 +1,66 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Select how gradients will be evaluated. + public enum GradientMode + { + /// Find the 2 keys adjacent to the requested evaluation time, and linearly interpolate between them to obtain a blended color. + Blend = 0, + /// Return a fixed color, by finding the first key whose time value is greater than the requested evaluation time. + Fixed = 1, + } + + /// The type of motion vectors that should be generated. + public enum MotionVectorGenerationMode + { + /// Use only camera movement to track motion. + Camera = 0, + /// Use a specific pass (if required) to track motion. + Object = 1, + /// Do not track motion. Motion vectors will be 0. + ForceNoMotion = 2, + } + + /// This enum controls the mode under which the sprite will interact with the masking system. + public enum SpriteMaskInteraction + { + /// The sprite will not interact with the masking system. + None = 0, + /// The sprite will be visible only in areas where a mask is present. + VisibleInsideMask = 1, + /// The sprite will be visible only in areas where no mask is present. + VisibleOutsideMask = 2, + } + + /// Determines how time is treated outside of the keyframed range of an AnimationClip or AnimationCurve. + public enum WrapMode + { + /// Reads the default repeat mode set higher up. + Default = 0, + /// When time reaches the end of the animation clip, the clip will automatically stop playing and time will be reset to beginning of the clip. + Once = 1, + //Clamp = 1, + /// When time reaches the end of the animation clip, time will continue at the beginning. + Loop = 2, + /// When time reaches the end of the animation clip, time will ping pong back between beginning and end. + PingPong = 4, + /// Plays back the animation. When it reaches the end, it will keep playing the last frame and never stop playing. + ClampForever = 8, + } + + /// Sets which weights to use when calculating curve segments. + public enum WeightedMode + { + /// Exclude both inWeight or outWeight when calculating curve segments. + None = 0, + /// Include inWeight when calculating the previous curve segment. + In = 1, + /// Include outWeight when calculating the next curve segment. + Out = 2, + /// Include inWeight and outWeight when calculating curve segments. + Both = 3, + } +} diff --git a/Runtime/Enums/UnityEngine/CoreModule.cs.meta b/Runtime/Enums/UnityEngine/CoreModule.cs.meta new file mode 100644 index 0000000..d52c09e --- /dev/null +++ b/Runtime/Enums/UnityEngine/CoreModule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b78fb02c8858884a88dbabe718fbcab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine/ParticleSystemModule.cs b/Runtime/Enums/UnityEngine/ParticleSystemModule.cs new file mode 100644 index 0000000..588e119 --- /dev/null +++ b/Runtime/Enums/UnityEngine/ParticleSystemModule.cs @@ -0,0 +1,364 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + public enum ParticleSystemAnimationMode + { + /// + Grid = 0, + /// + Sprites = 1, + } + + /// + public enum ParticleSystemAnimationRowMode + { + /// + Custom = 0, + /// + Random = 1, + /// + MeshIndex = 2, + } + + /// + public enum ParticleSystemAnimationTimeMode + { + /// + Lifetime = 0, + /// + Speed = 1, + /// + FPS = 2, + } + + /// + public enum ParticleSystemAnimationType + { + /// + WholeSheet = 0, + /// + SingleRow = 1, + } + + /// + public enum ParticleSystemCollisionMode + { + /// + Collision3D = 0, + /// + Collision2D = 1, + } + + /// + public enum ParticleSystemCollisionQuality + { + /// + High = 0, + /// + Medium = 1, + /// + Low = 2, + } + + /// + public enum ParticleSystemCollisionType + { + /// + Planes = 0, + /// + World = 1, + } + + /// + public enum ParticleSystemCullingMode + { + /// + Automatic = 0, + /// + PauseAndCatchup = 1, + /// + Pause = 2, + /// + AlwaysSimulate = 3, + } + + /// + public enum ParticleSystemCurveMode + { + /// + Constant = 0, + /// + Curve = 1, + /// + TwoCurves = 2, + /// + TwoConstants = 3, + } + + /// + public enum ParticleSystemEmitterVelocityMode + { + /// + Transform = 0, + /// + Rigidbody = 1, + } + + /// + public enum ParticleSystemGameObjectFilter + { + /// + LayerMask = 0, + /// + List = 1, + /// + LayerMaskAndList = 2, + } + + /// + public enum ParticleSystemGradientMode + { + /// + Color = 0, + /// + Gradient = 1, + /// + TwoColors = 2, + /// + TwoGradients = 3, + /// + RandomColor = 4, + } + + /// + public enum ParticleSystemInheritVelocityMode + { + /// + Initial = 0, + /// + Current = 1, + } + + /// + public enum ParticleSystemMeshShapeType + { + /// + Vertex = 0, + /// + Edge = 1, + /// + Triangle = 2, + } + + /// + public enum ParticleSystemNoiseQuality + { + /// + Low = 0, + /// + Medium = 1, + /// + High = 2, + } + + /// + public enum ParticleSystemOverlapAction + { + /// + Ignore = 0, + /// + Kill = 1, + /// + Callback = 2, + } + + /// + public enum ParticleSystemRenderMode + { + /// + Billboard = 0, + /// + Stretch = 1, + /// + HorizontalBillboard = 2, + /// + VerticalBillboard = 3, + /// + Mesh = 4, + /// + None = 5, + } + + /// + public enum ParticleSystemRenderSpace + { + /// + View = 0, + /// + World = 1, + /// + Local = 2, + /// + Facing = 3, + /// + Velocity = 4, + } + + /// + public enum ParticleSystemRingBufferMode + { + /// + Disabled = 0, + /// + PauseUntilReplaced = 1, + /// + LoopUntilReplaced = 2, + } + + /// + public enum ParticleSystemScalingMode + { + /// + Hierarchy = 0, + /// + Local = 1, + /// + Shape = 2, + } + + /// + public enum ParticleSystemShapeMultiModeValue + { + /// + Random = 0, + /// + Loop = 1, + /// + PingPong = 2, + /// + BurstSpread = 3, + } + + /// + public enum ParticleSystemShapeTextureChannel + { + /// + Red = 0, + /// + Green = 1, + /// + Blue = 2, + /// + Alpha = 3, + } + + /// + public enum ParticleSystemShapeType + { + /// + Sphere = 0, + /// + SphereShell = 1, + /// + Hemisphere = 2, + /// + HemisphereShell = 3, + /// + Cone = 4, + /// + Box = 5, + /// + Mesh = 6, + /// + ConeShell = 7, + /// + ConeVolume = 8, + /// + ConeVolumeShell = 9, + /// + Circle = 10, + /// + CircleEdge = 11, + /// + SingleSidedEdge = 12, + /// + MeshRenderer = 13, + /// + SkinnedMeshRenderer = 14, + /// + BoxShell = 15, + /// + BoxEdge = 16, + /// + Donut = 17, + /// + Rectangle = 18, + /// + Sprite = 19, + /// + SpriteRenderer = 20, + } + + /// + public enum ParticleSystemSimulationSpace + { + /// + Local = 0, + /// + World = 1, + /// + Custom = 2, + } + + /// + public enum ParticleSystemSortMode + { + /// + None = 0, + /// + Distance = 1, + /// + OldestInFront = 2, + /// + YoungestInFront = 3, + } + + /// + public enum ParticleSystemStopAction + { + /// + None = 0, + /// + Disable = 1, + /// + Destroy = 2, + /// + Callback = 3, + } + + /// + public enum ParticleSystemTrailMode + { + /// + PerParticle = 0, + /// + Ribbon = 1, + } + + /// + public enum ParticleSystemTrailTextureMode + { + /// + Stretch = 0, + /// + Tile = 1, + /// + DistributePerSegment = 2, + /// + RepeatPerSegment = 3, + } +} diff --git a/Runtime/Enums/UnityEngine/ParticleSystemModule.cs.meta b/Runtime/Enums/UnityEngine/ParticleSystemModule.cs.meta new file mode 100644 index 0000000..3f9d5c6 --- /dev/null +++ b/Runtime/Enums/UnityEngine/ParticleSystemModule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9b118051f7d3eb4e84db11323e0004f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine/PhysicsModule.cs b/Runtime/Enums/UnityEngine/PhysicsModule.cs new file mode 100644 index 0000000..d68790f --- /dev/null +++ b/Runtime/Enums/UnityEngine/PhysicsModule.cs @@ -0,0 +1,69 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The collision detection mode constants used for Rigidbody.collisionDetectionMode. + public enum CollisionDetectionMode + { + /// Continuous collision detection is off for this Rigidbody. + Discrete = 0, + /// Continuous collision detection is on for colliding with static mesh geometry. + Continuous = 1, + /// Continuous collision detection is on for colliding with static and dynamic geometry. + ContinuousDynamic = 2, + /// Speculative continuous collision detection is on for static and dynamic geometries. + ContinuousSpeculative = 3, + } + + /// Describes how physics materials of the colliding objects are combined. + public enum PhysicMaterialCombine + { + /// Averages the friction/bounce of the two colliding materials. + Average = 0, + /// Multiplies the friction/bounce of the two colliding materials. + Multiply = 1, + /// Uses the smaller friction/bounce of the two colliding materials. + Minimum = 2, + /// Uses the larger friction/bounce of the two colliding materials. + Maximum = 3, + } + + /// Use these flags to constrain motion of Rigidbodies. + /// [Flag] + public enum RigidbodyConstraints + { + /// No constraints. + None = 0, + /// Freeze motion along the X-axis. + FreezePositionX = 2, + /// Freeze motion along the Y-axis. + FreezePositionY = 4, + /// Freeze motion along the Z-axis. + FreezePositionZ = 8, + /// Freeze motion along all axes. + FreezePosition = 14, + /// Freeze rotation along the X-axis. + FreezeRotationX = 16, + /// Freeze rotation along the Y-axis. + FreezeRotationY = 32, + /// Freeze rotation along the Z-axis. + FreezeRotationZ = 64, + /// Freeze rotation along all axes. + FreezeRotation = 112, + /// Freeze rotation and motion along all axes. + FreezeAll = 126 + } + + /// Rigidbody interpolation mode. + public enum RigidbodyInterpolation + { + /// No Interpolation. + None = 0, + /// Interpolation will always lag a little bit behind but can be smoother than extrapolation. + Interpolate = 1, + /// Extrapolation will predict the position of the rigidbody based on the current velocity. + Extrapolate = 2, + } +} diff --git a/Runtime/Enums/UnityEngine/PhysicsModule.cs.meta b/Runtime/Enums/UnityEngine/PhysicsModule.cs.meta new file mode 100644 index 0000000..3994a09 --- /dev/null +++ b/Runtime/Enums/UnityEngine/PhysicsModule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6d98ff22a2d8934588efda79a4a0991 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine/Rendering.cs b/Runtime/Enums/UnityEngine/Rendering.cs new file mode 100644 index 0000000..ad02feb --- /dev/null +++ b/Runtime/Enums/UnityEngine/Rendering.cs @@ -0,0 +1,148 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + + /// + public enum CullMode + { + /// + Off, + /// + Front, + /// + Back, + } + + /// Enum describing what part of a light contribution can be baked. + [Flags] + public enum LightmapBakeType + { + /// Mixed lights allow a mix of realtime and baked lighting, based on the Mixed Lighting Mode used. + Mixed = 1, + /// Baked lights cannot move or change in any way during run time. + Baked = 2, + /// Realtime lights cast run time light and shadows. + Realtime = 4, + } + + /// Light probe interpolation type. + public enum LightProbeUsage + { + /// Light Probes are not used. The Scene's ambient probe is provided to the shader. + Off = 0, + /// Simple light probe interpolation is used. + BlendProbes = 1, + /// Uses a 3D grid of interpolated light probes. + UseProxyVolume = 2, + /// The light probe shader uniform values are extracted from the material property block set on the renderer. + CustomProvided = 4, + } + + /// How the Light is rendered. + public enum LightRenderMode + { + /// Automatically choose the render mode. + Auto = 0, + /// Force the Light to be a pixel light. + ForcePixel = 1, + /// Force the Light to be a vertex light. + ForceVertex = 2, + } + + /// Shadow resolution options for a Light. + public enum LightShadowResolution + { + /// Use resolution from QualitySettings (default). + FromQualitySettings = -1, + /// Low shadow map resolution. + Low = 0, + /// Medium shadow map resolution. + Medium = 1, + /// High shadow map resolution. + High = 2, + /// Very high shadow map resolution. + VeryHigh = 3, + } + + /// Shadow casting options for a Light. + public enum LightShadows + { + /// Do not cast shadows (default). + None = 0, + /// Cast "hard" shadows (with no shadow filtering). + Hard = 1, + /// Cast "soft" shadows (with 4x PCF filtering). + Soft = 2, + } + + /// Describes the shape of a spot light. + public enum LightShape + { + /// The shape of the spot light resembles a cone. + Cone = 0, + /// The shape of the spotlight resembles a pyramid or frustum. + Pyramid = 1, + /// The shape of the spot light resembles a box oriented along the ray direction. + Box = 2, + } + + /// The type of a Light. + public enum LightType + { + /// The light is a spot light. + Spot = 0, + /// The light is a directional light. + Directional = 1, + /// The light is a point light. + Point = 2, + /// The light is a area light. + Area = 3, + /// The light is a rectangle shaped area light. + Rectangle = 3, + /// The light is a disc shaped area light. + Disc = 4, + } + + /// Reflection Probe usage. + public enum ReflectionProbeUsage + { + /// Reflection probes are disabled, skybox will be used for reflection. + Off = 0, + /// Reflection probes are enabled. Blending occurs only between probes, useful in indoor environments. + BlendProbes = 1, + /// Reflection probes are enabled. + BlendProbesAndSkybox = 2, + /// Reflection probes are enabled, but no blending will occur between probes when there are two overlapping volumes. + Simple = 3, + } + + /// How shadows are cast from this object. + public enum ShadowCastingMode + { + /// No shadows are cast from this object. + Off = 0, + /// Shadows are cast from this object. + On = 1, + /// Shadows are cast from this object, treating it as two-sided. + TwoSided = 2, + /// Object casts shadows, but is otherwise invisible in the Scene. + ShadowsOnly = 3, + } + + /// + public enum UVChannelFlags + { + /// + UV0 = 0, + /// + UV1 = 1, + /// + UV2 = 2, + /// + UV3 = 3, + } +} diff --git a/Runtime/Enums/UnityEngine/Rendering.cs.meta b/Runtime/Enums/UnityEngine/Rendering.cs.meta new file mode 100644 index 0000000..bdce305 --- /dev/null +++ b/Runtime/Enums/UnityEngine/Rendering.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57f5b2868c8443b4eac6c554ee27ee03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/UnityEngine/SkyboxShader.cs b/Runtime/Enums/UnityEngine/SkyboxShader.cs new file mode 100644 index 0000000..b296d89 --- /dev/null +++ b/Runtime/Enums/UnityEngine/SkyboxShader.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Image Type + public enum SkyboxImageType + { + /// 360 Degrees + Degrees360 = 0, + /// 180 Degrees + Degrees180 = 1, + } + + /// 3D Layout + public enum SkyboxLayout + { + /// None + None = 0, + /// Side by Side + SideBySide = 1, + /// Over Under + OverUnder = 2, + } + + /// Mapping + public enum SkyboxMapping + { + /// 6 Frames Layout + SixFramesLayout = 0, + /// Latitude Longitude Layout + LatitudeLongitudeLayout = 1, + } + + /// Sun + public enum SkyboxSunDisk + { + /// None + None = 0, + /// Simple + Simple = 1, + /// High Quality + HighQuality = 2, + } +} diff --git a/Runtime/Enums/UnityEngine/SkyboxShader.cs.meta b/Runtime/Enums/UnityEngine/SkyboxShader.cs.meta new file mode 100644 index 0000000..da9019c --- /dev/null +++ b/Runtime/Enums/UnityEngine/SkyboxShader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8022b1c16ce59df419198613934c75c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL.meta b/Runtime/Enums/WebGL.meta new file mode 100644 index 0000000..54a60a7 --- /dev/null +++ b/Runtime/Enums/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 796e89e9d9998f34b919665ae16f6212 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfBufferViewTarget.cs b/Runtime/Enums/WebGL/GltfBufferViewTarget.cs new file mode 100644 index 0000000..8db0c96 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfBufferViewTarget.cs @@ -0,0 +1,26 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfBufferViewTarget +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The target that the GPU buffer should be bound to. + /// WebGL.GLenum.BufferObjects + public enum GltfBufferViewTarget : uint + { + /// + NONE = 0x0000, + /// + /// 34962 + ARRAY_BUFFER = 0x8892, + /// + /// 34963 + ELEMENT_ARRAY_BUFFER = 0x8893, + ///// + ///// 34964 + //ARRAY_BUFFER_BINDING = 0x8894, + ///// + ///// 34965 + //ELEMENT_ARRAY_BUFFER_BINDING = 0x8895, + } +} diff --git a/Runtime/Enums/WebGL/GltfBufferViewTarget.cs.meta b/Runtime/Enums/WebGL/GltfBufferViewTarget.cs.meta new file mode 100644 index 0000000..6779e02 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfBufferViewTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f55909034b37ffc48bdfaf6fc09f2ba9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfComponentType.cs b/Runtime/Enums/WebGL/GltfComponentType.cs new file mode 100644 index 0000000..0abcc02 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfComponentType.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfComponentType +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + /// WebGL.GLenum.DataType + public enum GltfComponentType : uint + { + /// + NONE = 0x0000, + /// byte + /// 5120 + BYTE = 0x1400, + /// unsigned byte + /// 5121 + UNSIGNED_BYTE = 0x1401, + /// short + /// 5122 + SHORT = 0x1402, + /// unsigned short + /// 5123 + UNSIGNED_SHORT = 0x1403, + /// int + /// 5124 + INT = 0x1404, + /// unsigned int + /// 5125 + UNSIGNED_INT = 0x1405, + /// float + /// 5126 + FLOAT = 0x1406, + } +} diff --git a/Runtime/Enums/WebGL/GltfComponentType.cs.meta b/Runtime/Enums/WebGL/GltfComponentType.cs.meta new file mode 100644 index 0000000..53ee9da --- /dev/null +++ b/Runtime/Enums/WebGL/GltfComponentType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b26b1e6793ec484a9a882736f7247f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfCullFaceMode.cs b/Runtime/Enums/WebGL/GltfCullFaceMode.cs new file mode 100644 index 0000000..e2bddaf --- /dev/null +++ b/Runtime/Enums/WebGL/GltfCullFaceMode.cs @@ -0,0 +1,19 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfCullFaceMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + public enum GltfCullFaceMode : uint + { + /// + NONE = 0x0000, + /// + FRONT = 0x0404, + /// + BACK = 0x0405, + /// + FRONT_AND_BACK = 0x0408, + } +} diff --git a/Runtime/Enums/WebGL/GltfCullFaceMode.cs.meta b/Runtime/Enums/WebGL/GltfCullFaceMode.cs.meta new file mode 100644 index 0000000..f1be5a9 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfCullFaceMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ce98a6f715af3048b2ae74f846703d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs b/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs new file mode 100644 index 0000000..fcb41e2 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs @@ -0,0 +1,26 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfMeshPrimitiveMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// The type of primitives to render. + /// WebGL.GLenum.BeginMode + public enum GltfMeshPrimitiveMode : uint + { + /// + POINTS = 0x0000, + /// + LINES = 0x0001, + /// + LINE_LOOP = 0x0002, + /// + LINE_STRIP = 0x0003, + /// + TRIANGLES = 0x0004, + /// + TRIANGLE_STRIP = 0x0005, + /// + TRIANGLE_FAN = 0x0006, + } +} diff --git a/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs.meta b/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs.meta new file mode 100644 index 0000000..23eb491 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfMeshPrimitiveMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54234f070fc73164ba5dba094c226e42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs b/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs new file mode 100644 index 0000000..a3a719a --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs @@ -0,0 +1,20 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfTextureMagFilterMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Magnification filter mode. + /// WebGL.GLenum.TextureMagFilter + public enum GltfTextureMagFilterMode : uint + { + /// + NONE = 0x0000, + /// + /// 9728 + NEAREST = 0x2600, + /// + /// 9729 + LINEAR = 0x2601, + } +} diff --git a/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs.meta b/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs.meta new file mode 100644 index 0000000..b290435 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureMagFilterMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d430d31d69b1cd84897a56de8f9254f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs b/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs new file mode 100644 index 0000000..31ce19f --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfTextureMinFilterMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Minification filter mode. + /// WebGL.GLenum.TextureMinFilter + public enum GltfTextureMinFilterMode : uint + { + /// + NONE = 0x0000, + /// + /// 9728 + NEAREST = 0x2600, + /// + /// 9729 + LINEAR = 0x2601, + /// + /// 9984 + NEAREST_MIPMAP_NEAREST = 0x2700, + /// + /// 9985 + LINEAR_MIPMAP_NEAREST = 0x2701, + /// + /// 9986 + NEAREST_MIPMAP_LINEAR = 0x2702, + /// + /// 9987 + LINEAR_MIPMAP_LINEAR = 0x2703, + } +} diff --git a/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs.meta b/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs.meta new file mode 100644 index 0000000..a5a0a4c --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureMinFilterMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b48b256466d1224dbe80cb4ac0e382c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfTextureTarget.cs b/Runtime/Enums/WebGL/GltfTextureTarget.cs new file mode 100644 index 0000000..02b99b5 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureTarget.cs @@ -0,0 +1,33 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfTextureTarget +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + public enum GltfTextureTarget : uint + { + /// + TEXTURE_2D = 0x0DE1, + /// + TEXTURE = 0x2801, + /// + TEXTURE_CUBE_MAP = 0x8513, + /// + TEXTURE_BINDING_CUBE_MAP = 0x8514, + /// + TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515, + /// + TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516, + /// + TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517, + /// + TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518, + /// + TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519, + /// + TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A, + /// + MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C, + } +} diff --git a/Runtime/Enums/WebGL/GltfTextureTarget.cs.meta b/Runtime/Enums/WebGL/GltfTextureTarget.cs.meta new file mode 100644 index 0000000..206938c --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 67fdf644ace051f44baa0e80c51b0b41 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Enums/WebGL/GltfTextureWrapMode.cs b/Runtime/Enums/WebGL/GltfTextureWrapMode.cs new file mode 100644 index 0000000..b507f21 --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureWrapMode.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Enum : GltfTextureWrapMode +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + /// WebGL.GLenum.TextureWrapMode + public enum GltfTextureWrapMode : uint + { + /// + NONE = 0x0000, + /// + /// 10497 + REPEAT = 0x2901, + /// + /// 33071 + CLAMP_TO_EDGE = 0x812F, + /// + /// 33648 + MIRRORED_REPEAT = 0x8370, + } +} diff --git a/Runtime/Enums/WebGL/GltfTextureWrapMode.cs.meta b/Runtime/Enums/WebGL/GltfTextureWrapMode.cs.meta new file mode 100644 index 0000000..d8e36fd --- /dev/null +++ b/Runtime/Enums/WebGL/GltfTextureWrapMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d80cb1098627c0b48a425fb4479296b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Extensions.meta b/Runtime/Extensions.meta new file mode 100644 index 0000000..7586572 --- /dev/null +++ b/Runtime/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 244be7e3de8ce164a8bff5e1c41a08d3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Extensions/GltfAccessorTypeExtensions.cs b/Runtime/Extensions/GltfAccessorTypeExtensions.cs new file mode 100644 index 0000000..bd568f5 --- /dev/null +++ b/Runtime/Extensions/GltfAccessorTypeExtensions.cs @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : GltfAccessorTypeExtensions +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + + /// + /// glTF AccessorType Extensions + /// + public static class GltfAccessorTypeExtensions + { + /// + /// Gets the number of elements in the accessor type. + /// + /// The accessor type. + /// the number of elements in the accessor type. + public static int TypeCount(this GltfAccessorType accessorType) + { + switch (accessorType) + { + case GltfAccessorType.SCALAR: + return 1; + case GltfAccessorType.VEC2: + return 2; + case GltfAccessorType.VEC3: + return 3; + case GltfAccessorType.VEC4: + return 4; + case GltfAccessorType.MAT2: + return 4; + case GltfAccessorType.MAT3: + return 9; + case GltfAccessorType.MAT4: + return 16; + default: + throw new NotImplementedException(); + } + } + } +} diff --git a/Runtime/Extensions/GltfAccessorTypeExtensions.cs.meta b/Runtime/Extensions/GltfAccessorTypeExtensions.cs.meta new file mode 100644 index 0000000..89ff213 --- /dev/null +++ b/Runtime/Extensions/GltfAccessorTypeExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f881d7824cc2efd43b3acc7d5c7a2a03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Extensions/GltfComponentTypeExtensions.cs b/Runtime/Extensions/GltfComponentTypeExtensions.cs new file mode 100644 index 0000000..e59334f --- /dev/null +++ b/Runtime/Extensions/GltfComponentTypeExtensions.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : GltfComponentTypeExtensions +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + + /// + /// glTF ComponentType Extensions + /// + public static class GltfComponentTypeExtensions + { + /// + /// Gets the byte size of the component type. + /// + /// The component type. + /// The byte size of the component type. + public static int ByteSize(this GltfComponentType componentType) + { + switch (componentType) + { + case GltfComponentType.BYTE: + case GltfComponentType.UNSIGNED_BYTE: + return 1; + case GltfComponentType.SHORT: + case GltfComponentType.UNSIGNED_SHORT: + return 2; + case GltfComponentType.INT: + case GltfComponentType.UNSIGNED_INT: + case GltfComponentType.FLOAT: + return 4; + default: + throw new NotImplementedException(); + } + } + } +} diff --git a/Runtime/Extensions/GltfComponentTypeExtensions.cs.meta b/Runtime/Extensions/GltfComponentTypeExtensions.cs.meta new file mode 100644 index 0000000..f38b924 --- /dev/null +++ b/Runtime/Extensions/GltfComponentTypeExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e22ff05570959f942a16a5746d9c66dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Storage.meta b/Runtime/Storage.meta new file mode 100644 index 0000000..fcfb5f4 --- /dev/null +++ b/Runtime/Storage.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 601bab3f1d2a59a44b479fff529018ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Storage/GltfChunk.cs b/Runtime/Storage/GltfChunk.cs new file mode 100644 index 0000000..0aecba4 --- /dev/null +++ b/Runtime/Storage/GltfChunk.cs @@ -0,0 +1,115 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : GltfChunk +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using VgoGltf.Buffers; + + /// + /// glTF Chunk + /// + public class GltfChunk + { + #region Constructors + + /// + /// Create a new instance of GltfChunk with chunkType and chunkData. + /// + /// + /// + public GltfChunk(GltfChunkType chunkType, IByteBuffer chunkData) + { + int paddingCount = CalculatePaddingCount(chunkData.Length, quotient: 4); + + ChunkLength = (uint)(chunkData.Length + paddingCount); + ChunkType = chunkType; + ChunkData = chunkData; + } + + #endregion + + #region Fields + + /// Chunk Data Length + public readonly uint ChunkLength = 0; + + /// Chunk Type + public readonly GltfChunkType ChunkType; + + /// Chunk Data + public readonly IByteBuffer ChunkData = default; + + #endregion + + #region Properties + + /// Chunk All Length + public uint AllLength => 4 + 4 + ChunkLength; + + #endregion + + #region Public Methods + + /// + /// Gets ChunkData that has been padded. + /// + /// + public byte[] GetPaddingedData() + { + if (ChunkData == default) + { + return null; + } + + int paddingCount = CalculatePaddingCount(ChunkData.Length, quotient: 4); + + byte[] bytes = new byte[ChunkData.Length + paddingCount]; + + Array.Copy(ChunkData.ToArray(), bytes, ChunkData.Length); + + byte pad; + + if (ChunkType == GltfChunkType.Json) + { + pad = (byte)0x20; // space + } + else + { + pad = (byte)0x00; + } + + for (int i = ChunkData.Length - 1; i < paddingCount; i++) + { + bytes[i] = pad; + } + + return bytes; + } + + #endregion + + #region Protected Methods + + /// + /// Calculate the number of paddings. + /// + /// + /// + /// The number of paddings. + /// + /// When the quotient is 4, the padding is 0, 1, 2, 3. + /// + protected int CalculatePaddingCount(int targetCount, int quotient) + { + int remainder = targetCount % quotient; + + int paddingCount = (remainder == 0) ? 0 : quotient - remainder; + + return paddingCount; + } + + #endregion + } +} diff --git a/Runtime/Storage/GltfChunk.cs.meta b/Runtime/Storage/GltfChunk.cs.meta new file mode 100644 index 0000000..54508bd --- /dev/null +++ b/Runtime/Storage/GltfChunk.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a5f7e950dc486c418edd2486c20249b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Storage/GltfChunkType.cs b/Runtime/Storage/GltfChunkType.cs new file mode 100644 index 0000000..2890d5e --- /dev/null +++ b/Runtime/Storage/GltfChunkType.cs @@ -0,0 +1,17 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : GltfChunkType +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// Chunk Type + public enum GltfChunkType : uint + { + /// JSON + /// "JSON" + Json = 0x4E4F534A, + /// BIN + /// "BIN " + Bin = 0x004E4942, + } +} diff --git a/Runtime/Storage/GltfChunkType.cs.meta b/Runtime/Storage/GltfChunkType.cs.meta new file mode 100644 index 0000000..97a20ff --- /dev/null +++ b/Runtime/Storage/GltfChunkType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e4a0203fd79fc674f8339639dcf37b81 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Storage/GltfHeader.cs b/Runtime/Storage/GltfHeader.cs new file mode 100644 index 0000000..3e92731 --- /dev/null +++ b/Runtime/Storage/GltfHeader.cs @@ -0,0 +1,25 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Class : GltfHeader +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + /// + /// glTF Header + /// + public struct GltfHeader + { + #region Fields + + /// Magic + public uint Magic; + + /// Version + public uint Version; + + /// Length + public uint Length; + + #endregion + } +} diff --git a/Runtime/Storage/GltfHeader.cs.meta b/Runtime/Storage/GltfHeader.cs.meta new file mode 100644 index 0000000..aa5530b --- /dev/null +++ b/Runtime/Storage/GltfHeader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79e43dd5bc13ac242aa1ae91a422ea49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs.meta b/Runtime/Structs.meta new file mode 100644 index 0000000..5c0fda1 --- /dev/null +++ b/Runtime/Structs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b28b461173622a4d9ce4e6b6ea82d8a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Color3.cs b/Runtime/Structs/Color3.cs new file mode 100644 index 0000000..a0d9ca2 --- /dev/null +++ b/Runtime/Structs/Color3.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Color3 +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Color3 + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Color3 + { + /// Red + public float R; + + /// Green + public float G; + + /// Blue + public float B; + + /// + /// Create a new instance of Color3 with r, g, b. + /// + /// + /// + /// + public Color3(float r, float g, float b) + { + R = r; + G = g; + B = b; + } + + /// Black + public static Color3 Black => new Color3(0.0f, 0.0f, 0.0f); + + /// White + public static Color3 White => new Color3(1.0f, 1.0f, 1.0f); + } +} diff --git a/Runtime/Structs/Color3.cs.meta b/Runtime/Structs/Color3.cs.meta new file mode 100644 index 0000000..76b1faf --- /dev/null +++ b/Runtime/Structs/Color3.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b08084f70de300e4781ee31213d43386 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Color4.cs b/Runtime/Structs/Color4.cs new file mode 100644 index 0000000..79e1e14 --- /dev/null +++ b/Runtime/Structs/Color4.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Color4 +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Color4 + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Color4 + { + /// Red + public float R; + + /// Green + public float G; + + /// Blue + public float B; + + /// Alpha + public float A; + + /// + /// Create a new instance of Color4 with r, g, b. + /// + /// + /// + /// + public Color4(float r, float g, float b) : this(r, g, b, 1.0f) { } + + /// + /// Create a new instance of Color4 with r, g, b, a. + /// + /// + /// + /// + public Color4(float r, float g, float b, float a) + { + R = r; + G = g; + B = b; + A = a; + } + + /// Black + public static Color4 Black => new Color4(0.0f, 0.0f, 0.0f, 1.0f); + + /// White + public static Color4 White => new Color4(1.0f, 1.0f, 1.0f, 1.0f); + } +} diff --git a/Runtime/Structs/Color4.cs.meta b/Runtime/Structs/Color4.cs.meta new file mode 100644 index 0000000..f76d79c --- /dev/null +++ b/Runtime/Structs/Color4.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e957077ef6218b8498bc061769a49f73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Matrix2.cs b/Runtime/Structs/Matrix2.cs new file mode 100644 index 0000000..4bbf11a --- /dev/null +++ b/Runtime/Structs/Matrix2.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Matrix2 +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Matrix2 + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Matrix2 + { + /// + public float M11; + + /// + public float M12; + + /// + public float M21; + + /// + public float M22; + + /// + /// Create a new instance of Matrix2. + /// + /// + /// + /// + /// + public Matrix2(float m11, float m12, float m21, float m22) + { + M11 = m11; + M12 = m12; + M21 = m21; + M22 = m22; + } + + /// + public static Matrix2 Identity { get; } = new Matrix2(1, 0, 0, 1); + + /// + public static Matrix2 Zero { get; } = new Matrix2(0, 0, 0, 0); + } +} diff --git a/Runtime/Structs/Matrix2.cs.meta b/Runtime/Structs/Matrix2.cs.meta new file mode 100644 index 0000000..e27ec1c --- /dev/null +++ b/Runtime/Structs/Matrix2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 25f2d834fb57467469632fe54a46f4b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Matrix3.cs b/Runtime/Structs/Matrix3.cs new file mode 100644 index 0000000..26fc6bf --- /dev/null +++ b/Runtime/Structs/Matrix3.cs @@ -0,0 +1,75 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Matrix3 +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Matrix3 + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Matrix3 + { + /// + public float M11; + + /// + public float M12; + + /// + public float M13; + + /// + public float M21; + + /// + public float M22; + + /// + public float M23; + + /// + public float M31; + + /// + public float M32; + + /// + public float M33; + + /// + /// Create a new instance of Matrix3. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Matrix3(float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33) + { + M11 = m11; + M12 = m12; + M13 = m13; + M21 = m21; + M22 = m22; + M23 = m23; + M31 = m31; + M32 = m32; + M33 = m33; + } + + /// + public static Matrix3 Identity { get; } = new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1); + + /// + public static Matrix3 Zero { get; } = new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} diff --git a/Runtime/Structs/Matrix3.cs.meta b/Runtime/Structs/Matrix3.cs.meta new file mode 100644 index 0000000..408762d --- /dev/null +++ b/Runtime/Structs/Matrix3.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61d7a6b756044d74fac030b0944907e4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Vector4Uint.cs b/Runtime/Structs/Vector4Uint.cs new file mode 100644 index 0000000..1af0398 --- /dev/null +++ b/Runtime/Structs/Vector4Uint.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Vector4Uint +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Vector4 (uint) + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Vector4Uint + { + /// + public uint X; + + /// + public uint Y; + + /// + public uint Z; + + /// + public uint W; + + /// + /// Create a new instance of Vector4Uint with x and y and z and w. + /// + /// + /// + /// + /// + public Vector4Uint(uint x, uint y, uint z, uint w) + { + X = x; + Y = y; + Z = z; + W = w; + } + } +} diff --git a/Runtime/Structs/Vector4Uint.cs.meta b/Runtime/Structs/Vector4Uint.cs.meta new file mode 100644 index 0000000..9bcc1c2 --- /dev/null +++ b/Runtime/Structs/Vector4Uint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ac40dcd40a85d5d4f9a33e0fde723a59 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Structs/Vector4Ushort.cs b/Runtime/Structs/Vector4Ushort.cs new file mode 100644 index 0000000..1e57069 --- /dev/null +++ b/Runtime/Structs/Vector4Ushort.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------- +// @Namespace : VgoGltf +// @Struct : Vector4Ushort +// ---------------------------------------------------------------------- +namespace VgoGltf +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Vector4 (ushort) + /// + [Serializable] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct Vector4Ushort + { + /// + public ushort X; + + /// + public ushort Y; + + /// + public ushort Z; + + /// + public ushort W; + + /// + /// Create a new instance of Vector4Ushort with x and y and z and w. + /// + /// + /// + /// + /// + public Vector4Ushort(ushort x, ushort y, ushort z, ushort w) + { + X = x; + Y = y; + Z = z; + W = w; + } + } +} diff --git a/Runtime/Structs/Vector4Ushort.cs.meta b/Runtime/Structs/Vector4Ushort.cs.meta new file mode 100644 index 0000000..1c8fa82 --- /dev/null +++ b/Runtime/Structs/Vector4Ushort.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d6bacab49201fb7429be1a72c74096aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/VgoGltf.asmdef b/Runtime/VgoGltf.asmdef new file mode 100644 index 0000000..d42b313 --- /dev/null +++ b/Runtime/VgoGltf.asmdef @@ -0,0 +1,13 @@ +{ + "name": "VgoGltf", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Runtime/VgoGltf.asmdef.meta b/Runtime/VgoGltf.asmdef.meta new file mode 100644 index 0000000..5c059fa --- /dev/null +++ b/Runtime/VgoGltf.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7a429307a0147424d85a7b0aa7126cac +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..26c1957 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "izayoi.vgo.gltf", + "displayName": "VgoGltf", + "description": "VgoGltf is the basic and common definition of glTF.", + "version": "1.0.0", + "type": "tool", + "category": "", + "keywords": [ + "gltf", + "glb", + "vgo" + ], + "unity": "2018.4", + "unityRelease": "25f1", + "author": { + "name" : "Izayoi Jiichan" + }, + "license": { + "type": "MIT", + "url": "https://github.com/izayoijiichan/vgo.gltf/tree/master/LICENSE.md" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/izayoijiichan/vgo.gltf.git" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..1fe2758 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2013f468a26c16c4e8a30336d80464ef +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: