SO MUCH SCUFFEDNESS

This commit is contained in:
2023-05-31 15:12:09 -04:00
parent 68a30bb1bd
commit 5847d71676
323 changed files with 573 additions and 78 deletions

View File

@ -0,0 +1,43 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
//! @brief Numeric type union
//! @note The size will need to be changed if the API
[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct DataInternalNumeric
{
[FieldOffset(0)]
public int mIntData0;
[FieldOffset(4)]
public int mIntData1;
[FieldOffset(8)]
public int mIntData2;
[FieldOffset(12)]
public int mIntData3;
[FieldOffset(0)]
public float mFloatData0;
[FieldOffset(4)]
public float mFloatData1;
[FieldOffset(8)]
public float mFloatData2;
[FieldOffset(12)]
public float mFloatData3;
[FieldOffset(0)]
public IntPtr mPtr;
[FieldOffset(0)]
public NativeDataImage ImageData;
}
//! @brief Separate type for outputs
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81de55a495f8b1c46be3fa485ad32aa0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4f96894eae7ca5a4abd70a163c1e956e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
namespace Adobe.Substance
{
//! @brief Enum type mapping from sbsario to C#
internal enum ErrorCode : uint
{
SBSARIO_ERROR_OK = 0x00u, //!< No error has occurred
SBSARIO_ERROR_STATE = 0x01u, //!< Call made with an invalid state
SBSARIO_ERROR_INVALID = 0x02u, //!< An invalid argument was given to the api
SBSARIO_ERROR_UNKNOWN = 0x03u, //!< An unspecified error has occurred
SBSARIO_ERROR_FAILURE = 0x04u, //!< The operation failed to complete
}
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7b566521bda0b2c47a8cc502717e65b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Adobe.Substance
{
internal enum HVFlip
{
SBSARIO_HVFLIP_NO = 0x0, //!< No flipping (default value)
SBSARIO_HVFLIP_HORIZONTAL = 0x1, //!< Horizontal flip
SBSARIO_HVFLIP_VERTICAL = 0x2, //!< Vertical flip
SBSARIO_HVFLIP_BOTH = 0x3 //!< Horizontal and Vertical flip
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9687bfad244a5d749b109a35754b97e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
namespace Adobe.Substance
{
//! @brief Image format
internal enum ImageFormat : int
{
// 2 bits reserved for the bytes per channel
SBSARIO_IMAGE_FORMAT_8B = 0x00,
SBSARIO_IMAGE_FORMAT_16B = 0x01,
SBSARIO_IMAGE_FORMAT_32B = 0x02,
/* Unused - 0x03u */
SBSARIO_IMAGE_FORMAT_BITDEPTH_MASK = 0x03,
// 2 bits reserved for the number of channels
SBSARIO_IMAGE_FORMAT_RGBA = 0x00,
SBSARIO_IMAGE_FORMAT_RGBX = 0x04,
SBSARIO_IMAGE_FORMAT_RGB = 0x08,
SBSARIO_IMAGE_FORMAT_L = 0x0c,
SBSARIO_IMAGE_FORMAT_CHANNELS_MASK = 0x0c,
// 1 bit to determine integer or floating point
SBSARIO_IMAGE_FORMAT_INT = 0x00,
SBSARIO_IMAGE_FORMAT_FLOAT = 0x10,
/* Format (2 bits) */
SBSARIO_IMAGE_FORMAT_PF_RAW = 0x0, /**< Non-compressed flag */
SBSARIO_IMAGE_FORMAT_PF_BC = 0x1 << 6, /**< DXT compression flag */
SBSARIO_IMAGE_FORMAT_PF_PVRTC = 0x3 << 6, /**< PVRTC compression flag */
SBSARIO_IMAGE_FORMAT_PF_ETC = 0x3 << 6, /**< ETC compression flag */
SBSARIO_IMAGE_FORMAT_PF_Misc = 0x2 << 6, /**< Other compression flag */
SBSARIO_IMAGE_FORMAT_PF_MASK_RAWFormat = 0x3 << 6,
// Combine integer and float bitfields to create more complex image types
SBSARIO_IMAGE_FORMAT_8I = SBSARIO_IMAGE_FORMAT_8B | SBSARIO_IMAGE_FORMAT_INT,
SBSARIO_IMAGE_FORMAT_16I = SBSARIO_IMAGE_FORMAT_16B | SBSARIO_IMAGE_FORMAT_INT,
SBSARIO_IMAGE_FORMAT_16F = SBSARIO_IMAGE_FORMAT_16B | SBSARIO_IMAGE_FORMAT_FLOAT,
SBSARIO_IMAGE_FORMAT_32F = SBSARIO_IMAGE_FORMAT_32B | SBSARIO_IMAGE_FORMAT_FLOAT,
SBSARIO_IMAGE_FORMAT_PRECISION_MASK = SBSARIO_IMAGE_FORMAT_BITDEPTH_MASK | 0x10
}
//! @brief Enum representing the order of the output channels
internal enum ChannelOrder : uint
{
SBSARIO_CHANNEL_ORDER_INVALID = 0x00u,
SBSARIO_CHANNEL_ORDER_RGBA = 0xe4u,
SBSARIO_CHANNEL_ORDER_BGRA = 0xc6u,
SBSARIO_CHANNEL_ORDER_ABGR = 0x1bu,
SBSARIO_CHANNEL_ORDER_ARGB = 0x39u,
SBSARIO_CHANNEL_RED_MASK = 0x03u,
SBSARIO_CHANNEL_GREEN_MASK = 0x0cu,
SBSARIO_CHANNEL_BLUE_MASK = 0x30u,
SBSARIO_CHANNEL_ALPHA_MASK = 0xc0u,
SBSARIO_CHANNEL_RED_RSHIFT = 0x00u,
SBSARIO_CHANNEL_GREEN_RSHIFT = 0x02u,
SBSARIO_CHANNEL_BLUE_RSHIFT = 0x04u,
SBSARIO_CHANNEL_ALPHA_RSHIFT = 0x06u,
}
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72a712966a00a97428f8275064ad75fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
namespace Adobe.Substance
{
//! @brief Enum describing whether the data is an input or output
internal enum DataType : uint
{
SBSARIO_DATA_INVALID = 0x00u, //!< Invalid data
SBSARIO_DATA_INPUT = 0x01u, //!< Input data
SBSARIO_DATA_OUTPUT = 0x02u, //!< Output data
}
//! @brief Enum describing the value type of an input or output
internal enum ValueType : uint
{
SBSARIO_VALUE_FLOAT = 0x00u, //!< Float type
SBSARIO_VALUE_FLOAT2 = 0x01u, //!< Float vector with two elements
SBSARIO_VALUE_FLOAT3 = 0x02u, //!< Float vector with three elements
SBSARIO_VALUE_FLOAT4 = 0x03u, //!< Float vector with four elements
SBSARIO_VALUE_INT = 0x04u, //!< Integer type
SBSARIO_VALUE_INT2 = 0x05u, //!< Integer vector with two elements
SBSARIO_VALUE_INT3 = 0x06u, //!< Integer vector with three elements
SBSARIO_VALUE_INT4 = 0x07u, //!< Integer vector with four elements
SBSARIO_VALUE_IMAGE = 0x08u, //!< Image type
SBSARIO_VALUE_STRING = 0x09u, //!< String type, input only
SBSARIO_VALUE_FONT = 0x0Au, //!< Font type, input only
}
internal enum WidgetType : uint
{
SBSARIO_WIDGET_NOWIDGET = 0x00u,
SBSARIO_WIDGET_SLIDER = 0x01u,
SBSARIO_WIDGET_ANGLE = 0x02u,
SBSARIO_WIDGET_COLOR = 0x03u,
SBSARIO_WIDGET_TOGGLEBUTTON = 0x04u,
SBSARIO_WIDGET_COMBOBOX = 0x05u,
SBSARIO_WIDGET_IMAGE = 0x06u,
SBSARIO_WIDGET_POSITION = 0x07u,
}
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ba3c765d94cc4a479c0a6df314289c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
[StructLayout(LayoutKind.Sequential)]
internal struct NativeDataImage
{
/** @brief Pointer to the underlying image data */
public IntPtr data;
/** @brief The width in pixels of the larget mipmap */
public IntPtr width;
/** @brief The height in pixels of the largest mipmap */
public IntPtr height;
/** @brief The number of mipmaps in the chain. The largest map (level 0)
will be the first in memory, with width/height as its dimensions
*/
public IntPtr mipmaps;
/** @brief Channel order enum, describing the channel index order */
public ChannelOrder channel_order;
/** @brief Image format enum, describing the bitdepth and channel size
of the image in memory
*/
public ImageFormat image_format;
public override string ToString()
{
return $"width:{width} \n " +
$"height:{height}\n" +
$"mipmaps:{mipmaps}\n" +
$"image_format:{(int)image_format} \n" +
$"channel_order:{(int)channel_order}";
}
}
[StructLayout(LayoutKind.Sequential)]
internal struct NativeData
{
/** @brief Type descriptor of the data value */
public ValueType ValueType;
/** @brief Descriptor of whether the data is for inputs or outputs */
public DataType DataType;
/** @brief Data index that this is associated with, either of the input
if it is input data, or of the output if it is output/result
data. */
public IntPtr Index;
/** @brief Internal data, of which the valid type is determined by
the value_type member.*/
public DataInternalNumeric Data;
}
} // namespace Adobe.Substance

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df487c43ab54e7e4eaaf4c48d091656b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Adobe.Substance
{
[StructLayout(LayoutKind.Sequential)]
internal struct NativeInputVisibility
{
public IntPtr Index;
public IntPtr IsVisible;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 074a7ebe4a960264d9ade0ce2e8404b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Adobe.Substance
{
internal static class NativeConsts
{
public const uint UseDefault = ~0u;
}
[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct NativeOutputFormatComponent
{
[FieldOffset(0)]
public uint outputIndex;
[FieldOffset(4)]
public ShuffleIndex ShuffleIndex;
[FieldOffset(8)]
public float levelMin;
[FieldOffset(12)]
public float levelMax;
public static NativeOutputFormatComponent CreateDefault()
{
return new NativeOutputFormatComponent
{
outputIndex = NativeConsts.UseDefault,
levelMin = NativeConsts.UseDefault,
levelMax = NativeConsts.UseDefault
};
}
}
[StructLayout(LayoutKind.Explicit, Size = 84)]
internal struct NativeOutputFormat
{
[FieldOffset(0)]
public uint format;
[FieldOffset(4)]
public uint mipmapLevelsCount;
[FieldOffset(8)]
public HVFlip hvFlip;
[FieldOffset(12)]
public uint forceWidth;
[FieldOffset(16)]
public uint forceHeight;
[FieldOffset(20)]
public NativeOutputFormatComponent ChannelComponent0;
[FieldOffset(36)]
public NativeOutputFormatComponent ChannelComponent1;
[FieldOffset(52)]
public NativeOutputFormatComponent ChannelComponent2;
[FieldOffset(68)]
public NativeOutputFormatComponent ChannelComponent3;
public static NativeOutputFormat CreateDefault()
{
return new NativeOutputFormat
{
format = NativeConsts.UseDefault,
mipmapLevelsCount = NativeConsts.UseDefault,
hvFlip = HVFlip.SBSARIO_HVFLIP_NO,
forceWidth = NativeConsts.UseDefault,
forceHeight = NativeConsts.UseDefault,
ChannelComponent0 = NativeOutputFormatComponent.CreateDefault(),
ChannelComponent1 = NativeOutputFormatComponent.CreateDefault(),
ChannelComponent2 = NativeOutputFormatComponent.CreateDefault(),
ChannelComponent3 = NativeOutputFormatComponent.CreateDefault()
};
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80e96a42636b99049accabcee0d069dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
[StructLayout(LayoutKind.Sequential)]
internal struct NativePhysicalSize
{
public float X;
public float Y;
public float Z;
}
} // namespace Adobe.Substance

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4897bada61d9a4ba3b55b9f20fe445cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Adobe.Substance
{
/// <summary>
/// Struct for handlign sending and receiving preset XML from native to managed code.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct NativePreset
{
public IntPtr XMLString;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 16bd92bd193ee9044b52b3607ef613c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Adobe.Substance
{
[StructLayout(LayoutKind.Sequential)]
internal struct NativeThumbnail
{
public IntPtr Size;
public IntPtr Data;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 219b8713c6f86934ba2bb9d9d3cb18f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,88 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Adobe.Substance
{
//! @brief Numeric type union
//! @note The size will need to be changed if the API
[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct NumericDescriptValue
{
[FieldOffset(0)]
public int mIntData0;
[FieldOffset(4)]
public int mIntData1;
[FieldOffset(8)]
public int mIntData2;
[FieldOffset(12)]
public int mIntData3;
[FieldOffset(0)]
public float mFloatData0;
[FieldOffset(4)]
public float mFloatData1;
[FieldOffset(8)]
public float mFloatData2;
[FieldOffset(12)]
public float mFloatData3;
}
//! @brief Managed representation of the native sbsario input desc type
[StructLayout(LayoutKind.Sequential)]
internal struct NativeNumericInputDesc
{
public IntPtr index;
/** @brief Unique string identifier for x axis of a vector input. ('X' if nullptr) */
public IntPtr xLabel;
/** @brief Unique string identifier for y axis of a vector input. ('Y' if nullptr) */
public IntPtr yLabel;
/** @brief Unique string identifier for z axis of a vector input. ('Z' if nullptr) */
public IntPtr zLabel;
/** @brief Unique string identifier for w axis of a vector input. ('W' if nullptr) */
public IntPtr wLabel;
/** @brief Unique string identifier for the false state of a bool int. */
public IntPtr LabelFalse;
/** @brief Unique string identifier for the true state of a bool int. */
public IntPtr LabelTrue;
/** @brief Step to be used for a slider input. */
public float sliderStep;
/** @brief Bool value that determs if the slider must clamp. */
public IntPtr sliderClamp;
/** @brief Internal data, of which the valid type is determined by
the value_type member.
*/
public NumericDescriptValue default_value;
public NumericDescriptValue min_value;
public NumericDescriptValue max_value;
public IntPtr enumValueCount;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NativeEnumInputDesc
{
public IntPtr label;
public NumericDescriptValue value;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab2bb5d412dd1684ab655586f81aa0e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
//! @brief Managed representation of the native sbsario graph descriptor structure
[StructLayout(LayoutKind.Sequential)]
internal struct NativeGraphDesc
{
//! @brief Unique string label of the graph
public IntPtr mLabel;
//! @brief Description set for the graph
public IntPtr mDescription;
//! @brief Category of the graph
public IntPtr mCategory;
//! @brief Semicolon separated list of keywords
public IntPtr mKeywords;
//! @brief Graph author
public IntPtr mAuthor;
//! @brief Graph author website url
public IntPtr mAuthorUrl;
//! @brief Graph user data
public IntPtr mUserTag;
}
} // namespace Adobe.Substance

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34e809fb674bca84f86309e85e7595fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
//! @brief Managed representation of the native sbsario input desc type
[StructLayout(LayoutKind.Sequential)]
internal struct NativeInputDesc
{
//! @brief Unique string identifier of the input
public IntPtr mIdentifier;
//! @brief Display label of the input
public IntPtr mLabel;
//! @brief Gui group of the input.
public IntPtr GuiGroup;
//! @brief Description of the input.
public IntPtr GuiDescription;
//! @brief GUI visibility condition.
public IntPtr GuiVisibleIf;
//! @brief Index of the input
public IntPtr mIndex;
//! @brief Type of widget used for the input
public IntPtr inputWidgetType;
//! @brief Type of the input
public IntPtr mValueType;
}
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66f8f0c2765100b4ea04428bb0b07a05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using System;
using System.Runtime.InteropServices;
namespace Adobe.Substance
{
//! @brief Managed representation of the native sbsario output desc type
[StructLayout(LayoutKind.Sequential)]
internal struct NativeOutputDesc
{
//! @brief Unique string identifier of the output
public IntPtr mIdentifier;
//! @brief Display label for the output
public IntPtr mLabel;
//! @brief Index of the output
public UIntPtr mIndex;
//! @brief Image output format.
public IntPtr mFormat;
//! @brief Type of the output
public ValueType mValueType;
//! @brief Default usage for the output
public IntPtr mChannelUsage;
}
} // namespace Alg.Sbsario

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b408381e48fca754193e7e75bc35e594
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: