public XElement serialize(CR2WChunk apexChunk) { var ret = NvidiaXML.CreateStructHeader("", "Ref", "HairSceneDescriptor", "1.0", checksum); var values = new XElement("struct", new XAttribute("name", "")); //TODO: Check when these should be null! values.AddNvValue("densityTexture", "String", ""); values.AddNvValue("rootColorTexture", "String", ""); values.AddNvValue("tipColorTexture", "String", ""); values.AddNvValue("widthTexture", "String", ""); values.AddNvValue("rootWidthTexture", "String", ""); values.AddNvValue("tipWidthTexture", "String", ""); values.AddNvValue("stiffnessTexture", "String", ""); values.AddNvValue("rootStiffnessTexture", "String", ""); values.AddNvValue("clumpScaleTexture", "String", ""); values.AddNvValue("clumpRoundnessTexture", "String", ""); values.AddNvValue("clumpNoiseTexture", "String", ""); values.AddNvValue("waveScaletexture", "String", ""); values.AddNvValue("waveFreqTexture", "String", ""); values.AddNvValue("strandTexture", "String", ""); values.AddNvValue("lengthTexture", "String", ""); values.AddNvValue("specularTexture", "String", ""); ret.Add(values); return(ret); }
public XElement serialize(CR2WChunk chunk) { var ret = NvidiaXML.CreateStructHeader("", "Ref", "HairSceneDescriptor", "1.0", checksum); ret.AddNvValue("numGuideHairs", "U32", ((CArray)chunk.GetVariableByName("boneIndices")).array.Count.ToString()); ret.AddNvValue("numVertices", "U32", ((CArray)chunk.GetVariableByName("positions")).array.Count.ToString()); ret.AddNvArray("vertices", "Vec3", "", Apex.FormatCoordinateArray((CArray)chunk.GetVariableByName("positions"))); //TODO: Check why this has wrong numbers. Its correct but the matrix needs to be changed somehow! var endindicies = ((CArray)chunk.GetVariableByName("endIndices")).array; ret.AddNvArray("endIndices", "U32", endindicies.Count.ToString(), endindicies.Aggregate("", (c, n) => c += " " + n)); ret.AddNvValue("numFaces", "U32", ""); //TODO var faceIndices = ((CArray)chunk.GetVariableByName("faceIndices")).array; ret.AddNvArray("faceIndices", "U32", faceIndices.Count.ToString(), faceIndices.Aggregate("", (c, n) => c += " " + n)); ret.AddNvArray("faceUVs", "Vec2", "", ""); //TODO ret.AddNvValue("numBones", "U32", chunk.GetVariableByName("boneCount").ToString()); ret.AddNvArray("boneIndices", "Vec4", "", ""); //TODO ret.AddNvArray("boneWeights", "Vec4", "", ""); //TODO ret.AddNvArray("boneNames", "U8", "", ""); //TODO ret.AddNvArray("boneNameList", "String", "", ""); //TODO ret.AddNvArray("bindPoses", "Mat44", "", ""); //TODO ret.AddNvArray("boneParents", "I32", "", ""); //TODO ret.AddNvValue("numBoneSpheres", "U32", ""); //TODO ret.AddNvArray("boneSpheres", "Struct", "", ""); //TODO: Fix AddnVarray(); structElements?? ret.AddNvValue("numBoneCapsules", "U32", ""); //TODO ret.AddNvArray("boneCapsuleIndices", "U32", "", ""); //TODO ret.AddNvValue("numPinConstraints", "U32", ""); //TODO ret.AddNvArray("pinConstraints", "Struct", "", ""); //TODO: Fix AddnVarray(); structElements?? ret.AddNvValue("sceneUnit", "F32", ""); //TODO ret.AddNvValue("upAxis", "U32", ""); //TODO ret.AddNvValue("handedness", "U32", ""); //TODO return(ret); }
/// <summary> /// Creates an XElement suitable for seralizing it in a apx file. /// </summary> /// <param name="objectcount"></param> /// <returns></returns> public XElement serialize(CR2WChunk apexChunk, int objectcount) { var HairWorksInfo = NvidiaXML.CreateStructHeader("", "Ref", "HairWorksInfo", "1.0", checksum); var values = new XElement("struct", new XAttribute("name", "")); values.AddNvValue("fileVersion", "String", "1.0"); values.AddNvValue("toolVersion", "String", "WolvenKit"); values.AddNvValue("sourcePath", "String", apexChunk.GetVariableByName("importFile").ToString()); values.AddNvValue("authorName", "String", Environment.UserName); values.AddNvValue("lastModified", "String", ((CDateTime)apexChunk.GetVariableByName("importFileTimeStamp")).Date.ToString("f")); HairWorksInfo.Add(values); return(HairWorksInfo); }
public XElement serialize(CR2WChunk chunk) { var ret = NvidiaXML.CreateStructHeader("", "Ref", "HairInstanceDescriptor", "1.0", checksum); var materialcontainer = new XElement("struct", new XAttribute("name", "")); var materialcount = new List <CArray>(); //TODO: Get the actual mats var structs = new List <XElement>(); foreach (var mat in materialcount) { var structelem = new XElement("struct"); //TODO: Write the actual values! structs.Add(structelem); } materialcontainer.AddNvArray("materials", "Struct", structs.Count.ToString(), structs); ret.Add(materialcontainer); return(ret); }