/// <summary>
        /// Carga el contenido gráfico del componente
        /// </summary>
        protected override void LoadContent()
        {
            this.m_BasicEffect = new BasicEffect(this.GraphicsDevice, null);
            this.m_BasicEffect.EnableDefaultLighting();

            this.m_Sphere = new CollisionSphere(this.Radius, this.Mass);

            VertexPositionNormalTexture[] buffer = null;
            Int16[] indices = null;

            PolyGenerator.InitializeSphere(out buffer, out indices, this.Radius);

            this.m_Geometry = new BufferedGeometryInfo()
            {
                FillMode          = FillMode.Solid,
                PrimitiveType     = PrimitiveType.TriangleList,
                Indexed           = true,
                Vertices          = buffer,
                Indices           = indices,
                VertexDeclaration = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements),
                Texture           = this.Game.Content.Load <Texture2D>(@"Content/dharma"),
                PrimitiveCount    = indices.Length / 3,
            };

            base.LoadContent();
        }
        /// <summary>
        /// Carga el contenido gráfico del componente
        /// </summary>
        protected override void LoadContent()
        {
            Vector3 halfSize = (this.Max - this.Min) / 2f;

            this.m_Box = new CollisionBox(halfSize, this.Mass);

            VertexPositionNormalTexture[] buffer = null;

            PolyGenerator.InitializeCube(out buffer, this.Min, this.Max);

            int primitiveCount = buffer.Length / 3;

            this.m_Geometry = new BufferedGeometryInfo()
            {
                FillMode          = this.FillMode,
                Indexed           = false,
                PrimitiveType     = PrimitiveType.TriangleList,
                PrimitiveCount    = primitiveCount,
                Vertices          = buffer,
                VertexDeclaration = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements),
                Texture           = this.Game.Content.Load <Texture2D>(@"Content/crate"),
            };

            this.m_BasicEffect = new BasicEffect(this.GraphicsDevice, null);
            this.m_BasicEffect.EnableDefaultLighting();

            base.LoadContent();
        }
示例#3
0
        /// <summary>
        /// Carga de contenidos gráficos
        /// </summary>
        protected override void LoadContent()
        {
            PolyGenerator.InitializeSphere(out this.m_Vertices, out this.m_Indices, 1f);

            this.m_VertexDeclaration = new VertexDeclaration(this.GraphicsDevice, VertexPositionNormalTexture.VertexElements);
            this.m_BasicEffect       = new BasicEffect(this.GraphicsDevice, null);
            this.m_Texture           = this.Game.Content.Load <Texture2D>(this.m_TextureAsset);

            base.LoadContent();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public CubeGameComponent(Game game, Vector3 min, Vector3 max)
            : base(game)
        {
            Vector3 halfSize = (max - min) / 2f;

            this.m_Box = new CollisionBox(halfSize, halfSize.X * halfSize.Y * halfSize.Z * 20f);

            PolyGenerator.InitializeCube(out m_Vertices, min, max);

            this.m_PrimitiveCount = m_Vertices.Length / 3;
        }
示例#5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="game">Juego</param>
        /// <param name="objOne">Objeto primero al que está conectado la barra</param>
        /// <param name="relativeContactPointOne">Posición relativa al objeto uno</param>
        /// <param name="objTwo">Objeto segundo al que está conectado la barra</param>
        /// <param name="relativeContactPointTwo">Posición relativa al objeto dos</param>
        /// <param name="size">Longitud de la barra</param>
        public Joint2Component(
            Game game,
            IPhysicObject objOne,
            Vector3 relativeContactPointOne,
            IPhysicObject objTwo,
            Vector3 relativeContactPointTwo,
            float size)
            : base(game)
        {
            this.Rod = new Joint2(objOne, relativeContactPointOne, objTwo, relativeContactPointTwo, size);

            PolyGenerator.InitializeLine(out this.m_LineVertices, Vector3.Zero, Vector3.One, Color.Red);
        }