Esempio n. 1
0
        //Constructor
        public Mesh() : base()
        {
            type     = TYPES.MESH;
            metaData = new MeshMetaData();

            //Init MeshModel Uniforms
            foreach (string un in supportedCommonPerMeshUniforms)
            {
                Uniform my_un = new Uniform(un);
                _CommonPerMeshUniforms[my_un.Name] = my_un;
            }
        }
Esempio n. 2
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());
        }
Esempio n. 3
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
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
 public MeshMetaData(MeshMetaData input)
 {
     //Init values to null
     vertrend_graphics   = input.vertrend_graphics;
     vertrstart_graphics = input.vertrstart_graphics;
     vertrend_physics    = input.vertrend_physics;
     vertrstart_physics  = input.vertrstart_physics;
     batchstart_graphics = input.batchstart_graphics;
     batchstart_physics  = input.batchstart_physics;
     batchcount          = input.batchcount;
     firstskinmat        = input.firstskinmat;
     lastskinmat         = input.lastskinmat;
     boundhullstart      = input.boundhullstart;
     boundhullend        = input.boundhullend;
     Hash          = input.Hash;
     LODLevel      = input.LODLevel;
     indicesLength = input.indicesLength;
     AABBMIN       = new Vector3(input.AABBMIN);
     AABBMAX       = new Vector3(input.AABBMAX);
 }
Esempio n. 6
0
 public GLMeshVao(MeshMetaData data)
 {
     vao      = new GLVao();
     metaData = new MeshMetaData(data);
 }