public override void Draw(float x, float y) { PreRender(); Render(this.UserInterface.Time); _renderView.Clear(); _renderView.ViewOrigin = _viewOffset.ToVector3(); //refdef.vieworg.Set(-128, 0, 0); _renderView.ViewAxis = Matrix.Identity; _renderView.MaterialParameters[0] = 1; _renderView.MaterialParameters[1] = 1; _renderView.MaterialParameters[2] = 1; _renderView.MaterialParameters[3] = 1; idRectangle drawRect = this.DrawRectangle; _renderView.X = (int)drawRect.X; _renderView.Y = (int)drawRect.Y; _renderView.Width = (int)drawRect.Width; _renderView.Height = (int)drawRect.Height; _renderView.FovX = 90; _renderView.FovY = 2.0f * (float)System.Math.Atan(drawRect.Height / drawRect.Width) * idMath.Rad2Deg; _renderView.Time = this.UserInterface.Time;; _world.RenderScene(_renderView); }
private void PreRender() { if (_needsRender == true) { _world.InitFromMap(null); idDict spawnArgs = new idDict(); spawnArgs.Set("classname", "light"); spawnArgs.Set("name", "light_1"); spawnArgs.Set("origin", _lightOrigin); spawnArgs.Set("_color", _lightColor); idConsole.Warning("TODO: lighting"); /*gameEdit->ParseSpawnArgsToRenderLight(&spawnArgs, &rLight); * lightDef = world->AddLightDef(&rLight); * if(!modelName[0]) * { * common->Warning("Window '%s' in gui '%s': no model set", GetName(), GetGui()->GetSourceFile()); * }*/ spawnArgs.Clear(); spawnArgs.Set("classname", "func_static"); spawnArgs.Set("model", _modelName); spawnArgs.Set("origin", _modelOrigin); _worldEntity = idE.GameEdit.ParseSpawnArgsToRenderEntity(spawnArgs); if (_worldEntity.Model != null) { Vector3 v = _modelRotate.ToVector3(); _worldEntity.Axis = v.ToMatrix(); _worldEntity.MaterialParameters[0] = 1; _worldEntity.MaterialParameters[0] = 1; _worldEntity.MaterialParameters[0] = 1; _worldEntity.MaterialParameters[0] = 1; _renderEntity = _world.AddEntityDefinition(_worldEntity); } _needsRender.Set(false); } }