Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 public CGfxMdfQueue CloneMdfQueue(CRenderContext rc, CGfxMdfQueue oldMdfQueue)
 {
     if (oldMdfQueue == null)
     {
         var mdfQueue = new CGfxMdfQueue();
         foreach (var i in Modifiers)
         {
             var modifier = i.CloneModifier(rc);
             mdfQueue.AddModifier(modifier);
         }
         return(mdfQueue);
     }
     else
     {
         return(oldMdfQueue);
     }
 }