public GooBinaryRange(GooBinary pBinary, BinaryWriter pUnderlyingWriter, int pStart, int pLength) { _binary = pBinary; _writer = pUnderlyingWriter; Start = pStart; Length = pLength; }
public GooBinaryRange(GooBinary pBinary, BinaryWriter pUnderlyingWriter, int pStart, int pLength) { _binary = pBinary; _writer = pUnderlyingWriter; Start = pStart; Length = pLength; }
public void AddToBinary(GooBinary binary) { _binary = binary; foreach (var kvp in _boneChannels) { kvp.Value.AddToBinary(_binary); } }
public void AddToBinary(GooBinary binary) { mBinary = binary; SaveVertexBasics(); if (HasVertexColors) { SaveVertexColors(); } if (IsSkinned) { SaveSkinningData(); } SaveIndices(); }
public void AddToBinary(GooBinary pBinary) { PostprocessCurveData(); _transRange = pBinary.Add(_translationKeyframes); _scaleRange = pBinary.Add(_scaleKeyframes); _rotRange = pBinary.AllocateRange(sizeof(float) * 4 * _rotationKeyframes.Length); foreach (var rotQuat in _rotationKeyframes) { _rotRange.Write(rotQuat[0]); _rotRange.Write(rotQuat[1]); _rotRange.Write(rotQuat[2]); _rotRange.Write(rotQuat[3]); } _timesRange = pBinary.AllocateRange(sizeof(float) * _clip.KeyframeCount); for (int i = 0; i < _clip.KeyframeCount; ++i) { _timesRange.Write(_clip.GetTimeAtKeyframe(i)); } }
public void AddToBinary(GooBinary pBinary) { PostprocessCurveData(); _transRange = pBinary.Add(_translationKeyframes); _scaleRange = pBinary.Add(_scaleKeyframes); _rotRange = pBinary.AllocateRange(sizeof(float) * 4 * _rotationKeyframes.Length); foreach (var rotQuat in _rotationKeyframes) { _rotRange.Write(rotQuat[0]); _rotRange.Write(rotQuat[1]); _rotRange.Write(rotQuat[2]); _rotRange.Write(rotQuat[3]); } _timesRange = pBinary.AllocateRange(sizeof(float) * _clip.KeyframeCount); for (int i = 0; i < _clip.KeyframeCount; ++i) { _timesRange.Write(_clip.GetTimeAtKeyframe(i)); } }
public void AddToBinary(GooBinary binary) { mBinary = binary; SaveVertexBasics(); if (HasVertexColors) { SaveVertexColors(); } if (IsSkinned) { SaveSkinningData(); } SaveIndices(); }
public void AddToBinary(GooBinary binary) { _binary = binary; foreach (var kvp in _boneChannels) { kvp.Value.AddToBinary(_binary); } }
public override bool Export(GLexData data) { /* * // Uncomment this to re-enable settings validation. * // Right now it's just obnoxious and the results aren't used for anything. * if (!ValidateSettings()) { * return; * } */ _exportedFiles.Clear(); _exportQueue.Clear(); if (GLex.Instance.CleanDirectory) { AddExportAction("Cleaning output directory", () => CleanDirectory(GLexConfig.BasePath)); } // save project // AddExportAction("Exporting project", delegate { // StringTemplate projectTemplate = LoadTemplate("project"); // projectTemplate.SetAttribute("project", data.Project); // AddExportedJson(projectTemplate, data.Project.Id); // }); // environment AddExportAction("Exporting environment", delegate { var environment = data.Scene.Environment; var envTemplate = LoadTemplate("environment"); envTemplate.SetAttribute("env", environment); AddExportedJson(envTemplate, environment.Id); }); // save scene AddExportAction("Exporting scene", delegate { StringTemplate scene = LoadTemplate("scene"); scene.SetAttribute("entities", EnumerableUtil.Indexify(data.TopGameObjects)); scene.SetAttribute("scene", data.Scene); scene.SetAttribute("exporter", this); AddExportedJson(scene, data.Scene.Id); }); // save postfx AddExportAction("Exporting postfx", delegate { StringTemplate postfx = LoadTemplate("posteffects"); // postfx.SetAttribute("entities", EnumerableUtil.Indexify(data.GameObjects)); // postfx.SetAttribute("scene", data.Scene); // postfx.SetAttribute("exporter", this); AddExportedJson(postfx, "403694af24c54b6c93434ee2f8ce6f0b.posteffects"); }); // save entities foreach (var goConverter in data.GameObjects) { var exportedObject = goConverter; // Copy the reference AddExportAction(goConverter.Name, delegate { var entityTemplate = LoadTemplate("entity"); entityTemplate.SetAttribute("entity", exportedObject); entityTemplate.SetAttribute("components", exportedObject.Components); AddExportedJson(entityTemplate, exportedObject.Id); }); } // save materials foreach (var matConverter in data.Materials) { var exportedObject = matConverter; // Copy the reference AddExportAction(matConverter.Name, delegate { StringTemplate material = LoadTemplate("material"); material.SetAttribute("material", exportedObject); AddExportedJson(material, exportedObject.Id); }); } // save textures foreach (GLexTexture texConverter in data.Textures) { var exportedObject = texConverter; // Copy the reference AddExportAction(texConverter.Name, delegate { exportedObject.SaveBinaryData(); var texture = LoadTemplate("texture"); texture.SetAttribute("texture", exportedObject); AddExportedJson(texture, exportedObject.Id); }); } // save sounds foreach (var soundConverter in data.SoundClips) { var exportedObject = soundConverter; // Copy the reference AddExportAction(soundConverter.Name, delegate { exportedObject.SaveBinaryData(); var soundTemplate = LoadTemplate("sound"); soundTemplate.SetAttribute("sound", exportedObject); AddExportedJson(soundTemplate, exportedObject.Id); }); } // save meshes if (GLex.Instance.ExportMeshes) { var binary = new GooBinary(); var converters = new List <GooBinaryMesh>(); foreach (var glexMesh in data.Meshes) { converters.Add(new GooBinaryMesh(glexMesh)); } for (int i = 0; i < converters.Count; ++i) { var meshConverter = converters[i]; AddExportAction(meshConverter.Name + " (binary)", delegate { meshConverter.AddToBinary(binary); }); } AddExportAction("Saving mesh binaries", () => binary.SaveToDisk()); for (int i = 0; i < converters.Count; ++i) { foreach (var subMeshProxy in converters[i].SubMeshes) { var proxyCopy = subMeshProxy; AddExportAction(converters[i].Name + "#" + subMeshProxy.SubMeshIndex, delegate { StringTemplate mesh = LoadTemplate("mesh"); mesh.SetAttribute("mesh", proxyCopy); AddExportedJson(mesh, proxyCopy.Id); }); } } } // save skeletons ExportObjects(GooSkeleton.AllSkeletons, "skeleton", "skeleton"); // save animations ExportObjects(data.Animations, "animation", "animation"); // save states ExportObjects(data.AnimationStates, "animationState", "state"); // save clips var clipBinary = new GooBinary(); foreach (var glexClip in data.AnimationClips) { var exportedClip = glexClip; AddExportAction(exportedClip.Name, delegate { exportedClip.AddToBinary(clipBinary); }); } AddExportAction("Saving clip binaries", () => clipBinary.SaveToDisk()); foreach (var glexClip in data.AnimationClips) { var exportedClip = glexClip; AddExportAction(exportedClip.Name, delegate { var template = LoadTemplate("animationClip"); template.SetAttribute("clip", exportedClip); AddExportedJson(template, exportedClip.Id); }); } // skyboxes ExportObjects(GooSkybox.AllSkyboxes, "skybox", "skybox"); // Do it all if (!ExecuteExportActions()) { return(false); } // send to create or bundle if (GLex.Instance.UploadToCreate) { if (SaveExportedFilesAsBundle()) { SendToCreate(); } else { return(false); } } else if (GLex.Instance.BundleProject) { if (!SaveExportedFilesAsBundle()) { return(false); } else { // string directory = Path.Combine (GLexConfig.BasePath, "root.bundle"); // string zip = Path.Combine (GLexConfig.BasePath, GLexSceneSettings.FileName + ".zip"); string directory = GLexConfig.BasePathWithoutSceneName; string zip = GLexConfig.BasePathWithoutSceneName + "/bundle_" + GLexSceneSettings.FileName + ".zip"; Compress(directory, zip); } } else { SaveExportedFiles(); } // remove temporary components foreach (Component component in mComponentsToRemoveAfterExport) { UnityEngine.Object.DestroyImmediate(component); } foreach (var obj in mObjectsToRemoveAfterExport) { UnityEngine.Object.DestroyImmediate(obj); } return(true); }