public override IntPtr LoadLibrary(string path) { path = VirtualFileSystem.MakePathRelative(path); IntPtr result = LoadPackagedLibrary(path, 0); if (result == IntPtr.Zero) { Debug.Fail("library loading error" + "\r\nError: " + DebugUtil.GetLastErrorStr()); } return(result); }
unsafe static bool InitInternal(bool startedAtFullScreen, bool multiMonitorMode, string fontManagerDefaultLanguage) //, bool isEditor )//, Vec2I mainRenderTargetSize ) { OgreNativeWrapper.CheckNativeBridge((int)ParameterType.TextureCube); // GpuProgramParameters.GetAutoConstantTypeCount() ); //!!!!new UWP var path = VirtualFileSystem.Directories.PlatformSpecific; if (SystemSettings.CurrentPlatform == SystemSettings.Platform.UWP) { path = VirtualFileSystem.MakePathRelative(path); } Vector2I initialWindowSize = new Vector2I(10, 10); if (SystemSettings.CurrentPlatform == SystemSettings.Platform.UWP) { initialWindowSize = EngineApp.platform.CreatedWindow_GetClientRectangle().Size; } //set backend for Android if (SystemSettings.CurrentPlatform == SystemSettings.Platform.Android) { EngineSettings.Init.RendererBackend = RendererBackend.OpenGLES; //EngineSettings.Init.RendererBackend = RendererBackend.Vulkan; //EngineSettings.Init.RendererBackend = RendererBackend.Noop; } //set platform data if (SystemSettings.CurrentPlatform == SystemSettings.Platform.Android && EngineSettings.Init.RendererBackend == RendererBackend.OpenGLES) { //Android, OpenGLES Bgfx.SetPlatformData(new PlatformData { Context = (IntPtr)1 }); } else { Bgfx.SetPlatformData(new PlatformData { WindowHandle = EngineApp.ApplicationWindowHandle }); } if (EngineApp.ApplicationType == EngineApp.ApplicationTypeEnum.Simulation && EngineSettings.Init.SimulationTripleBuffering) { Bgfx.SetTripleBuffering(); } //Log.InvisibleInfo( "Renderer backend: " + EngineSettings.Init.RendererBackend.ToString() ); var initSettings = new InitSettings { Backend = EngineSettings.Init.RendererBackend, CallbackHandler = new CallbackHandler(), ////!!!!в релизе можно включить. в NeoAxis.DefaultSettings.config //Debug = true //!!!! //ResetFlags = ResetFlags.MSAA8x, }; Bgfx.Init(initSettings); Bgfx.Reset(initialWindowSize.X, initialWindowSize.Y, GetApplicationWindowResetFlags()); realRoot = (OgreRoot *)OgreRoot.New(path); //profilingToolBeginOperationDelegate = profilingToolBeginOperation; //profilingToolEndOperationDelegate = profilingToolEndOperation; //OgreRoot.setCallbackDelegates( realRoot, // profilingToolBeginOperationDelegate, // profilingToolEndOperationDelegate ); logListener_messageLoggedDelegate = logListener_messageLogged; logListener = (MyOgreLogListener *)MyOgreLogListener.New( logListener_messageLoggedDelegate); OgreLogManager.getDefaultLog_addListener(realRoot, logListener); MyOgreVirtualFileSystem.Init(); //TextBlock configBlock = null; //if( VirtualFile.Exists( "Base/Constants/RenderingSystem.config" ) ) // configBlock = TextBlockUtility.LoadFromVirtualFile( "Base/Constants/RenderingSystem.config" ); ////irradianceVolumeLightPowerSpeed //{ // irradianceVolumeLightPowerSpeed = 1; // if( configBlock != null ) // { // TextBlock staticLightingBlock = configBlock.FindChild( "staticLighting" ); // if( staticLightingBlock != null ) // { // if( staticLightingBlock.IsAttributeExist( "irradianceVolumeLightPowerSpeed" ) ) // { // irradianceVolumeLightPowerSpeed = float.Parse( // staticLightingBlock.GetAttribute( "irradianceVolumeLightPowerSpeed" ) ); // } // } // } //} //if( !string.IsNullOrEmpty( EngineApp.InitSettings.RenderingDeviceName ) ) //{ // OgreRoot.setRenderingDevice( realRoot, EngineApp.InitSettings.RenderingDeviceName, // EngineApp.InitSettings.RenderingDeviceIndex ); //} ////!!!!!!всё таки выключать можно для NULL рендеринга? ////renderSystem.MaxPixelShadersVersion = MaxPixelShadersVersions.PS30; ////renderSystem.MaxVertexShadersVersion = MaxVertexShadersVersions.VS30; //RenderingSystem.Direct3DFPUPreserve = EngineApp.InitSettings.RenderingDirect3DFPUPreserve; unsafe { OgreRoot.initialise(realRoot); } GpuProgramManager.Init(); InitGPUSettingsAndCapabilities(); applicationRenderWindow = new RenderWindow(FrameBuffer.Invalid, initialWindowSize, EngineApp.ApplicationWindowHandle, true); //applicationRenderWindow.WindowMovedOrResized( xxx ); //!!!!!?, mainRenderTargetSize ); //Scene manager MyOgreSceneManager *realSceneManager = (MyOgreSceneManager *)OgreRoot.createSceneManager(realRoot, "NeoAxisSceneManager"); sceneManager = new OgreSceneManager(realSceneManager); EngineFontManager.Init(fontManagerDefaultLanguage); //Create viewport Viewport viewport = applicationRenderWindow.AddViewport(true, true); // RenderCamera.Purposes.UsualScene );// mainRenderTargetCamera ); //viewport.Camera.AllowFrustumCullingTestMode = true; //mainRenderTargetViewport = mainRenderTarget.AddViewport( RenderCamera.Purposes.UsualScene );// mainRenderTargetCamera ); //mainRenderTargetCamera = mainRenderTargetViewport.ViewportCamera; //mainRenderTargetCamera.AllowFrustumCullingTestMode = true; { IntPtr errorPointer; OgreResourceGroupManager.initialiseAllResourceGroups(realRoot, out errorPointer); string error = OgreNativeWrapper.GetOutString(errorPointer); if (error != null) { Log.Error(string.Format("Renderer: {0}", error)); return(false); } } //Ogre initialization errors if (resourceInitializationErrors.Count != 0) { string text = "Renderer initialization errors:\n\n"; foreach (string message in resourceInitializationErrors) { text += message + "\n"; } resourceInitializationErrors.Clear(); Log.Error(text); return(false); } resourcesInitialized = true; GpuBufferManager.Init(); //!!!!! //ResourceLoadingManagerInBackground.Init(); return(true); }