Exemple #1
0
        public VFlashChannel(ReportErrorDelegate reportErrorDelegate, string flashProjectPath, uint channelId)
            : base(channelId)
        {
            Command = VFlashCommand.NoCommand;
            Status = VFlashStatus.Created;

            _reportErrorDelegate = reportErrorDelegate;
            _flashProjectPath = flashProjectPath;
            _projectHandle = -1;

            _progressPercentage = 0;
            _remainingTimeInSecs = 0;

            _result = false;

            _vFlashThread = new Thread(VectorBackgroundThread);
            _vFlashThread.SetApartmentState(ApartmentState.STA);
            _vFlashThread.IsBackground = true;
            _vFlashThread.Start();
        }
Exemple #2
0
 public static extern void ReportErrors(IntPtr scriptHandle, ReportErrorDelegate reportErrorCallback);
Exemple #3
0
 //--- vFlash Station Constructor ---
 internal VFlashStationController(ReportErrorDelegate reportErrorDelegate, uint id)
     : base(id)
 {
     _reportErrorDelegate = reportErrorDelegate;
 }
Exemple #4
0
        //static NxAssertResponse ReportAssertViolation( IntPtr pMessage, IntPtr pFile, int line )
        //{
        //   string message = Wrapper.GetOutString( pMessage );
        //   string file = Wrapper.GetOutString( pFile );
        //   if( file == null )
        //      file = "NULL";
        //   string text = string.Format( "PhysXPhysicsSystem: {0} ({1}:{2})", message, file, line );
        //   Log.Fatal( text );
        //   return NxAssertResponse.NX_AR_BREAKPOINT;
        //}
        protected override bool OnInitLibrary( bool allowHardwareAcceleration, bool editor )
        {
            instance = this;

            NativeLibraryManager.PreLoadLibrary( "PhysXNativeWrapper" );

            //change current directory for loading PhysX dlls from specified NativeDlls directory.
            string saveCurrentDirectory = null;
            if( PlatformInfo.Platform == PlatformInfo.Platforms.Windows )
            {
                saveCurrentDirectory = Directory.GetCurrentDirectory();
                Directory.SetCurrentDirectory( NativeLibraryManager.GetNativeLibrariesDirectory() );
            }

            try
            {
                preventLogErrors = true;

                reportErrorDelegate = ReportError;
                logDelegate = LogMessage;
                IntPtr errorStringPtr;
                if( !PhysXNativeWorld.Init( reportErrorDelegate, out errorStringPtr, logDelegate, skinWidth ) )
                {
                    string errorString = Wrapper.GetOutString( errorStringPtr );
                    if( string.IsNullOrEmpty( errorString ) )
                        errorString = "Unknown error.";
                    Log.Fatal( "PhysX: Initialization error: " + errorString );
                    return false;
                }

                preventLogErrors = false;
            }
            finally
            {
                //restore current directory
                if( PlatformInfo.Platform == PlatformInfo.Platforms.Windows )
                    Directory.SetCurrentDirectory( saveCurrentDirectory );
            }

            //configs
            if( VirtualFile.Exists( "Base/Constants/PhysicsSystem.config" ) )
            {
                TextBlock block = TextBlockUtils.LoadFromVirtualFile( "Base/Constants/PhysicsSystem.config" );
                if( block != null )
                {
                    TextBlock physXBlock = block.FindChild( "physXSpecific" );
                    if( physXBlock != null )
                    {
                        if( physXBlock.IsAttributeExist( "supportHeightFields" ) )
                            supportHeightFields = bool.Parse( physXBlock.GetAttribute( "supportHeightFields" ) );

                        if( physXBlock.IsAttributeExist( "supportVehicles" ) )
                            supportVehicles = bool.Parse( physXBlock.GetAttribute( "supportVehicles" ) );

                        if( physXBlock.IsAttributeExist( "writeCacheForCookedTriangleMeshes" ) )
                        {
                            writeCacheForCookedTriangleMeshes = bool.Parse(
                                physXBlock.GetAttribute( "writeCacheForCookedTriangleMeshes" ) );
                        }

                        if( physXBlock.IsAttributeExist( "mainSceneMaxThreads" ) )
                            mainSceneMaxThreads = int.Parse( physXBlock.GetAttribute( "mainSceneMaxThreads" ) );
                    }
                }
            }

            return true;
        }
Exemple #5
0
 public static extern void ReportErrors(IntPtr scriptHandle, ReportErrorDelegate reportErrorCallback);
Exemple #6
0
 public unsafe static extern bool Init(ReportErrorDelegate reportErrorDelegate, out IntPtr errorString,
                                       LogDelegate logDelegate, float cookingParamsSkinWidth);
Exemple #7
0
        public static unsafe extern bool Init( ReportErrorDelegate reportErrorDelegate, out IntPtr errorString,
			LogDelegate logDelegate, float cookingParamsSkinWidth );
Exemple #8
0
        //static NxAssertResponse ReportAssertViolation( IntPtr pMessage, IntPtr pFile, int line )
        //{
        //   string message = Wrapper.GetOutString( pMessage );
        //   string file = Wrapper.GetOutString( pFile );

        //   if( file == null )
        //      file = "NULL";
        //   string text = string.Format( "PhysXPhysicsSystem: {0} ({1}:{2})", message, file, line );

        //   Log.Fatal( text );

        //   return NxAssertResponse.NX_AR_BREAKPOINT;
        //}

        protected override bool OnInitLibrary(bool allowHardwareAcceleration, bool editor)
        {
            instance = this;

            NativeLibraryManager.PreLoadLibrary("PhysXNativeWrapper");

            //change current directory for loading PhysX dlls from specified NativeDlls directory.
            string saveCurrentDirectory = null;

            if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows)
            {
                saveCurrentDirectory = Directory.GetCurrentDirectory();
                Directory.SetCurrentDirectory(NativeLibraryManager.GetNativeLibrariesDirectory());
            }

            try
            {
                preventLogErrors = true;

                reportErrorDelegate = ReportError;
                logDelegate         = LogMessage;
                IntPtr errorStringPtr;
                if (!PhysXNativeWorld.Init(reportErrorDelegate, out errorStringPtr, logDelegate, skinWidth))
                {
                    string errorString = Wrapper.GetOutString(errorStringPtr);
                    if (string.IsNullOrEmpty(errorString))
                    {
                        errorString = "Unknown error.";
                    }
                    Log.Fatal("PhysX: Initialization error: " + errorString);
                    return(false);
                }

                preventLogErrors = false;
            }
            finally
            {
                //restore current directory
                if (PlatformInfo.Platform == PlatformInfo.Platforms.Windows)
                {
                    Directory.SetCurrentDirectory(saveCurrentDirectory);
                }
            }

            //configs
            if (VirtualFile.Exists("Base/Constants/PhysicsSystem.config"))
            {
                TextBlock block = TextBlockUtils.LoadFromVirtualFile("Base/Constants/PhysicsSystem.config");
                if (block != null)
                {
                    TextBlock physXBlock = block.FindChild("physXSpecific");
                    if (physXBlock != null)
                    {
                        if (physXBlock.IsAttributeExist("supportHeightFields"))
                        {
                            supportHeightFields = bool.Parse(physXBlock.GetAttribute("supportHeightFields"));
                        }

                        if (physXBlock.IsAttributeExist("supportVehicles"))
                        {
                            supportVehicles = bool.Parse(physXBlock.GetAttribute("supportVehicles"));
                        }

                        if (physXBlock.IsAttributeExist("writeCacheForCookedTriangleMeshes"))
                        {
                            writeCacheForCookedTriangleMeshes = bool.Parse(
                                physXBlock.GetAttribute("writeCacheForCookedTriangleMeshes"));
                        }

                        if (physXBlock.IsAttributeExist("mainSceneMaxThreads"))
                        {
                            mainSceneMaxThreads = int.Parse(physXBlock.GetAttribute("mainSceneMaxThreads"));
                        }
                    }
                }
            }

            return(true);
        }