示例#1
0
/*
 *      private void CreateWindow(string window_name, int x, int y, int width, int height)
 *      {
 *          const float wi = 1305;
 *          const float hi = 768;
 *          var node = UI_node.CreateChild(window_name);
 *          float xx = x / wi;
 *          float yy = y / hi;
 *          float w = width / wi;
 *          float h = height / hi;
 *
 *          float[] vd = {
 *              //front
 *              0.0f, 0.0f, -0.0f,     0.0f,  0.0f, 1.0f,   0, 1,  //0
 *              0.0f, 1.0f, -0.0f,     0.0f,  0.0f, 1.0f,   0, 0,  //1
 *              1.0f, 1.0f, -0.0f,     0.0f,  0.0f, 1.0f,   1, 0,  //2
 *
 *              1.0f, 1.0f, -0.0f,     0.0f,  0.0f, 1.0f,   1, 0,  //2
 *              1.0f, 0.0f, -0.0f,     0.0f,  0.0f, 1.0f,   1, 1,  //3
 *              0.0f, 0.0f, -0.0f,     0.0f,  0.0f, 1.0f,   0, 1,  //0
 *          };
 *
 *          for (var i = 0; i < vd.Length; i += 8)
 *          {
 *              if (vd[i + 0] == 0.0f)
 *                  vd[i + 0] = xx;
 *              else
 *                  vd[i + 0] = xx + w;
 *
 *              if (vd[i + 1] == 0.0f)
 *                  vd[i + 1] = yy - h;
 *              else
 *                  vd[i + 1] = yy;
 *          }
 *          var model = app.CreateModel(vd, id, new BoundingBox(-1, 1));
 *          var staticModel = app.CreateStaticModel(UI_node, model, materialUI);
 *      }
 */
        private void CreateWindow(string window_name, int x, int y, int width, int height)
        {
            const float wi   = 1305;
            const float hi   = 768;
            var         node = UI_node.CreateChild(window_name);

            //node.Position = new Vector3(x,y,0);

            float[] vd =
            {
                //front
                -1.0f, -1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 0, 1,         //0
                -1.0f,  1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 0, 0,         //1
                1.0f,   1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 1, 0,         //2

                1.0f,   1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 1, 0,         //2
                1.0f,  -1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 1, 1,         //3
                -1.0f, -1.0f, 1.1f, 1.0f, 1.0f, 1.0f, 0, 1,         //0
            };

            for (var i = 0; i < vd.Length; i += 8)
            {
                vd[i + 0] *= 1;
                vd[i + 1] *= 0.88f;
                //vd[i+2] = vec.Z;
            }

            var model       = app.CreateModel(vd, id, new BoundingBox(-1, 1));
            var staticModel = app.CreateStaticModel(node, model, materialUI);
        }