public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer) { if (firstTime) { oldViewProjection = world.CameraManager.ActiveCamera.ViewProjection; firstTime = false; } effect.Parameters["attenuation"].SetValue(Attenuation); effect.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel); effect.Parameters["InvertViewProjection"].SetValue(Matrix.Invert(world.CameraManager.ActiveCamera.ViewProjection)); effect.Parameters["oldViewProjection"].SetValue(oldViewProjection); effect.Parameters["numSamples"].SetValue(NumSamples); effect.Parameters["depth"].SetValue(rHelper[PrincipalConstants.DephRT]); effect.Parameters["extra"].SetValue(rHelper[PrincipalConstants.extra1RT]); effect.Parameters["cena"].SetValue(ImageToProcess); oldViewProjection = world.CameraManager.ActiveCamera.ViewProjection; if (useFloatBuffer) rHelper.RenderFullScreenQuadVertexPixel(effect, SamplerState.PointClamp); else rHelper.RenderFullScreenQuadVertexPixel(effect, GraphicInfo.SamplerState); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { engine.IsMouseVisible = true; Primitive2DDraw = new PloobsEngine.Features.DebugDraw.Primitive2DDraw(); engine.AddComponent(Primitive2DDraw); base.InitScreen(GraphicInfo, engine); }
protected override void PosWithDepthDraw(PloobsEngine.SceneControl.RenderHelper render, Microsoft.Xna.Framework.GameTime gt, ref Microsoft.Xna.Framework.Matrix activeView, ref Microsoft.Xna.Framework.Matrix activeProjection) { Matrix viewIT = Matrix.Invert(Matrix.Transpose(activeView)); Vector3 position = new Vector3(viewIT.M14, viewIT.M24, viewIT.M34); foreach (var item in Billboards) { if (item.Enabled) { SpriteFont font = item.SpriteFont == null ? SpriteFont : item.SpriteFont; basicEffect.World = Matrix.CreateConstrainedBillboard(item.Position, position, Vector3.Down, null, null); basicEffect.View = activeView; basicEffect.Projection = activeProjection; spriteBatch.Begin(0, null, null, DepthStencilState.DepthRead, RasterizerState.CullNone, basicEffect); Vector2 textOrigin = font.MeasureString(item.Message) / 2; spriteBatch.DrawString(font, item.Message, Vector2.Zero, item.Color, 0, textOrigin, item.Scale, 0, 0); spriteBatch.End(); } } render.ResyncStates(); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); ngui = Gui as NeoforceGui; manager = ngui.Manager; Window window = new Window(manager); window.Init(); window.Text = "Options"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; Button button = new Button(manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); manager.Add(window); }
public void Initialization(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { RenderTargetCube = factory.CreateRenderTargetCube(512,SurfaceFormat.Color,false,DepthFormat.Depth24Stencil8,0,RenderTargetUsage.PreserveContents); ForwardEnvironmentShader = new ForwardEnvironmentShader(RenderTargetCube,1,true); ForwardEnvironmentShader.Initialize(ginfo, factory, obj); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory) { basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; spriteBatch = factory.GetSpriteBatch(); base.LoadContent(GraphicInfo, factory); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, IObject obj) { Effect = factory.GetEffect("Effects/baker"); base.Initialize(ginfo, factory, obj); Effect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); rt = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); }
protected override void UpdateObject(Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Cameras.ICamera cam, IWorld world) { // Tell the animation player to compute the latest bone transform matrices. SkinnedModel.AnimationPlayer.UpdateBoneTransforms(gt.ElapsedGameTime, true); Matrix[] boneTransforms = new Matrix[SkinnedModel.SkinningData.BindPose.Count]; // Copy the transforms into our own array, so we can safely modify the values. SkinnedModel.AnimationPlayer.GetBoneTransforms().CopyTo(boneTransforms, 0); // Modify the transform matrices for the head and upper-left arm bones. int headIndex = SkinnedModel.SkinningData.BoneIndices["Head"]; ///some bone manipulation headRotation += step; if (headRotation > 0.7f || headRotation < -0.7f) step *= -1; Matrix headTransform = Matrix.CreateRotationX(headRotation); boneTransforms[headIndex] = headTransform * boneTransforms[headIndex]; // Tell the animation player to recompute the world and skin matrices. SkinnedModel.AnimationPlayer.UpdateWorldTransforms(Matrix.Identity, boneTransforms); SkinnedModel.AnimationPlayer.UpdateSkinTransforms(); ForwardSkinnedShader.SetBones(SkinnedModel.AnimationPlayer.GetSkinTransforms()); base.UpdateObject(gt, cam, world); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { mstate = Mouse.GetState(); this.engine = engine; base.InitScreen(GraphicInfo, engine); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { base.InitScreen(GraphicInfo, engine); MessageDeliver md = new MessageDeliver(); engine.AddComponent(md); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { tile = factory.GetTexture2D("Textures/tile"); FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld; ///border border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red)); ///from texture { Texture2D tex = factory.GetTexture2D("Textures//goo"); tex = factory.GetScaledTexture(tex, new Vector2(4)); IModelo2D model = new SpriteFarseer(tex); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model); I2DObject o = new I2DObject(fs, mat, model); o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved); this.World.AddObject(o); } ///camera this.World.Camera2D = new Camera2D(GraphicInfo); ///Create the Particle System DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null)); this.World.ParticleManager.AddAndInitializeParticleSystem(ps); ///updateable JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D); base.LoadContent(GraphicInfo, factory, contentManager); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { _shader2 = factory.GetEffect("PrePass2/ShaderPass"); _shader = factory.GetEffect("PrePass2/renderobj"); base.Initialize(ginfo, factory, obj); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { effect = factory.GetEffect("effects/TransparentOnBorder"); effectdistorcion = factory.GetEffect("effects/effect2"); target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); SetBlurEffectParameters(1f / (float)ginfo.BackBufferWidth, 1f / (float)ginfo.BackBufferHeight); }
public void Initialization(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { RenderTargetCube = factory.CreateRenderTargetCube(128, SurfaceFormat.Color, false, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents); ForwardEnvironmentShader = new ForwardEnvironmentShader(RenderTargetCube, 0.5f, false); ForwardEnvironmentShader.Initialize(ginfo, factory, obj); //ForwardEnvironmentShader.EnvironmentMapEffect.EnableDefaultLighting(); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { base.InitScreen(GraphicInfo, engine); CPUSphericalBillboardComponent = new CPUSphericalBillboardComponent(); engine.AddComponent(CPUSphericalBillboardComponent); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { base.InitScreen(GraphicInfo, engine); engine.AddComponent(new DebugDraw()); }
public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer) { //mix with last frame downsampled if (tex != null) { rHelper.PushRenderTarget(rtend); rHelper.RenderTextureComplete(tex, Color.FromNonPremultiplied(255, 255, 255, 255), GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp); rHelper.RenderTextureComplete(ImageToProcess, Color.FromNonPremultiplied(255, 255, 255, Amount), GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp, BlendState.AlphaBlend); end = rHelper.PopRenderTargetAsSingleRenderTarget2D(); } //DownSample rHelper.PushRenderTarget(rt); rHelper.Clear(Color.Black); if (end == null) { rHelper.RenderTextureComplete(ImageToProcess, Color.White, rt.Bounds, Matrix.Identity, ImageToProcess.Bounds, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp); } else { rHelper.RenderTextureComplete(end, Color.White, rt.Bounds, Matrix.Identity, ImageToProcess.Bounds, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp); } tex = rHelper.PopRenderTargetAsSingleRenderTarget2D(); if(end!=null) rHelper.RenderTextureComplete(end, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp); else rHelper.RenderTextureComplete(ImageToProcess, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp); }
public void PreDrawnPhase(Microsoft.Xna.Framework.GameTime gt, PloobsEngine.SceneControl.IWorld mundo, PloobsEngine.SceneControl.IObject obj, PloobsEngine.Cameras.ICamera cam, IList<PloobsEngine.Light.ILight> lights, PloobsEngine.SceneControl.RenderHelper render) { Vector3 pos = obj.PhysicObject.Position; render.PushRasterizerState(d); render.RenderSceneToTextureCube(RenderTargetCube, Color.AliceBlue, mundo, ref pos, gt, true, false, new List<PloobsEngine.SceneControl.IObject>() { obj }); render.PopRasterizerState(); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { FPSCounter fp = new FPSCounter(); fp.CombinedFps += new FpsEvent(fp_CombinedFps); engine.AddComponent(fp); engine.IsFixedTimeStep = false; base.InitScreen(GraphicInfo, engine); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this.ginfo = ginfo; spriteBatch = factory.GetSpriteBatch(); basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; base.Initialize(ginfo, factory, obj); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { tile = factory.GetTexture2D("Textures/tile"); FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld; ///Ground Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100); { IModelo2D model = new SpriteFarseer(factory, verts, Color.Red); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static); I2DObject o = new I2DObject(fs, mat, model); ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen ///We need to translate it a bit down o.PhysicObject.Position = new Vector2(0, 250); this.World.AddObject(o); } ///animated sprite { ///loading the texture Texture2D tex = factory.GetTexture2D("Textures//DudeSheet"); ///scale the texture (this is not good specially with animated texture, cause the whole texture is being scalled) tex = factory.GetScaledTexture(tex, new Vector2(2)); ///Loading the Sprite and extracting the frames ///8 = Maximum number of frames in the horizontal ///2 = Number of animation ///See the texture DudeSheet to undertand SpriteAnimated sa = new SpriteAnimated(tex, 8, 2); ///Specify the first animation (First "line" of the texture) -- see the extra parameters in addAnimation sa.AddAnimation("ANIM1", 1, 8, 0); ///Specify the Second animation (Second "line" of the texture) sa.AddAnimation("ANIM2", 2, 4, 0); ///Create the Material Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); ///To create the physic object, we extract one frame from the image and use it to be our physic body =P Texture2D frame = factory.GetTexturePart(tex, sa.GetFrameRectangle("ANIM1", 0)); FarseerObject fs = new FarseerObject(fworld, frame); sheet = new I2DObject(fs, mat, sa); sheet.PhysicObject.Position = new Vector2(0,0); this.World.AddObject(sheet); } ///camera this.World.Camera2D = new Camera2D(GraphicInfo); base.LoadContent(GraphicInfo, factory, contentManager); ///when double tap, perform the following action this.BindInput(new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.DoubleTap, (a) => { animationIndex = (animationIndex + 1) % 2; (sheet.Modelo as SpriteAnimated).ChangeAnimation(animations[animationIndex]); ///you can play, pause, change ..... using the SpriteAnimated object. } )); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { tile = factory.GetTexture2D("Textures/tile"); FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld; ///border border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red)); ///from texture, scale usage sample { Texture2D tex = factory.GetTexture2D("Textures//goo"); tex = factory.GetScaledTexture(tex, new Vector2(3)); IModelo2D model = new SpriteFarseer(tex); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, tex); fs.Position = new Vector2(0, 50); partobj = new I2DObject(fs, mat, model); partobj.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved); this.World.AddObject(partobj); } Vertices verts = PolygonTools.CreateRectangle(150, 150); { IModelo2D model = new SpriteFarseer(factory, verts, Color.Green); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic); I2DObject o = new I2DObject(fs, mat, model); ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen ///We need to translate it a bit down o.PhysicObject.Position = new Vector2(100, 100); this.World.AddObject(o); } //circle verts = PolygonTools.CreateCircle(150, 150); { IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic); I2DObject o = new I2DObject(fs, mat, model); o.PhysicObject.Position = new Vector2(-100, -100); this.World.AddObject(o); } ///camera this.World.Camera2D = new Camera2D(GraphicInfo); DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null)); this.World.ParticleManager.AddAndInitializeParticleSystem(ps); ///updateable ju = new JointUpdateable(this, fworld, this.World.Camera2D); base.LoadContent(GraphicInfo, factory, contentManager); }
public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer) { if (useFloatBuffer) rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, SamplerState.PointClamp); else rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, GraphicInfo.SamplerState); }
public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer) { //effect.Parameters["timervalue"].SetValue(m_Timer); if (useFloatBuffer) rHelper.RenderFullScreenQuadVertexPixel(effect,SamplerState.PointClamp); else rHelper.RenderFullScreenQuadVertexPixel(effect,SamplerState.LinearClamp); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { Effect = factory.GetEffect("ssao",false,true); tex = factory.GetTexture2D("noisetex", true); sBlurPost = new SBlurPost(blurAmount, BlurRadiusSize); sBlurPost.Init(ginfo, factory); RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); RenderTarget2D2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory) { SpriteFont = factory.GetAsset<SpriteFont>("ConsoleFont", true); basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; basicEffect.VertexColorEnabled = true; spriteBatch = factory.GetSpriteBatch(); base.LoadContent(GraphicInfo, factory); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { base.InitScreen(GraphicInfo, engine); ///Adicionando Componente de Mensagens ///Utilizado pelo Trigger ///Triggers uses this component MessageDeliver md = new MessageDeliver(); engine.AddComponent(md); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { arenScript = contentManager.GetAsset<SpriteFont>("Images//font//ArenScriptFont"); backT = contentManager.GetAsset<Texture2D>("Images//menus//MainMenu"); drawBackground = true; Init(); base.LoadContent(GraphicInfo, factory, contentManager); }
protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime, PloobsEngine.SceneControl.RenderHelper render) { base.Draw(gameTime, render); render.RenderBegin(Matrix.Identity); render.RenderTexture(mouseT, Color.White, new Rectangle(mstate.X, mstate.Y, 10, 10)); render.RenderEnd(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer) { effect.Parameters["extrart"].SetValue(rHelper[PrincipalConstants.extra1RT]); effect.Parameters["backtex"].SetValue(BackGroundTexture); if (useFloatBuffer) rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, SamplerState.PointClamp); else rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, GraphicInfo.SamplerState); }