コード例 #1
0
ファイル: PixmapBillboard.cs プロジェクト: vaginessa/OpenC1
        public void Render(Vector3 position)
        {
            if (_pixmaps.Count == 0)
            {
                return;
            }

            Update();
            BeginBatch();

            Matrix world = Matrix.CreateScale(0.03f) * Matrix.CreateBillboard(position, Engine.Camera.Position, Vector3.Up, Vector3.Forward);

            BasicEffect2 effect = GameVars.CurrentEffect;

            effect.World   = _scaleMatrix * world;
            effect.Texture = _pixmaps[_currentFrame].Texture;
            effect.CommitChanges();
            Engine.Device.RenderState.CullMode = CullMode.None;
            Engine.Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
            EndBatch();
        }
コード例 #2
0
ファイル: Pedestrian.cs プロジェクト: vaginessa/OpenC1
        public void Render()
        {
            Matrix world = Matrix.CreateConstrainedBillboard(Position, Engine.Camera.Position, Vector3.Up, null, null);

            PedestrianFrame frame = _inLoopingFrames ? _currentSequence.LoopingFrames[_frameIndex] : _currentSequence.InitialFrames[_frameIndex];

            if (frame.Texture == null)
            {
                return;
            }

            Vector3 scale = new Vector3(frame.Texture.Width, frame.Texture.Height, 1);

            if (!IsPowerup)
            {
                scale *= 0.015f;
            }
            else
            {
                scale *= 0.02f;
            }

            if (frame.Flipped)
            {
                world = Matrix.CreateRotationY(MathHelper.Pi) * world;
            }

            world = Matrix.CreateScale(scale) * Matrix.CreateRotationZ(_hitCurrentSpin) * world * Matrix.CreateTranslation(frame.Offset) * Matrix.CreateTranslation(0, scale.Y * 0.5f, 0);

            BasicEffect2 effect = GameVars.CurrentEffect;

            effect.World   = world;
            effect.Texture = frame.Texture;
            effect.CommitChanges();
            Engine.Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
        }