示例#1
0
        public unsafe IMesh[] Import(string fileName)
        {
            var newMeshes = new List <IMesh>();
            var context   = new AssimpContext();
            var scene     = context.ImportFile(fileName);

            foreach (var mesh in scene.Meshes)
            {
                var newMesh = _packet.CreateScoped <IMesh>();
                var indices = new List <uint>();
                var vertex  = new List <PositionNormalUVTIDVertex>();
                foreach (var face in mesh.Faces)
                {
                    indices.AddRange((IEnumerable <uint>)face.Indices);
                }

                for (var i = 0; i < mesh.VertexCount; i++)
                {
                    var vertice = mesh.Vertices[i];
                    var normal  = mesh.Normals[i];
                    vertex.Add(new PositionNormalUVTIDVertex(*(Vector3 *)&vertice, *(Vector3 *)&normal, new Vector2(0), 0));
                }
                newMesh.VertexArray = vertex;
                newMesh.IndexArray  = indices;
                newMesh.ModelMatrix = Matrix.Identity;
                // TODO: copy material stuff.
                // newMesh.Material =

                newMeshes.Add(newMesh);
            }
            return(newMeshes.ToArray());
        }
示例#2
0
        public void Start(TaskArgs args)
        {
            var provider = _packet.CreateScoped <IWindowProvider>();

            provider.Adopt <MainWindow>();
            provider.Start();
        }
示例#3
0
 public GLWindowProvider(ModulePacket packet) :
     base(GameWindowSettings.Default, new NativeWindowSettings()
 {
     Size = new OpenTK.Mathematics.Vector2i(1600, 900), APIVersion = new Version(4, 6)
 })
 {
     _packet      = packet;
     _taskManager = packet.CreateScoped <ITaskManager>();
     FrameQueue   = new Queue <Action>();
 }
示例#4
0
 public SDKBase(ModulePacket packet)
 {
     _parser = packet.CreateScoped <IParser>();
 }