public async System.Threading.Tasks.Task <CPhyShape> CreateShapeTriMesh(CPhyMaterial material, RName geomName, Vector3 scale, Quaternion scaleRot) { var geoms = await CEngine.Instance.PhyGeomManager.GetPhyGeomsAsync(geomName); if (geoms == null) { return(null); } var blob = geoms.TriMesh; if (blob == null) { return(null); } unsafe { var ptr = SDK_PhyContext_CreateShapeTriMesh(CoreObject, material.CoreObject, blob.CoreObject, &scale, &scaleRot); if (ptr.GetPointer() == IntPtr.Zero) { return(null); } var result = new CPhyShape(ptr, material, geomName); result.TriGeom = geoms; return(result); } }
public CPhyMaterial LoadMaterial(RName name) { CPhyMaterial result; if (Materials.TryGetValue(name, out result)) { return(result); } using (IO.XndHolder xnd = IO.XndHolder.SyncLoadXND(name.Address)) { if (xnd == null) { return(null); } var attr = xnd.Node.FindAttrib("Params"); if (attr == null) { return(null); } result = CPhyMaterial.LoadXnd(this, attr); Materials.Add(name, result); return(result); } }
public CPhyShape CreateShapeTriMeshSync(CPhyMaterial material, RName geomName, Vector3 scale, Quaternion scaleRot) { var geoms = CEngine.Instance.PhyGeomManager.GetPhyGeomsSync(geomName); if (geoms == null) { return(null); } var blob = geoms.TriMesh; if (blob == null) { return(null); } unsafe { var ptr = SDK_PhyContext_CreateShapeTriMesh(CoreObject, material.CoreObject, blob.CoreObject, &scale, &scaleRot); if (ptr.GetPointer() == IntPtr.Zero) { return(null); } return(new CPhyShape(ptr, material, geomName)); } }
public CPhyShape(NativePointer self, CPhyMaterial materal, RName meshname = null) : base(self) { mMaterial = materal; }
public CPhyShape CreateShapeCapsule(CPhyMaterial material, float radius, float halfHeight) { var ptr = SDK_PhyContext_CreateShapeCapsule(CoreObject, material.CoreObject, radius, halfHeight); return(new CPhyShape(ptr, material)); }
public CPhyShape CreateShapeSphere(CPhyMaterial material, float radius) { var ptr = SDK_PhyContext_CreateShapeSphere(CoreObject, material.CoreObject, radius); return(new CPhyShape(ptr, material)); }
public CPhyShape CreateShapeBox(CPhyMaterial material, float width, float height, float length) { var ptr = SDK_PhyContext_CreateShapeBox(CoreObject, material.CoreObject, width, height, length); return(new CPhyShape(ptr, material)); }
public CPhyShape CreateShapePlane(CPhyMaterial material) { var ptr = SDK_PhyContext_CreateShapePlane(CoreObject, material.CoreObject); return(new CPhyShape(ptr, material)); }
public void SetMaterial(CPhyMaterial mtl) { SDK_PhyControllerDesc_SetMaterial(CoreObject, mtl.CoreObject); }