Example #1
0
        static void Main(string[] args)
        {
            // ----- Object creation -----

            Console.WriteLine("Creating some objects:");
            CGePhysX test = new CGePhysX();
            test.OnInit();
            string filePath = Path.GetFullPath("..\\Media\\skirt2.obj");

            test.createCloth(filePath);

            Console.WriteLine("Goodbye");
        }
Example #2
0
        //        public float[] gCollPos = {
        //        0.000000f,	0.000000f,	0.000000f,
        //0.052266f,	-0.166711f,	0,
        //0.196846f,	-0.907815f,	0,
        //-0.102427f,	-1.569116f,	0,
        //0.105217f,	-1.646042f,	0,
        //0.215836f,	-1.648367f,	0,
        //0.085164f,	-0.186983f,	0,
        //0.412992f,	-0.867081f,	0,
        //-0.070659f,	-1.395693f,	0,
        //0.062266f,	-1.573331f,	0,
        //0.167428f,	-1.610105f,	0,
        //0.008180f,	0.205653f,	0,
        //0.030083f,	0.410989f,	0,
        //0.047453f,	0.617055f,	0,
        //0.034578f,	0.773784f,	0,
        //-0.014431f,	0.922243f,	0,
        //-0.057277f,	1.079146f,	0,
        //0.010548f,	0.714567f,	0,
        //-0.056876f,	0.232758f,	0,
        //0.136173f,	-0.039633f,	0,
        //0.232698f,	-0.175829f,	0,
        //0.239378f,	-0.234805f,	0,
        //0.245988f,	-0.284744f,	0,
        //0.265072f,	-0.245142f,	0,
        //0.047694f,	0.689457f,	0,
        //-0.023668f,	0.191988f,	0,
        //0.091970f,	-0.123844f,	0,
        //0.149789f,	-0.281761f,	0,
        //0.199259f,	-0.327233f,	0,
        //0.239160f,	-0.367242f,	0,
        //0.216975f,	-0.332152f,	0
        //                                  };
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            mCloth = new CGePhysX();
            mCloth.OnInit();
            //string filePath = Path.GetFullPath("..\\..\\..\\Media\\yifu.obj");
            string filePath = Path.GetFullPath("..\\..\\..\\Media\\skirt2.obj");
            //mClothTexture = this.Game.Content.Load<Texture2D>("..\\..\\..\\Media\\uvs.jpg");
            mClothTexture = this.Game.Content.Load<Texture2D>("uvs");

            // collision spheres
            unsafe
            {
                //gBoxPosition = new Vector3(-0.2216031f, 0.4518394f, 1.912647f);
                //gBoxPosition = new Vector3(0, 0, 3.5f);
                //gBoxRadius = 5.0f;
                //float[] collRadius = { gBoxRadius };
                //float[] collPos = { gBoxPosition.X, gBoxPosition.Y, gBoxPosition.Z };
                //int[] collIdxPair = { };
                // scale
                for (int i = 0; i < 31; ++i)
                {
                    gCollPos[3 * i] *= 10.0f;
                    gCollPos[3 * i + 1] *= 10.0f;
                    gCollPos[3 * i + 2] *= 10.0f;
                    gCollPos[3 * i + 2] = 1.00f;
                    gCollRadius[i] *= 12.0f;
                    //gCollRadius[i] = 0.2f;
                }
                mCloth.addCollisionSpheres(31, gCollPos, gCollRadius, 60, gCollIndexPair);
            }
            float[] offset = {0, -14.0f, 0};
            mCloth.createCloth(filePath, 10.0f, offset);

            // box
            for (int i = 0; i < 31; ++i)
            {
                gBoxPosition[i] = new Vector3(gCollPos[3 * i], gCollPos[3 * i + 1], gCollPos[3 * i + 2]);
            }

            // cloth details
            unsafe
            {
                mNbIndices = mCloth.getClothIndicesCount();
                mIndexData = new int[mNbIndices];
                mCloth.getClothIndicesContent(mIndexData);

                mNbVertices = mCloth.getClothParticesCount();
                mVertexData = new VertexPositionNormalTexture[mNbVertices];
                mVertexStream = new float[mNbVertices * 3];
                mNormalStream = new float[mNbVertices * 3];

                mTextureStream = new float[mNbVertices * 2];
                mCloth.getClothTextureStream(mTextureStream);
            }

             this.effect = new BasicEffect(this.GraphicsDevice);
        }
Example #3
0
 internal static HandleRef getCPtr(CGePhysX obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }