Пример #1
0
        public GLVao getCollisionMeshVao(MeshMetaData metaData)
        {
            //Collision Mesh isn't used anywhere else.
            //No need to check for hashes and shit

            float[] vx_buffer_float = new float[(metaData.boundhullend - metaData.boundhullstart) * 3];

            for (int i = 0; i < metaData.boundhullend - metaData.boundhullstart; i++)
            {
                Vector3 v = bhullverts[i + metaData.boundhullstart];
                vx_buffer_float[3 * i + 0] = v.X;
                vx_buffer_float[3 * i + 1] = v.Y;
                vx_buffer_float[3 * i + 2] = v.Z;
            }

            //Generate intermediate geom
            GeomObject temp_geom = new GeomObject();

            //Set main Geometry Info
            temp_geom.vertCount     = vx_buffer_float.Length / 3;
            temp_geom.indicesCount  = metaData.batchcount;
            temp_geom.indicesLength = indicesLength;

            //Set Strides
            temp_geom.vx_size = 3 * 4; //3 Floats * 4 Bytes each

            //Set Buffer Offsets
            temp_geom.offsets = new int[7];
            temp_geom.bufInfo = new List <GMDL.bufInfo>();

            for (int i = 0; i < 7; i++)
            {
                temp_geom.bufInfo.Add(null);
                temp_geom.offsets[i] = -1;
            }

            temp_geom.mesh_descr = "vn";
            temp_geom.offsets[0] = 0;
            temp_geom.offsets[2] = 0;
            temp_geom.bufInfo[0] = new GMDL.bufInfo(0, VertexAttribPointerType.Float, 3, 0, 0, "vPosition", false);
            temp_geom.bufInfo[2] = new GMDL.bufInfo(2, VertexAttribPointerType.Float, 3, 0, 0, "nPosition", false);

            //Set Buffers
            temp_geom.ibuffer = new byte[temp_geom.indicesLength * metaData.batchcount];
            temp_geom.vbuffer = new byte[sizeof(float) * vx_buffer_float.Length];

            System.Buffer.BlockCopy(ibuffer, metaData.batchstart_physics * temp_geom.indicesLength, temp_geom.ibuffer, 0, temp_geom.ibuffer.Length);
            System.Buffer.BlockCopy(vx_buffer_float, 0, temp_geom.vbuffer, 0, temp_geom.vbuffer.Length);


            return(temp_geom.generateVAO());
        }
Пример #2
0
        public Mesh(Mesh input) : base(input)
        {
            //Copy attributes
            this.metaData = new MeshMetaData(input.metaData);

            //Copy Vao Refs
            this.meshVao = input.meshVao;

            //Material Stuff
            this.color = input.color;

            this.palette = input.palette;
            this.gobject = input.gobject; //Leave geometry file intact, no need to copy anything here
        }
Пример #3
0
        public void copyFrom(Mesh input)
        {
            //Copy attributes
            metaData = new MeshMetaData(input.metaData);
            hasLOD   = input.hasLOD;

            //Copy Vao Refs
            meshVao = input.meshVao;

            //Material Stuff
            color = input.color;

            palette = input.palette;
            gobject = input.gobject;

            base.copyFrom(input);
        }
Пример #4
0
 public void copyFrom(Scene input)
 {
     base.copyFrom(input); //Copy base stuff
     gobject = input.gobject;
     texMgr  = input.texMgr;
 }
Пример #5
0
 public Scene(Scene input) : base(input)
 {
     gobject = input.gobject;
 }