Example #1
0
        public static BoneAccessor Get(string name)
        {
            sbyte *n   = (sbyte *)Marshal.StringToHGlobalAnsi(name);
            var    mod = IEngineStudio.Mod_ForName(n, true);

            Marshal.FreeHGlobal((IntPtr)n);
            return(new TPoseBoneAccessor(IEngineStudio.Mod_Extradata(mod)));
        }
Example #2
0
 private static unsafe void SetEngineStudioAPI(void *pEngineStudioAPI)
 {
     IEngineStudio.Init((EngineStudioAPI *)pEngineStudioAPI);
     //register goldsrc global variables
     //拿到金源引擎的API,使物理引擎可以访问缓存的模型信息、地图信息等
     BWorld.CreateInstance();
     StudioRenderer.Init();
     StudioRenderer.Drawer = BWorld.Instance.DebugDrawer;
     //Validation
     //if ((void*)(&StudioRenderer.NativePointer->m_plighttransform) != lastFieldAddress)
     //    throw new Exception("Studio model renderer is invalid.");
 }
        /// <summary>
        /// Build ragdoll to the best of its ability.
        /// </summary>
        /// <returns></returns>
        private static unsafe Ragdoll BuildInternal(string modelName)
        {
            // try build from file

            // otherwise using build options to auto calc ragdoll.
            IntPtr pName = Marshal.StringToHGlobalAnsi(modelName);
            var    model = IEngineStudio.Mod_ForName((sbyte *)pName, true);

            Marshal.FreeHGlobal(pName);
            var hdr = IEngineStudio.Mod_Extradata(model);

            throw new NotImplementedException();
        }
        private static BippedBone GenerateBippedBone(model_t *pModel)
        {
            var        pStudioModel = IEngineStudio.Mod_Extradata(pModel);
            BippedBone result       = new BippedBone();

            // If there exist any naming convension to find all index great than 0.
            if (_boneNamings.Any(
                    x => _namingFields.All(
                        field =>
            {
                var index = GetBoneIndex((string)field.GetValue(x), pStudioModel);
                _bippedBoneType.GetField(field.Name).SetValue(result, index);
                return(index > 0);
            })
                    ))
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        public static BoneAccessor Get(int index)
        {
            var mod = IEngineStudio.GetModelByIndex(index);

            return(new TPoseBoneAccessor(IEngineStudio.Mod_Extradata(mod)));
        }
 public unsafe static Ragdoll Build(model_t *model)
 {
     return(BuildBipped(IEngineStudio.Mod_Extradata(model), BippedBoneManager.GetBippedBone(model), BoneAccessor.Get(IEngineStudio.Mod_Extradata(model))));
 }