Пример #1
0
 /// <summary>
 /// Application.Idle handler.
 /// </summary>
 private void DoRenderLoop(object sender, EventArgs e)
 {
     if (RenderCore.DeviceInitialized && diInitialized && dsInitialized)
     {
         RenderCore.CameraLockRequested = IsCameraLockRequested();
         RenderCore.Render();
     }
 }
Пример #2
0
        public SimpleContainers.Vector3D IntersectScene(int x, int y)
        {
            Vector3 origin, direction;

            MdxRender.CalculatePickRayWorld(x, y, out direction, out origin);
            Vector3 vector = RenderCore.IntersectCurrentScene(origin, direction);

            return(new SimpleContainers.Vector3D(vector));
        }
Пример #3
0
        public string OnAddScene(TagPath path)
        {
            GameDefinition game    = instance.GetGameDefinitionByGameID(path.Game);
            string         tagName = path.Path + "." + path.Extension;
            Type           type    = game.TypeTable.LocateEntryByName(path.Extension).TagType;

            if (!new List <Type>(type.GetInterfaces()).Contains(typeof(IInstanceable)))
            {
                throw new CoreException("Cannot preview tag; {0} does not implement {1}.", type.FullName, typeof(IInstanceable).Name);
            }

            Tag    tag        = pool.Open(path.ToPath(), type, true);
            string identifier = path.ToPath();

            if (!scenes.ContainsKey(identifier))
            {
                scenes.Add(identifier, tag);
            }

            Camera newCam = new Camera();

            if (tag is ScenarioBase)
            {
                Interfaces.Rendering.Radiosity.WorldBounds totalBounds = (tag as ScenarioBase).BspList[0].WorldBounds;
                foreach (IBsp bsp in (tag as ScenarioBase).BspList)
                {
                    totalBounds &= bsp.WorldBounds;
                }

                newCam.Position = new Vector3((totalBounds.X.Lower + totalBounds.X.Upper) / 2, (totalBounds.Y.Lower + totalBounds.Y.Upper) / 2, (totalBounds.Z.Lower + totalBounds.Z.Upper) / 2);
            }

            RenderCore.AddScene(identifier, tagName, newCam, ((IInstanceable)tag).Instance, RenderState.Textured, game.GetSceneType(tag)); // Temp using RenderState.Textured until we load the value from the project file.
            RenderCore.ActiveSceneName = identifier;                                                                                       //added this line to activate the latest Scene - gren
            return(identifier);
        }
Пример #4
0
 public void ProcessResize(int sizeX, int sizeY)
 {
     RenderCore.PerformDeviceReset(sizeX, sizeY);
 }
Пример #5
0
 private void InitializeDirect3D(Control renderWindow)
 {
     MdxRender.Camera = new Camera();
     RenderCore.Initialize(renderWindow, pool);
 }
Пример #6
0
 public void SetViewportColor(Color color)
 {
     RenderCore.SetClearColor(color);
 }
Пример #7
0
 public void OnRemoveScene(string scene)
 {
     RenderCore.RemoveScene(scene);
 }