public void PlayAround(IVEffect effect, IVDrawable sphere) { //foreach (var tpd in _tpds) //{ // effect.World = Matrix.Scaling(tpd.BoundingSphere.Radius)*Matrix.Translation(tpd.BoundingSphere.Center); // sphere.Draw(effect); //} }
public TerrainWalker( LarvContent lcontent, IVEffect effect, Ground ground) : base(effect) { _sphere = lcontent.Sphere; _texture = lcontent.Load<Texture2D>(@"models/frogskin"); _ground = ground; _position1 = new Vector3(11, 0, -3); }
public void PlayAround(IVEffect effect, IVDrawable thing) { //foreach (var vc in Children.Cast<CodeIsland>().SelectMany(_ => _.Classes.Values)) //{ // effect.World = Matrix.Scaling(vc.SignClickBoundingSphere.Radius * 2) * Matrix.Translation(vc.SignClickBoundingSphere.Center); // thing.Draw(effect); //} //foreach (var ci in Children.Cast<CodeIsland>()) //{ // effect.World = Matrix.Scaling(ci.BoundingSphere.Radius * 2) * Matrix.Translation(ci.BoundingSphere.Center); // effect.World = Matrix.Scaling(10) * ci.World; // thing.Draw(effect); //} }
public LarvContent(GraphicsDevice graphicsDevice, ContentManager content, IEnumerable<string> sceneDescription) : base(graphicsDevice, content) { SpriteBatch = new SpriteBatch(graphicsDevice); Font = Load<SpriteFont>("fonts/BlackCastle"); SignTextEffect = LoadEffect("effects/signtexteffect"); TextureEffect = LoadEffect("effects/simpletextureeffect"); BumpEffect = LoadEffect("effects/simplebumpeffect"); Sphere = new SpherePrimitive<VertexPositionNormalTangentTexture>(GraphicsDevice, (p, n, t, tx) => new VertexPositionNormalTangentTexture(p, n, t, tx), 2, 10); Sky = new SkySphere(this, Load<TextureCube>(@"Textures\clouds")); Ground = new Ground(this); ShadowMap = new ShadowMap(this, 800, 800, 1, 50); ShadowMap.UpdateProjection(50, 30); HallOfFame = HofStorage.Load(); PlayingFieldInfos = PlayingFieldsDecoder.Create(sceneDescription); }
public static void Draw( IVEffect effect, Texture2D skin, Vector4 diffuseColor, IVDrawable sphere, Matrix translation, Direction direction) { var t = direction.IsNorthSouth ? NorthSouthScale : EastWestScale; var off = direction.DirectionAsVector3()*-0.3f; t *= Matrix.Translation(off); effect.World = t*translation; effect.Texture = skin; effect.DiffuseColor = diffuseColor; sphere.Draw(effect); }
public Egg( IVEffect effect, IVDrawable sphere, Texture2D eggSkin, Vector4 diffuseColor, Matrix world, Whereabouts whereabouts, float timeToHatch) : base(effect) { _sphere = sphere; _eggSkin = eggSkin; _diffuseColor = diffuseColor; _world = world * Matrix.Translation(0, -0.2f, 0); Whereabouts = whereabouts; _timeToHatch = timeToHatch; }
protected override void LoadContent() { // Instantiate a SpriteBatch spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice)); // Loads a sprite font // The [Arial16.xml] file is defined with the build action [ToolkitFont] in the project //arial16Font = Content.Load<SpriteFont>("Arial16"); var lightVec = new Vector3(1, 0, 5); lightVec.Normalize(); // Creates a basic effect //basicEffect = ToDisposeContent(new VBasicEffect(GraphicsDevice)); var vContent = new VisionContent(GraphicsDevice, Content); //basicEffect = ToDisposeContent(new VBasicEffect(GraphicsDevice)); //_textureEffect = vContent.LoadPlainEffect("effects/simpletextureeffect"); _textureEffect = vContent.LoadPlainEffect("effects/simpletextureeffect"); _exampleEffect = vContent.LoadPlainEffect("exempeleffect"); _textureEffect.SunlightDirection = lightVec; _exampleEffect.SunlightDirection = lightVec; _textureEffect.Texture = Content.Load<Texture2D>("textures/brick_texture_map"); _exampleEffect.Texture = Content.Load<Texture2D>("textures/brick_texture_map"); //_textureEffect.Parameters["BumpMap"].SetResource(Content.Load<Texture2D>("textures/brick_normal_map")); _exampleEffect.Parameters["BumpMap"].SetResource(Content.Load<Texture2D>("textures/brick_normal_map")); //var be = (BasicEffect)basicEffect.Effect; //be.PreferPerPixelLighting = true; //be.EnableDefaultLighting(); //be.LightingEnabled = _lighting; // Creates torus primitive primitive = ToDisposeContent(new SpherePrimitive<VertexPositionNormalTangentTexture>(GraphicsDevice, (p, n, t, tx) => new VertexPositionNormalTangentTexture(p, n, t, tx), 2)); base.LoadContent(); }
public ClipDrawableInstance(IVEffect effect, IVDrawable thing, Matrix world ) : base(effect) { Thing = thing; World = world; }
protected override void LoadContent() { base.LoadContent(); _spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice)); _vContent = new VisionContent(_graphicsDeviceManager.GraphicsDevice, Content); _arial16Font = Content.Load<SpriteFont>("Fonts/Arial16"); _basicEffect = new VBasicEffect(_graphicsDeviceManager.GraphicsDevice); _basicEffect.EnableDefaultLighting(); _ball = new SpherePrimitive<VertexPositionNormalTexture>(GraphicsDevice, (p, n, t, tx) => new VertexPositionNormalTexture(p, n, tx), 1); var x = _vContent.LoadEffect("effects/simpletextureeffect"); x.Texture = _vContent.Load<Texture2D>("terraintextures/sand"); _ballInstance = new VDrawableInstance(x, _ball, Matrix.Translation(10, 2, 10)); Sky = new SkySphere(_vContent, _vContent.Load<TextureCube>(@"Textures\clouds")); _movingShip = new MovingShip(new ShipModel(_vContent)); _water = WaterFactory.Create(_vContent); _water.ReflectedObjects.Add(_movingShip._shipModel); _water.ReflectedObjects.Add(_ballInstance); _water.ReflectedObjects.Add(Sky); _camera = new Camera( _vContent.ClientSize, new KeyboardManager(this), new MouseManager(this), null, //new PointerManager(this), new Vector3(0, 15, 0), new Vector3(-10, 15, 0)); _rasterizerState = RasterizerState.New(GraphicsDevice, new RasterizerStateDescription { FillMode = FillMode.Solid, CullMode = CullMode.Back, IsFrontCounterClockwise = false, DepthBias = 0, SlopeScaledDepthBias = 0.0f, DepthBiasClamp = 0.0f, IsDepthClipEnabled = true, IsScissorEnabled = false, IsMultisampleEnabled = false, IsAntialiasedLineEnabled = false }); _shadow = new ShadowMap(_vContent, 1024, 1024); //_shadow.ShadowCastingObjects.Add(_sailingShip); //_shadow.ShadowCastingObjects.Add(reimersTerrain); //_shadow.ShadowCastingObjects.Add(generatedTerrain); //_shadow.ShadowCastingObjects.Add(bridge); //_archipelag = new Archipelag(_vContent, _water, _shadow); _data.VContent = _vContent; _data.Camera = _camera; _data.Water = _water; _data.Shadow = _shadow; _q = new CxBillboard(_vContent, Matrix.Identity, _vContent.Load<Texture2D>("billboards/wheat_billboard"), 20, 10, 0.5f); _q.AddPositionsWithSameNormal(Vector3.Up, Vector3.Zero, Vector3.Left*10.5f, Vector3.Up, Vector3.Right*10.4f, Vector3.Up, Vector3.ForwardRH*3.45f, Vector3.Up, Vector3.BackwardRH*2.9f, Vector3.Up); _q.CreateVertices(); }
protected BaseSerpent( LarvContent lcontent, PlayingField playingField, Texture2D serpentSkin, Texture2D serpentHeadSkin, Texture2D serpentBump, Texture2D eggSkin) : base(lcontent.BumpEffect) { Restart(playingField, playingField.EnemyWhereaboutsStart); _sphere = lcontent.Sphere; _serpentSkin = serpentSkin; _serpentHeadSkin = serpentHeadSkin; _serpentBump = serpentBump; _eggSkin = eggSkin; _textureEffect = lcontent.TextureEffect; _headRotation.Add(Direction.East, Matrix.RotationY(MathUtil.Pi)); _headRotation.Add(Direction.West, Matrix.Identity); _headRotation.Add(Direction.North, Matrix.RotationY(MathUtil.PiOverTwo)); _headRotation.Add(Direction.South, Matrix.RotationY(-MathUtil.PiOverTwo)); }