示例#1
0
        public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo extInfo)
        {
            var babylonLight = babylonObject as BabylonNode;

            if (babylonLight != null)
            {
                GLTFExtensionAsoboMacroLight macroLightExt = new GLTFExtensionAsoboMacroLight();

                Guid guid = Guid.Empty;
                Guid.TryParse(babylonLight.id, out guid);
                IINode maxNode = Tools.GetINodeByGuid(guid);
                if (maxNode != null)
                {
                    IObject obj = maxNode.ObjectRef;
                    if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightOmniClassID))
                    {
                        exporter.logger?.RaiseCriticalError($"{maxNode.NodeName} is type of MacroLightOmni and it is DEPRECATED, use FlightSimLight");
                        return(null);
                    }
                    else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightSpotClassID))
                    {
                        exporter.logger?.RaiseCriticalError($"{maxNode.NodeName} is type of MacroLightSpot and it is DEPRECATED, use FlightSimLight");
                        return(null);
                    }
                    else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(FlightSimLightClassID))
                    {
                        macroLightExt.color          = GetColor(maxNode);
                        macroLightExt.intensity      = GetIntensity(maxNode);
                        macroLightExt.coneAngle      = GetConeAngle(maxNode);
                        macroLightExt.hasSimmetry    = GetHasSimmetry(maxNode);
                        macroLightExt.flashFrequency = GetFlashFrequency(maxNode);
                        macroLightExt.dayNightCycle  = GetDayNightCycle(maxNode);
                        macroLightExt.flashDuration  = GetFlashDuration(maxNode);
                        macroLightExt.flashPhase     = GetFlashPhase(maxNode);
                        macroLightExt.rotationSpeed  = GetRotationSpeed(maxNode);
                        return(macroLightExt);
                    }
                }
            }
            return(null);
        }
示例#2
0
        public object ExportGLTFExtension <T>(T babylonObject, ExportParameters parameters, ref GLTF gltf, ILoggingProvider logger)
        {
            var babylonLight = babylonObject as BabylonNode;

            if (babylonLight != null)
            {
                GLTFExtensionAsoboMacroLight macroLightExt = new GLTFExtensionAsoboMacroLight();

                Guid guid = Guid.Empty;
                Guid.TryParse(babylonLight.id, out guid);
                IINode maxNode = Tools.GetINodeByGuid(guid);
                if (maxNode != null)
                {
                    IObject obj = maxNode.ObjectRef;
                    if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightOmniClassID))
                    {
                        logger.RaiseError($"{maxNode.NodeName} is type of MacroLightOmni and it is DEPRECATED, use MACROLIGHT");
                        return(null);
                    }
                    else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightSpotClassID))
                    {
                        //string macroLightValue = maxNode.GetStringProperty("flightsim_macro_light_type", FlightSimLightExtension.MacroLight.Keys.ElementAt(0));
                        //string macroLightType = FlightSimLightExtension.MacroLight[macroLightValue];
                        //macroLightExt.macroLightType = macroLightType;

                        //return macroLightExt;

                        macroLightExt.color       = GetColor(maxNode);
                        macroLightExt.intensity   = GetIntensity(maxNode);
                        macroLightExt.coneAngle   = GetConeAngle(maxNode);
                        macroLightExt.hasSimmetry = GetHasSimmetry(maxNode);
                        macroLightExt.isBeacon    = GetIsBeacon(maxNode);
                        return(macroLightExt);
                    }
                }
            }
            return(null);
        }