mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-25 04:12:29 -05:00
Rename GltfBufferWriter to ExportingGltfData
This commit is contained in:
@@ -101,7 +101,7 @@ namespace UniGLTF
|
||||
}
|
||||
|
||||
var gltf = new glTF();
|
||||
GltfBufferWriter writer = default;
|
||||
ExportingGltfData writer = default;
|
||||
using (var exporter = new gltfExporter(gltf, Settings))
|
||||
{
|
||||
exporter.Prepare(State.ExportRoot);
|
||||
|
||||
@@ -5,13 +5,13 @@ using UniJSON;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public class GltfBufferWriter
|
||||
public class ExportingGltfData
|
||||
{
|
||||
readonly glTF _gltf;
|
||||
|
||||
public glTF GLTF => _gltf;
|
||||
|
||||
public GltfBufferWriter(glTF gltf, int reserved = default)
|
||||
public ExportingGltfData(glTF gltf, int reserved = default)
|
||||
{
|
||||
if (reserved == 0)
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d36812806fac1f041af501f1d2ad2dbb
|
||||
guid: 8c397b99fe3e0db4fa7a25dc63fff6af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -7,7 +7,7 @@ namespace UniGLTF
|
||||
{
|
||||
public static class BlendShapeExporter
|
||||
{
|
||||
public static gltfMorphTarget Export(GltfBufferWriter w, Vector3[] positions, Vector3[] normals, bool useSparse)
|
||||
public static gltfMorphTarget Export(ExportingGltfData w, Vector3[] positions, Vector3[] normals, bool useSparse)
|
||||
{
|
||||
var accessorCount = positions.Length;
|
||||
if (normals != null && positions.Length != normals.Length)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace UniGLTF
|
||||
m_normals[index] = normal;
|
||||
}
|
||||
|
||||
public gltfMorphTarget ToGltf(GltfBufferWriter w, bool useNormal, bool useSparse)
|
||||
public gltfMorphTarget ToGltf(ExportingGltfData w, bool useNormal, bool useSparse)
|
||||
{
|
||||
return BlendShapeExporter.Export(w,
|
||||
m_positions,
|
||||
@@ -103,7 +103,7 @@ namespace UniGLTF
|
||||
m_weights.Add(new Vector4(boneWeight.weight0, boneWeight.weight1, boneWeight.weight2, boneWeight.weight3));
|
||||
}
|
||||
|
||||
public glTFPrimitives ToGltfPrimitive(GltfBufferWriter w, int materialIndex, IEnumerable<int> indices)
|
||||
public glTFPrimitives ToGltfPrimitive(ExportingGltfData w, int materialIndex, IEnumerable<int> indices)
|
||||
{
|
||||
var indicesAccessorIndex = w.ExtendBufferAndGetAccessorIndex(indices.Select(x => (uint)m_vertexIndexMap[x]).ToArray(), glBufferTarget.ELEMENT_ARRAY_BUFFER);
|
||||
var positions = m_positions.ToArray();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace UniGLTF
|
||||
/// <param name="axisInverter"></param>
|
||||
/// <param name="settings"></param>
|
||||
/// <returns></returns>
|
||||
public static (glTFMesh, Dictionary<int, int>) Export(GltfBufferWriter w,
|
||||
public static (glTFMesh, Dictionary<int, int>) Export(ExportingGltfData w,
|
||||
MeshExportInfo unityMesh, List<Material> unityMaterials,
|
||||
IAxisInverter axisInverter, GltfExportSettings settings)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace UniGLTF
|
||||
/// <param name="axisInverter"></param>
|
||||
/// <param name="settings"></param>
|
||||
/// <returns></returns>
|
||||
public static (glTFMesh, Dictionary<int, int> blendShapeIndexMap) Export(GltfBufferWriter w,
|
||||
public static (glTFMesh, Dictionary<int, int> blendShapeIndexMap) Export(ExportingGltfData w,
|
||||
MeshExportInfo unityMesh, List<Material> unityMaterials,
|
||||
IAxisInverter axisInverter, GltfExportSettings settings)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ namespace UniGLTF
|
||||
return useSparse;
|
||||
}
|
||||
|
||||
static gltfMorphTarget ExportMorphTarget(GltfBufferWriter w,
|
||||
static gltfMorphTarget ExportMorphTarget(ExportingGltfData w,
|
||||
Mesh mesh, int blendShapeIndex,
|
||||
bool useSparseAccessorForMorphTarget,
|
||||
bool exportOnlyBlendShapePosition,
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace UniGLTF
|
||||
/// <param name="bufferIndex"></param>
|
||||
/// <param name="texture"></param>
|
||||
/// <returns>gltf texture index</returns>
|
||||
public static int PushGltfTexture(GltfBufferWriter w, Texture2D texture, ColorSpace textureColorSpace, ITextureSerializer textureSerializer)
|
||||
public static int PushGltfTexture(ExportingGltfData w, Texture2D texture, ColorSpace textureColorSpace, ITextureSerializer textureSerializer)
|
||||
{
|
||||
var bytesWithMime = textureSerializer.ExportBytesWithMime(texture, textureColorSpace);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace UniGLTF
|
||||
{
|
||||
protected glTF glTF;
|
||||
|
||||
protected GltfBufferWriter _writer;
|
||||
protected ExportingGltfData _writer;
|
||||
|
||||
public GameObject Copy
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace UniGLTF
|
||||
public gltfExporter(glTF gltf, GltfExportSettings settings)
|
||||
{
|
||||
glTF = gltf;
|
||||
_writer = new GltfBufferWriter(gltf);
|
||||
_writer = new ExportingGltfData (gltf);
|
||||
|
||||
glTF.extensionsUsed.AddRange(ExtensionUsed);
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace UniGLTF
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public virtual GltfBufferWriter Export(ITextureSerializer textureSerializer)
|
||||
public virtual ExportingGltfData Export(ITextureSerializer textureSerializer)
|
||||
{
|
||||
Nodes = Copy.transform.Traverse()
|
||||
.Skip(1) // exclude root object for the symmetry with the importer
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace UniGLTF
|
||||
name = "hogefuga",
|
||||
});
|
||||
|
||||
var parser = new GlbLowLevelParser("Test", new GltfBufferWriter(gltf).ToGlbBytes());
|
||||
var parser = new GlbLowLevelParser("Test", new ExportingGltfData (gltf).ToGlbBytes());
|
||||
var data = parser.Parse();
|
||||
|
||||
Assert.AreEqual("FooBar", data.GLTF.textures[0].name);
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace UniGLTF
|
||||
public void SharedVertexBufferTest()
|
||||
{
|
||||
var glTF = new glTF();
|
||||
var w = new GltfBufferWriter(glTF, 50 * 1024 * 1024);
|
||||
var w = new ExportingGltfData (glTF, 50 * 1024 * 1024);
|
||||
|
||||
var Materials = new List<Material>{
|
||||
new Material(Shader.Find("Standard")), // A
|
||||
@@ -167,7 +167,7 @@ namespace UniGLTF
|
||||
public void DividedVertexBufferTest()
|
||||
{
|
||||
var glTF = new glTF();
|
||||
var w = new GltfBufferWriter(glTF, 50 * 1024 * 1024);
|
||||
var w = new ExportingGltfData (glTF, 50 * 1024 * 1024);
|
||||
|
||||
var Materials = new List<Material>{
|
||||
new Material(Shader.Find("Standard")), // A
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace VRM
|
||||
// 出力
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
var gltf = new UniGLTF.glTF();
|
||||
GltfBufferWriter writer = default;
|
||||
ExportingGltfData writer = default;
|
||||
using (var exporter = new VRMExporter(gltf, settings.MeshExportSettings))
|
||||
{
|
||||
exporter.Prepare(target);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace VRM
|
||||
{
|
||||
public const Axes Vrm0xSpecificationInverseAxis = Axes.Z;
|
||||
|
||||
public static GltfBufferWriter Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer)
|
||||
public static ExportingGltfData Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer)
|
||||
{
|
||||
var gltf = new glTF();
|
||||
using (var exporter = new VRMExporter(gltf, configuration))
|
||||
|
||||
@@ -66,9 +66,8 @@ namespace UniVRM10
|
||||
/// <param name="gltfMesh"></param>
|
||||
/// <param name="option"></param>
|
||||
static IEnumerable<glTFPrimitives> ExportMeshDivided(this VrmLib.Mesh mesh, List<object> materials,
|
||||
GltfBufferWriter writer, ExportArgs option)
|
||||
ExportingGltfData writer, ExportArgs option)
|
||||
{
|
||||
var bufferIndex = 0;
|
||||
var usedIndices = new List<int>();
|
||||
var meshIndices = SpanLike.CopyFrom(mesh.IndexBuffer.GetAsIntArray());
|
||||
var positions = mesh.VertexBuffer.Positions.GetSpan<UnityEngine.Vector3>().ToArray();
|
||||
@@ -161,7 +160,7 @@ namespace UniVRM10
|
||||
/// <param name="storage"></param>
|
||||
/// <param name="option"></param>
|
||||
/// <returns></returns>
|
||||
public static glTFMesh ExportMeshGroup(this MeshGroup src, List<object> materials, GltfBufferWriter writer, ExportArgs option)
|
||||
public static glTFMesh ExportMeshGroup(this MeshGroup src, List<object> materials, ExportingGltfData writer, ExportArgs option)
|
||||
{
|
||||
var gltfMesh = new glTFMesh
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace UniVRM10
|
||||
return asset;
|
||||
}
|
||||
|
||||
public static IEnumerable<glTFMesh> ExportMeshes(List<MeshGroup> groups, List<object> materials, GltfBufferWriter w, ExportArgs option)
|
||||
public static IEnumerable<glTFMesh> ExportMeshes(List<MeshGroup> groups, List<object> materials, ExportingGltfData w, ExportArgs option)
|
||||
{
|
||||
foreach (var group in groups)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ using VrmLib;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public class Vrm10Storage : GltfBufferWriter
|
||||
public class Vrm10Storage : ExportingGltfData
|
||||
{
|
||||
UniGLTF.GltfData m_data;
|
||||
public UniGLTF.glTF Gltf => m_data.GLTF;
|
||||
|
||||
Reference in New Issue
Block a user