Implement Burst compiled importer
This commit is contained in:
@@ -133,6 +133,10 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.size
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
@@ -147,6 +151,10 @@ PrefabInstance:
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Name
|
||||
value: ScaleMultiplier
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Name
|
||||
value: OpacityMultiplier
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Value
|
||||
value: 200000
|
||||
@@ -157,7 +165,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Value
|
||||
value: 32
|
||||
value: 64
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Value
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Name
|
||||
value: GradientScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Overridden
|
||||
@@ -171,6 +187,62 @@ PrefabInstance:
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Overridden
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Overridden
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Overridden
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.atime0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.atime1
|
||||
value: 65535
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.ctime0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.ctime1
|
||||
value: 65535
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.a
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.b
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.g
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.r
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_Mode
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_ColorSpace
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_NumAlphaKeys
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_NumColorKeys
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -774367247743995920, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
|
||||
@@ -287,8 +287,6 @@ namespace SplatVfx.Editor
|
||||
splatData.RotationArray[totalElemsRead + i] = new quaternion(splatDataNative.rotation[i]);
|
||||
}
|
||||
|
||||
// NativeArray<Vector3>.Copy(splatDataNative.position.Reinterpret<Vector3>(), 0, splatData.PositionArray, totalElemsRead, numElemsRead);
|
||||
|
||||
totalElemsRead += numElemsRead;
|
||||
Debug.Log($"Current Elements Read: {totalElemsRead}");
|
||||
}
|
||||
@@ -341,7 +339,7 @@ namespace SplatVfx.Editor
|
||||
splatDataNative.sh[elemIx + j] = chunkBytes[start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + j]];
|
||||
}
|
||||
|
||||
float opacity = chunkBytes[start + headerData.ElementByteOffsets[(int)DataEnum.opacity]];
|
||||
float opacity = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.opacity]);
|
||||
opacity = 1 / (1 + math.exp(-opacity));
|
||||
splatDataNative.opacity[elemIx] = opacity;
|
||||
|
||||
@@ -365,35 +363,6 @@ namespace SplatVfx.Editor
|
||||
}
|
||||
}
|
||||
|
||||
// private struct ReadChunkJob
|
||||
|
||||
/***********************************************************************
|
||||
ImportData function
|
||||
- Takes a HeaderData struct and file path string as input
|
||||
- Following the JOB_SZ and the length of a single element's data
|
||||
-- Computes how many bytes a single job can process
|
||||
-- Reads them in chunks
|
||||
-- As each chunk is read
|
||||
--- Creates NativeArrays representing all the data points
|
||||
--- Creates a ReadChunk Jobs to parse the data
|
||||
- Once each Job is complete, begins copying the NativeArrays into a
|
||||
newly created SplatData scriptable object
|
||||
***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
ReadChunk Job
|
||||
- This MUST be Burst compiled
|
||||
- Takes in NativeArrays, the chunk's byte data, and the HeaderData
|
||||
struct
|
||||
- It may be more efficient to place the NativeArrays inside a Burst
|
||||
compiled struct
|
||||
- Iterates through the byte data using the total length of a data point
|
||||
as stored in HeaderData
|
||||
- For each data point, reads the data points and stores them into the
|
||||
appropriate NativeArray, referencing the byte offset table in
|
||||
HeaderData to find their locations in the byte data
|
||||
***********************************************************************/
|
||||
|
||||
SplatData ImportAsSplatData((string format, int num_element, List<(string, string)> properties) header_info, byte[] binaryData)
|
||||
{
|
||||
var splatData = ScriptableObject.CreateInstance<SplatData>();
|
||||
|
||||
@@ -797,7 +797,7 @@ MonoBehaviour:
|
||||
m_UICollapsed: 0
|
||||
m_UISuperCollapsed: 0
|
||||
m_InputSlots:
|
||||
- {fileID: 8926484042661618395}
|
||||
- {fileID: 8926484042661619458}
|
||||
- {fileID: 8926484042661614618}
|
||||
m_OutputSlots: []
|
||||
m_Label:
|
||||
@@ -6171,7 +6171,9 @@ MonoBehaviour:
|
||||
- m_Id: 0
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661618390}
|
||||
inputSlot: {fileID: 8926484042661618395}
|
||||
inputSlot: {fileID: 0}
|
||||
- outputSlot: {fileID: 8926484042661618390}
|
||||
inputSlot: {fileID: 8926484042661619458}
|
||||
position: {x: 533, y: 1299}
|
||||
expandedSlots: []
|
||||
expanded: 1
|
||||
@@ -6210,42 +6212,7 @@ MonoBehaviour:
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_Direction: 1
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661618395}
|
||||
--- !u!114 &8926484042661618395
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76f778ff57c4e8145b9681fe3268d8e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.VisualEffectGraph.Editor::UnityEditor.VFX.VFXSlotGradient
|
||||
m_UIIgnoredErrors: []
|
||||
m_Parent: {fileID: 0}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 0, y: 0}
|
||||
m_UICollapsed: 1
|
||||
m_UISuperCollapsed: 0
|
||||
m_MasterSlot: {fileID: 8926484042661618395}
|
||||
m_MasterData:
|
||||
m_Owner: {fileID: 8926484042661614617}
|
||||
m_Value:
|
||||
m_Type:
|
||||
m_SerializableType: UnityEngine.Gradient, UnityEngine.CoreModule, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_SerializableObject: '{"colorKeys":[{"color":{"r":0.0,"g":0.0,"b":0.0,"a":1.0},"time":0.0},{"color":{"r":0.75,"g":0.15000000596046449,"b":0.0,"a":1.0},"time":0.3000076413154602},{"color":{"r":1.25,"g":0.5600000023841858,"b":0.11999999731779099,"a":1.0},"time":0.5000076293945313},{"color":{"r":3.5,"g":2.0,"b":0.5,"a":1.0},"time":0.7000076174736023},{"color":{"r":4.0,"g":3.5,"b":1.2000000476837159,"a":1.0},"time":0.9000076055526733},{"color":{"r":12.0,"g":10.0,"b":2.5,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":0.0,"time":0.0},{"alpha":1.0,"time":1.0}],"gradientMode":0}'
|
||||
m_Space: -1
|
||||
m_Property:
|
||||
name: gradient
|
||||
m_serializedType:
|
||||
m_SerializableType: UnityEngine.Gradient, UnityEngine.CoreModule, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661618390}
|
||||
- {fileID: 8926484042661619458}
|
||||
--- !u!114 &8926484042661618746
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -16782,3 +16749,38 @@ MonoBehaviour:
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 0
|
||||
m_LinkedSlots: []
|
||||
--- !u!114 &8926484042661619458
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76f778ff57c4e8145b9681fe3268d8e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.VisualEffectGraph.Editor::UnityEditor.VFX.VFXSlotGradient
|
||||
m_UIIgnoredErrors: []
|
||||
m_Parent: {fileID: 0}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 0, y: 0}
|
||||
m_UICollapsed: 1
|
||||
m_UISuperCollapsed: 0
|
||||
m_MasterSlot: {fileID: 8926484042661619458}
|
||||
m_MasterData:
|
||||
m_Owner: {fileID: 8926484042661614617}
|
||||
m_Value:
|
||||
m_Type:
|
||||
m_SerializableType: UnityEngine.Gradient, UnityEngine.CoreModule, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_SerializableObject: '{"colorKeys":[{"color":{"r":0.0,"g":0.0,"b":0.0,"a":1.0},"time":0.0},{"color":{"r":0.75,"g":0.15000000596046449,"b":0.0,"a":1.0},"time":0.3000076413154602},{"color":{"r":1.25,"g":0.5600000023841858,"b":0.11999999731779099,"a":1.0},"time":0.5000076293945313},{"color":{"r":3.5,"g":2.0,"b":0.5,"a":1.0},"time":0.7000076174736023},{"color":{"r":4.0,"g":3.5,"b":1.2000000476837159,"a":1.0},"time":0.9000076055526733},{"color":{"r":12.0,"g":10.0,"b":2.5,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":0.0,"time":0.0},{"alpha":1.0,"time":1.0}],"gradientMode":0}'
|
||||
m_Space: -1
|
||||
m_Property:
|
||||
name: gradient
|
||||
m_serializedType:
|
||||
m_SerializableType: UnityEngine.Gradient, UnityEngine.CoreModule, Version=0.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661618390}
|
||||
|
||||
Reference in New Issue
Block a user