Ejemplo n.º 1
0
        public async System.Threading.Tasks.Task <ResourceInfo> CreateEmptyResource(string Absfolder, string rootFolder, EditorCommon.Resources.IResourceCreateData createData)
        {
            await EngineNS.Thread.AsyncDummyClass.DummyFunc();

            var result = new MeshResourceInfo();

            var mcd = createData as MeshCreateData;

            if (EngineNS.CEngine.Instance.FileManager.GetFileExtension(mcd.ResourceName) != EngineNS.CEngineDesc.MeshExtension)
            {
                mcd.ResourceName = mcd.ResourceName + EngineNS.CEngineDesc.MeshExtension;
            }
            var reName = EngineNS.CEngine.Instance.FileManager._GetRelativePathFromAbsPath(Absfolder + "/" + mcd.ResourceName, rootFolder);

            result.ResourceName = RName.GetRName(reName, mcd.RNameType);
            var vmsInfo = await EditorCommon.Resources.ResourceInfoManager.Instance.CreateResourceInfoFromFile(mcd.GeomMesh.Address + ".rinfo", null) as MeshSourceResourceInfo;

            result.SkeletonAsset = vmsInfo.SkeletonAsset;
            RName meshPrimitives = mcd.GeomMesh;
            //var shadingEnv = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv(mcd.ShadingEnv);
            var mCurMesh = EngineNS.CEngine.Instance.MeshManager.NewMesh(
                EngineNS.CEngine.Instance.RenderContext,
                result.ResourceName, meshPrimitives /*, shadingEnv*/);
            var mtl = EngineNS.CEngine.Instance.MaterialInstanceManager.DefaultMaterialInstance;

            for (UInt32 i = 0; i < mCurMesh.MtlMeshArray.Length; i++)
            {
                await mCurMesh.SetMaterialInstanceAsync(EngineNS.CEngine.Instance.RenderContext, i, mtl, null);
            }
            mCurMesh.SaveMesh();

            return(result);
        }
Ejemplo n.º 2
0
        protected override async System.Threading.Tasks.Task <ResourceInfo> CreateResourceInfoFromResourceOverride(RName resourceName)
        {
            await EngineNS.Thread.AsyncDummyClass.DummyFunc();

            var retValue = new MeshResourceInfo();

            retValue.ResourceName = resourceName;
            retValue.ResourceType = EngineNS.Editor.Editor_RNameTypeAttribute.Mesh;

            return(retValue);
        }