Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <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();
        }