Exemplo n.º 1
0
        int?GetMaterial(RenderMaterial material, RhinoObject rhinoObject)
        {
            if (!options.ExportMaterials)
            {
                return(null);
            }

            if (material == null && options.UseDisplayColorForUnsetMaterials)
            {
                Color4f objectColor = GetObjectColor(rhinoObject);
                return(CreateSolidColorMaterial(objectColor));
            }
            else if (material == null)
            {
                material = Rhino.DocObjects.Material.DefaultMaterial.RenderMaterial;
            }

            Guid materialId = material.Id;

            if (!materialsMap.TryGetValue(materialId, out int materialIndex))
            {
                RhinoMaterialGltfConverter materialConverter = new RhinoMaterialGltfConverter(options, binary, dummy, binaryBuffer, material, workflow);
                materialIndex = materialConverter.AddMaterial();
                materialsMap.Add(materialId, materialIndex);
            }

            return(materialIndex);
        }
Exemplo n.º 2
0
        int GetMaterial(Rhino.DocObjects.Material material, Guid materialId)
        {
            if (!materialsMap.TryGetValue(materialId, out int materialIndex))
            {
                RhinoMaterialGltfConverter materialConverter = new RhinoMaterialGltfConverter(options, dummy, binaryBuffer, material, workflow);
                materialIndex = materialConverter.AddMaterial();
                materialsMap.Add(materialId, materialIndex);
            }

            return(materialIndex);
        }