示例#1
0
        public void RemovePart(PhysicsPart part)
        {
            return;

            /*
             * if (part == null) return;
             *
             * var shadowPart = ShadowPartList.FirstOrDefault(p => p != null && p.Part != null && p.Part.Equals(part));
             *
             * if (shadowPart != null)
             *  ShadowPartList.Remove(shadowPart);
             */
        }
示例#2
0
        public void AddPart(PhysicsPart part, List <int> planes, AFrame frame, int numShadowParts)
        {
            return;

            /*if (part == null) return;
             *
             * var shadowPart = new ShadowPart();
             * if (planes != null)
             *  shadowPart = new ShadowPart(1, planes, frame, part);
             * else
             *  shadowPart = new ShadowPart(null, null, part);
             *
             * ShadowPartList.Add(shadowPart);*/
        }
示例#3
0
        public void DrawGfxObj(GfxObj gfxObj, PhysicsPart part, Texture2D texture)
        {
            if (gfxObj.VertexBuffer == null)
            {
                gfxObj.BuildVertexBuffer();
            }

            GraphicsDevice.SetVertexBuffer(gfxObj.VertexBuffer);

            var translateWorld = Matrix.CreateScale(part.GfxObjScale.ToXna()) * Matrix.CreateTranslation(part.Pos.Frame.Origin.ToXna()) * Matrix.CreateFromQuaternion(part.Pos.Frame.Orientation.ToXna());

            Effect.CurrentTechnique = Effect.Techniques["TexturedNoShading"];
            Effect.Parameters["xWorld"].SetValue(translateWorld);
            Effect.Parameters["xOpacity"].SetValue(1.0f - part.CurTranslucency);

            foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
            {
                foreach (var poly in gfxObj.Polygons)
                {
                    if (gfxObj.Surfaces[0].Type.HasFlag(SurfaceType.Additive))
                    {
                        GraphicsDevice.BlendState = BlendState.Additive;
                    }
                    else
                    {
                        GraphicsDevice.BlendState = BlendState.NonPremultiplied;
                    }
                    //GraphicsDevice.BlendState = BlendState.AlphaBlend;

                    if (poly.IndexBuffer == null)
                    {
                        poly.BuildIndexBuffer();
                    }

                    GraphicsDevice.Indices = poly.IndexBuffer;
                    Effect.Parameters["xTextures"].SetValue(poly.Texture);
                    pass.Apply();

                    var indexCnt = poly.Indices.Count;
                    GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, indexCnt / 3);

                    /*if (poly._polygon.Vertices == null)
                     *  poly._polygon.LoadVertices(gfxObj._gfxObj.VertexArray);
                     *
                     * var vertexCnt = poly._polygon.Vertices.Count;
                     * GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, vertexCnt / 3);*/
                }
            }
        }
示例#4
0
文件: PartCell.cs 项目: zarlant/ACE
        public void AddPart(PhysicsPart part, List <int> planes, AFrame frame, int numShadowParts)
        {
            var shadowPart = new ShadowPart();

            if (planes != null)
            {
                shadowPart = new ShadowPart(1, planes, frame, part);
            }
            else
            {
                shadowPart = new ShadowPart(null, null, part);
            }

            ShadowPartList.Add(shadowPart);
            NumShadowParts++;
        }
示例#5
0
文件: PartCell.cs 项目: zarlant/ACE
        public void RemovePart(PhysicsPart part)
        {
            var removeParts = new List <ShadowPart>();

            foreach (var shadowPart in ShadowPartList)
            {
                if (!part.Equals(shadowPart.Part))
                {
                    continue;
                }
                removeParts.Add(shadowPart);
            }

            foreach (var removePart in removeParts)
            {
                ShadowPartList.Remove(removePart);
            }

            NumShadowParts -= removeParts.Count;
        }
示例#6
0
        private static readonly float pointSpriteSize = 1.8f;   // guessing

        public void DrawPointSprite(GfxObj gfxObj, PhysicsPart part, Texture2D texture)
        {
            GraphicsDevice.SetVertexBuffer(Billboard.VertexBuffer);
            GraphicsDevice.Indices = Billboard.IndexBuffer;

            var translateWorld = Matrix.CreateFromQuaternion(part.Pos.Frame.Orientation.ToXna()) * Matrix.CreateTranslation(part.Pos.Frame.Origin.ToXna());

            //var translateWorld = Matrix.CreateTranslation(part.Pos.Frame.Origin.ToXna()) * Matrix.CreateFromQuaternion(part.Pos.Frame.Orientation.ToXna());

            // get initial scale from gfxobj vertices
            if (gfxObj.BoundingBox == null)
            {
                gfxObj.BuildBoundingBox();
            }

            Effect.CurrentTechnique = Effect.Techniques["PointSprite"];
            Effect.Parameters["xWorld"].SetValue(translateWorld);
            Effect.Parameters["xTextures"].SetValue(texture);
            Effect.Parameters["xCamPos"].SetValue(Camera.Position);
            Effect.Parameters["xCamUp"].SetValue(Camera.Up);
            Effect.Parameters["xPointSpriteSizeX"].SetValue(part.GfxObjScale.X * gfxObj.BoundingBox.MaxSize * pointSpriteSize);
            Effect.Parameters["xPointSpriteSizeY"].SetValue(part.GfxObjScale.Y * gfxObj.BoundingBox.MaxSize * pointSpriteSize);
            Effect.Parameters["xOpacity"].SetValue(1.0f - part.CurTranslucency);

            foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
            {
                if (gfxObj.Surfaces[0].Type.HasFlag(SurfaceType.Additive))
                {
                    GraphicsDevice.BlendState = BlendState.Additive;
                }
                else
                {
                    GraphicsDevice.BlendState = BlendState.NonPremultiplied;
                }

                pass.Apply();

                GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleStrip, 0, 0, 2);
            }
        }
示例#7
0
        public void RemovePart(PhysicsPart part)
        {
            // FIXME: null parts
            if (part == null)
            {
                return;
            }

            var removeParts = new List <ShadowPart>();

            foreach (var shadowPart in ShadowPartList.ToList())
            {
                if (part.Equals(shadowPart))
                {
                    removeParts.Add(shadowPart);
                }
            }

            foreach (var removePart in removeParts)
            {
                ShadowPartList.Remove(removePart);
            }
        }
示例#8
0
 public R_PhysicsPart(PhysicsPart physicsPart)
 {
     PhysicsPart = physicsPart;
     R_GfxObj    = new R_GfxObj(physicsPart.GfxObj, PhysicsPart.GfxObjScale.ToXna());
 }
示例#9
0
 public void AddPart(PhysicsPart part, int clipPlanes, AFrame frame, int numParts)
 {
     // could go in PartCell
 }
示例#10
0
 public void RemovePart(PhysicsPart part)
 {
 }