public bool LoadMesh(CRenderContext rc, RName name, bool firstLoad)
        {
            using (var xnd = IO.XndHolder.SyncLoadXND(name.Address))
            {
                if (xnd == null)
                {
                    return(false);
                }

                if (false == SDK_GfxMeshPrimitives_LoadXnd(CoreObject, rc.CoreObject, name.Name, xnd.Node.CoreObject, firstLoad))
                {
                    return(false);
                }

                mName         = name;
                mGeometryMesh = new CGeometryMesh(SDK_GfxMeshPrimitives_GetGeomtryMesh(CoreObject));
                mMdfQueue     = new CGfxMdfQueue(rc, SDK_GfxMeshPrimitives_GetMdfQueue(CoreObject));

                var modQueueNode = xnd.Node.FindNode("ModStacks");
                if (modQueueNode != null)
                {
                    var mdfs = modQueueNode.GetNodes();
                    foreach (var i in mdfs)
                    {
                        if (i.GetClassId() == CGfxSkinModifier.CoreClassId)//GfxSkinModifier
                        {
                            //var rtti = CEngine.Instance.NativeRttiManager.FindRttiById(i.GetClassId());
                            //CGfxModifier.NativePointer corePtr = new CGfxModifier.NativePointer();
                            //corePtr.Pointer = rtti.CreateInstance("CGfxMeshPrimitives.cs", 117);
                            var skinModifier = new CGfxSkinModifier();
                            skinModifier.LoadXnd(i);
                            mMdfQueue.AddModifier(skinModifier);
                        }
                    }
                }

                if (firstLoad)
                {
                    ResourceState.StreamState = EStreamingState.SS_Valid;
                }
                else
                {
                    ResourceState.StreamState = EStreamingState.SS_Invalid;
                }
                return(true);
            }
        }
Exemple #2
0
 //Only For Import
 public void SyncNativeModifiers()
 {
     for (uint i = 0; i < MdfNumber; ++i)
     {
         Modifiers.Clear();
         var native = SDK_GfxMdfQueue_GetModifier(CoreObject, i);
         if (native.Pointer == IntPtr.Zero)
         {
             return;
         }
         var rtti = SDK_VIUnknown_GetRtti(native.Pointer);
         if (Rtti.NativeRtti.SDK_CoreRtti_GetClassId(rtti) == CGfxSkinModifier.CoreClassId)
         {
             var skinModifier = new CGfxSkinModifier(native);
             skinModifier.AnimationPose = skinModifier.SkinSkeleton.CreateSkeletonPose();
             Modifiers.Add(skinModifier);
         }
     }
 }