public void OnFrame() { Dispatcher.ProcessFrame(); CamControl.Update(ActiveCamera, State != AppState.World); EditManager.Instance.UpdateChanges(); // do not move before mCamControl.Update to have the latest view/projection if (State == AppState.World) { UpdateCursorPosition(); UpdateBrushTime(TimeManager.Instance.GetTime()); CheckUpdateGlobalBuffer(); } GraphicsContext.Context.VertexShader.SetConstantBuffer(0, mGlobalBuffer.Native); GraphicsContext.Context.PixelShader.SetConstantBuffer(0, mGlobalBuffer.Native); MapManager.OnFrame(ActiveCamera); if (!HideWMO) { WmoManager.OnFrame(ActiveCamera); } if (!HideM2) { M2Manager.OnFrame(ActiveCamera); } WorldTextManager.OnFrame(ActiveCamera); BoundingBoxDrawManager.OnFrame(); }
public void Shutdown() { TextureManager.Instance.Shutdown(); MapManager.Shutdown(); WmoManager.Shutdown(); StaticAnimationThread.Instance.Shutdown(); M2Manager.Shutdown(); WorldTextManager.Shutdown(); }
private WorldFrame() { MapManager = new MapManager(); WmoManager = new WmoManager(); M2Manager = new M2Manager(); WorldTextManager = new WorldTextManager(); BoundingBoxDrawManager = new BoundingBoxDrawManager(); mState = AppState.Idle; // set the settings on creation HighlightModelsInBrush = Properties.Settings.Default.HighlightModelsInBrush; //this.UpdateDrawBrushOnModels = Properties.Settings.Default.UpdateDrawBrushOnModels; // todo: notimplemented! }
public void Initialize(RenderControl window, GxContext context) { GraphicsContext = context; mWindow = window; context.Resize += (w, h) => OnResize((int)w, (int)h); mGlobalBuffer = new ConstantBuffer(context); mGlobalBuffer = new ConstantBuffer(context); mGlobalBufferStore = new GlobalParamsBuffer { matView = Matrix.Identity, matProj = Matrix.Identity, viewport = Vector4.Zero, ambientLight = new Color4(0.5f, 0.5f, 0.5f, 1.0f), diffuseLight = new Color4(0.25f, 0.5f, 1.0f, 1.0f), fogColor = new Color4(0.25f, 0.5f, 1.0f, 1.0f), fogParams = new Vector4(500.0f, 900.0f, mMainCamera.FarClip, 0.0f), mousePosition = new Vector4(float.MaxValue), eyePosition = Vector4.Zero, brushParams = new Vector4(45.0f, 55.0f, 0.0f, 0.0f) }; mGlobalBuffer.UpdateData(mGlobalBufferStore); Dispatcher = new GraphicsDispatcher(); Dispatcher.AssignToThread(); MapChunkRender.Initialize(context); MapAreaLowRender.Initialize(context); WmoGroupRender.Initialize(context); M2BatchRenderer.Initialize(context); M2SingleRenderer.Initialize(context); M2PortraitRenderer.Initialize(context); WorldText.Initialize(context); BoundingBoxDrawManager.Initialize(); ChunkEditManager.Instance.Initialize(); StaticAnimationThread.Instance.Initialize(); WmoManager.Initialize(); M2Manager.Initialize(); WorldTextManager.Initialize(); SetActiveCamera(mMainCamera); TextureManager.Instance.Initialize(context); MapManager.Initialize(); mMainCamera.ViewChanged += ViewChanged; mMainCamera.ProjectionChanged += ProjectionChanged; OnResize(mWindow.Width, mWindow.Height); ViewChanged(mMainCamera, mMainCamera.View); ProjectionChanged(mMainCamera, mMainCamera.Projection); CamControl = new CameraControl(window); CamControl.PositionChanged += MapManager.UpdatePosition; if (!LeftHandedCamera) { CamControl.InvertY = false; } window.MouseDown += OnRenderWindowMouseDown; }