//============================================================ public void LoadResource(FDxRsTemplate resource) { //............................................................ // 加载材质列表 int materialCount = resource.Materials.Count; for (int n = 0; n < materialCount; n++) { // 创建几何体 FDxRsTemplateMaterial rsMaterial = resource.Materials[n]; FDxSpatialMaterial material = new FDxSpatialMaterial(); material.Device = _device; material.LoadResource(rsMaterial); // 增加渲染对象 _materials.Set(material.Name, material); } //............................................................ // 加载渲染列表 int renderableCount = resource.Renderables.Count; for (int n = 0; n < renderableCount; n++) { // 创建几何体 FDxRsTemplateRenderable rsRenderable = resource.Renderables[n]; FDxGeometry geometry = RDxCore.GeometryConsole.Create(_device, rsRenderable.ModelCode, rsRenderable.GeometryName); geometry.Display = this; geometry.LoadRenderable(rsRenderable); _geometries.Push(geometry); // 设置材质 FDxSpatialMaterial material = _materials.Get(rsRenderable.MaterialCode); geometry.ModelMaterial = material; // 增加渲染对象 _renderables.Push(geometry); } }
//============================================================ public void LoadResource(FDxRsTemplateMaterial resource) { _name = resource.Code; // 加载纹理 int textureCount = resource.Textures.Count; for (int n = 0; n < textureCount; n++) { //FDxRsTemplateTexture rsTexture = resource.Textures[n]; //FDxModelTexture texture = new FDxModelTexture(); //texture.Device = _device; //texture.LoadResource(rsTexture); //_textures.Push(texture); } }
//============================================================ public void LoadResource(FDxRsTemplateMaterial resource) { _name = resource.Code; // 加载颜色 _ambientColor.Assign(resource.AmbientColor); _diffuseColor.Assign(resource.DiffuseColor); _specularColor.Assign(resource.SpecularColor); // 加载纹理 int textureCount = resource.Textures.Count; for (int n = 0; n < textureCount; n++) { FDxRsTemplateTexture rsTexture = resource.Textures[n]; FDxSpatialTexture texture = new FDxSpatialTexture(); texture.Device = _device; texture.LoadResource(rsTexture); _textures.Push(texture); } }