//============================================================ public void Unserialize(IInput input) { _name = input.ReadString(); //............................................................ // 读取材质列表 int materialCount = input.ReadInt16(); for (int n = 0; n < materialCount; n++) { FDxRsTemplateMaterial material = new FDxRsTemplateMaterial(); material.Template = this; material.Unserialize(input); _materials.Set(material.Code, material); } //............................................................ // 读取材质列表 int renderableCount = input.ReadInt16(); for (int n = 0; n < renderableCount; n++) { FDxRsTemplateRenderable renderable = new FDxRsTemplateRenderable(); renderable.Template = this; renderable.Unserialize(input); //_logger.Debug(this, "LoadFile", "Load renderable. (loop={0}/{1}, model={2}({3}, material={4})", // n, renderableCount, renderable.ModelCode, renderable.GeometryName, renderable.MaterialCode); _renderables.Push(renderable); } }
//============================================================ public void Unserialize(IInput input) { // 读取设置 _id = input.ReadInt32(); _modelCode = input.ReadString(); _geometryName = input.ReadString(); _materialCode = input.ReadString(); // 存储矩阵 _originMatrix.Unserialize(input); _worldMatrix.Unserialize(input); // 读取模型 _model = RDxCore.ModelResourceConsole.Get(_modelCode); _geometry = _model.Mesh.Geometries.Get(_geometryName); _material = _template.Materials.Get(_materialCode); }