public XElement serialize(CFurMeshResource 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);
        }
Example #2
0
        public XElement serialize(CFurMeshResource chunk)
        {
            var ret = NvidiaXML.CreateStructHeader("", "Ref", "HairSceneDescriptor", "1.0", checksum);

            ret.AddNvValue("numGuideHairs", "U32", chunk.BoneIndices.Count.ToString());
            ret.AddNvValue("numVertices", "U32", chunk.Positions.Count.ToString());
            ret.AddNvArray("vertices", "Vec3", "", Apex.FormatCoordinateArray(chunk.Positions)); //TODO: Check why this has wrong numbers. Its correct but the matrix needs to be changed somehow!
            var endindicies = chunk.EndIndices;

            ret.AddNvArray("endIndices", "U32", endindicies.Count.ToString(), endindicies.Aggregate("", (c, n) => c += " " + n));
            ret.AddNvValue("numFaces", "U32", ""); //TODO
            var faceIndices = chunk.FaceIndices;

            ret.AddNvArray("faceIndices", "U32", faceIndices.Count.ToString(), faceIndices.Aggregate("", (c, n) => c += " " + n));
            ret.AddNvArray("faceUVs", "Vec2", "", "");           //TODO
            ret.AddNvValue("numBones", "U32", chunk.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);
        }
Example #3
0
        /// <summary>
        /// Creates an XElement suitable for seralizing it in a apx file.
        /// </summary>
        /// <param name="objectcount"></param>
        /// <returns></returns>
        public XElement serialize(CFurMeshResource 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.GetEditableVariables().First(_ => _.REDName == "importFile").ToString());
            values.AddNvValue("authorName", "String", Environment.UserName);
            values.AddNvValue("lastModified", "String", ((CDateTime)apexChunk.GetEditableVariables().First(_ => _.REDName == "importFileTimeStamp")).DValue.ToString("f"));
            HairWorksInfo.Add(values);
            return(HairWorksInfo);
        }
Example #4
0
        public XElement serialize(CFurMeshResource chunk)
        {
            var ret = NvidiaXML.CreateStructHeader("", "Ref", "HairInstanceDescriptor", "1.0", checksum);
            var materialcontainer = new XElement("struct", new XAttribute("name", ""));

            var materialcount = chunk.Materials;
            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);
        }