MDLAsset 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
MDLAsset() |
默认构造函数,初始化此类的新实例。 |
MDLAsset(NSObjectFlag) |
在派生类上调用 的构造函数,以跳过初始化并仅分配 对象。 |
MDLAsset(NSUrl) |
通过在指定的 URL 处加载文件来创建新的 MDLAsset。 |
MDLAsset(IMDLMeshBufferAllocator) |
使用提供的 |
MDLAsset(IntPtr) |
创建非托管对象的托管表示形式时使用的构造函数;由运行时调用。 |
MDLAsset(NSUrl, MDLVertexDescriptor, IMDLMeshBufferAllocator) |
通过将指定 URL 处的文件加载到缓冲区分配器提供的缓冲区中,并格式化内存中的数据(如顶点描述符所述)来创建新的 MDLAsset。 |
MDLAsset(NSUrl, MDLVertexDescriptor, IMDLMeshBufferAllocator, Boolean, NSError) |
通过将指定 URL 处的文件加载到缓冲区分配器提供的缓冲区中,并格式化内存中的数据(如顶点描述符所述)来创建新的 MDLAsset。 |
MDLAsset()
MDLAsset(NSObjectFlag)
在派生类上调用 的构造函数,以跳过初始化并仅分配 对象。
protected MDLAsset (Foundation.NSObjectFlag t);
new ModelIO.MDLAsset : Foundation.NSObjectFlag -> ModelIO.MDLAsset
参数
未使用的 sentinel 值,传递 NSObjectFlag.Empty。
注解
当派生类在托管代码中完全构造对象并且仅希望运行时分配和初始化 NSObject 时,应调用此构造函数。 这是实现 Objective-C 使用的两步初始化过程所必需的,第一步是执行对象分配,第二步是初始化对象。 当开发人员调用采用 NSObjectFlag.Empty 的构造函数时,他们利用直接路径(一直一直指向 NSObject)来仅分配对象的内存并将 Objective-C 和 C# 对象绑定在一起。 对象的实际初始化由开发人员决定。
绑定生成器通常使用此构造函数来分配对象,但会阻止实际初始化。 分配完成后,构造函数必须初始化 对象。 对于绑定生成器生成的构造函数,这意味着它会手动调用其中一个“init”方法来初始化对象。
如果对象使用 NSObjectFlag.Empty 路径链接起来,则开发人员负责完全初始化对象。
通常,如果开发人员的构造函数调用 NSObjectFlag.Empty 基实现,则它应调用 Objective-C init 方法。 如果不是这种情况,开发人员应改为链接到其类中的适当构造函数。
参数值将被忽略,仅确保执行的唯一代码是构造阶段是基本的 NSObject 分配和运行时类型注册。 通常,链接如下所示:
//
// The NSObjectFlag merely allocates the object and registers the
// C# class with the Objective-C runtime if necessary, but no actual
// initXxx method is invoked, that is done later in the constructor
//
// This is taken from Xamarin.iOS's source code:
//
[Export ("initWithFrame:")]
public UIView (System.Drawing.RectangleF frame) : base (NSObjectFlag.Empty)
{
// Invoke the init method now.
var initWithFrame = new Selector ("initWithFrame:").Handle;
if (IsDirectBinding)
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_CGRect (this.Handle, initWithFrame, frame);
else
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect (this.SuperHandle, initWithFrame, frame);
}
适用于
MDLAsset(NSUrl)
通过在指定的 URL 处加载文件来创建新的 MDLAsset。
[Foundation.Export("initWithURL:")]
public MDLAsset (Foundation.NSUrl url);
new ModelIO.MDLAsset : Foundation.NSUrl -> ModelIO.MDLAsset
参数
- url
- NSUrl
- 属性
适用于
MDLAsset(IMDLMeshBufferAllocator)
使用提供的 bufferAllocator
创建新的模型 IO 资产。
[Foundation.Export("initWithBufferAllocator:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 12, ObjCRuntime.PlatformArchitecture.All, null)]
public MDLAsset (ModelIO.IMDLMeshBufferAllocator bufferAllocator);
new ModelIO.MDLAsset : ModelIO.IMDLMeshBufferAllocator -> ModelIO.MDLAsset
参数
- 属性
适用于
MDLAsset(IntPtr)
创建非托管对象的托管表示形式时使用的构造函数;由运行时调用。
protected internal MDLAsset (IntPtr handle);
new ModelIO.MDLAsset : nativeint -> ModelIO.MDLAsset
参数
- handle
-
IntPtr
nativeint
指向非托管对象的指针 (句柄) 。
注解
此构造函数由运行时基础结构 (GetNSObject(IntPtr)) 调用,以便为指向非托管 Objective-C 对象的指针创建新的托管表示形式。 开发人员不应直接调用此方法,而是应调用 GetNSObject 方法,因为它将阻止托管对象的两个实例指向同一本机对象。
适用于
MDLAsset(NSUrl, MDLVertexDescriptor, IMDLMeshBufferAllocator)
通过将指定 URL 处的文件加载到缓冲区分配器提供的缓冲区中,并格式化内存中的数据(如顶点描述符所述)来创建新的 MDLAsset。
[Foundation.Export("initWithURL:vertexDescriptor:bufferAllocator:")]
public MDLAsset (Foundation.NSUrl url, ModelIO.MDLVertexDescriptor vertexDescriptor, ModelIO.IMDLMeshBufferAllocator bufferAllocator);
new ModelIO.MDLAsset : Foundation.NSUrl * ModelIO.MDLVertexDescriptor * ModelIO.IMDLMeshBufferAllocator -> ModelIO.MDLAsset
参数
- url
- NSUrl
- 属性
适用于
MDLAsset(NSUrl, MDLVertexDescriptor, IMDLMeshBufferAllocator, Boolean, NSError)
通过将指定 URL 处的文件加载到缓冲区分配器提供的缓冲区中,并格式化内存中的数据(如顶点描述符所述)来创建新的 MDLAsset。
[Foundation.Export("initWithURL:vertexDescriptor:bufferAllocator:preserveTopology:error:")]
public MDLAsset (Foundation.NSUrl url, ModelIO.MDLVertexDescriptor vertexDescriptor, ModelIO.IMDLMeshBufferAllocator bufferAllocator, bool preserveTopology, out Foundation.NSError error);
new ModelIO.MDLAsset : Foundation.NSUrl * ModelIO.MDLVertexDescriptor * ModelIO.IMDLMeshBufferAllocator * bool * -> ModelIO.MDLAsset
参数
- preserveTopology
- Boolean
- error
- NSError
- 属性