SCNNode类

    xiaoxiao2021-12-12  10

    //  SCNNode.h

    //  Copyright (c) 2012-2016 Apple Inc. All rights reserved.

    #import <SceneKit/SCNAnimation.h>

    #import <SceneKit/SCNBoundingVolume.h>

    #import <SceneKit/SCNAction.h>

    NS_ASSUME_NONNULL_BEGIN

    @class CIFilter;//过滤器 筛选

    @class SCNLight;//灯光

    @class SCNCamera;//相机

    @class SCNGeometry;//几何学

    @class SCNSkinner;

    @class SCNMorpher;//变形器

    @class SCNConstraint;//约束

    @class SCNPhysicsBody;//物理体

    @class SCNPhysicsField;//物理领域

    @class SCNPhysicsBody;

    @class SCNHitTestResult;//点击测试结果

    @class SCNRenderer;//渲染器

    @protocol SCNNodeRendererDelegate;// 节点渲染代理

    /*! @group Rendering arguments (渲染参数组)

        @discussion These keys are used for the 'semantic' argument of-[SCNProgram setSemantic:forSymbol:options:](这些键用于-[SCNProgram setSemantic:forSymbol:options:]的'semantic'参数:)

                    Transforms are SCNMatrix4 wrapped in NSValues.(转换是用NSValues包装的SCNMatrix4。)

     */

    FOUNDATION_EXTERN NSString *const SCNModelTransform;//模型转换

    FOUNDATION_EXTERN NSString *const SCNViewTransform;//视图转换

    FOUNDATION_EXTERN NSString *const SCNProjectionTransform;//投影转换

    FOUNDATION_EXTERN NSString *const SCNNormalTransform;//正常转换

    FOUNDATION_EXTERN NSString *const SCNModelViewTransform;//正常模型视图转换

    FOUNDATION_EXTERN NSString *const SCNModelViewProjectionTransform;//模型视图投影转换

    /*! @enum SCNMovabilityHint(可移动的提示) 

     @abstract The available modes of movability.(可用的可移动模式)

     @discussion Movable nodes are not captured when computing light probes. Fixed nodes are not lit by probes.(计算光探头时不会捕获可移动节点。 固定节点不被探测器点亮。)

      Also Movable nodes are not blurred by the motion blur.(此外,可移动节点不被运动模糊模糊。)

     */

    typedef NS_ENUM(NSInteger, SCNMovabilityHint) {

        SCNMovabilityHintFixed,//fixed 固定的

        SCNMovabilityHintMovable,//Movable 可移动的

    } API_AVAILABLE(macosx(10.12), ios(10.0), tvos(10.0));

    /*!

     @class SCNNode(节点)

     @abstract SCNNode is the model class for node-tree objects.(SCNNode是节点树对象的模型类)

     @discussion It encapsulates the position, rotations, and other transforms of a node, which define a coordinate system.(它封装了定义坐标系统的节点位置,旋转和其他变换)

       The coordinate systems of all the sub-nodes are relative to the one of their parent node.(所有子节点的坐标系相对于它们的父节点之一。)

     */

    @interface SCNNode :NSObject <NSCopying,NSSecureCoding,SCNAnimatable,SCNActionable,SCNBoundingVolume>

    #pragma mark - Creating a Node

    /*! 

     @method node(节点)

     @abstract Creates and initializes a node instance.(创造和初始化一个节点实例)

     */

    + (instancetype)node;

    /*! 

     @method nodeWithGeometry:

     @abstract Creates and initializes a node instance with the specified geometry attached.(创建并初始化附加了指定几何的节点实例。)

     @param geometry(几何/几何体) The geometry to attach.(要附加的几何体)

     */

    + (SCNNode *)nodeWithGeometry:(nullableSCNGeometry *)geometry;

    #pragma mark - Copying the Node(复制节点)

    /*!

     @method clone

     @abstract Returns a copy of the receiver. The returned instance is autoreleased.(返回接收器的副本。 返回的实例是自动释放的。)

     @discussion The copy is recursive: every child node will be cloned, too. For a non-recursive copy, use copy instead.(复制是递归的:每个子节点也将被克隆。 对于非递归复制,请改用复制。)

      The copied nodes will share their attached objects (light, geometry, camera, ...) with the original instances;(复制的节点将与原始实例共享其附加对象(光,几何,摄像机,...)

      if you want, for example, to change the materials of the copy independently of the original object, you'll have to copy the geometry of the node separately.(如果您想要独立于原始对象更改副本的材质,则必须单独复制节点的几何。)

    - (instancetype)clone;

    /*

     @method flattenedClone(平面克隆)

     @abstract Returns a clone of the node containing a geometry that concatenates all the geometries contained in the node hierarchy.(返回包含连接节点层次结构中包含的所有几何的几何的节点的克隆。)

      The returned clone is autoreleased.(返回的克隆是自动释放的)

     */

    - (instancetype)flattenedCloneAPI_AVAILABLE(macosx(10.9));

    #pragma mark - Managing the Node Attributes(管理节点属性)

    /*!

     @property name

     @abstract Determines the name of the receiver.(确定接收器的名称)

     */

    @property(nonatomic,copy,nullable)NSString *name;

    /*!

     @property light

     @abstract Determines the light attached to the receiver.(确定附加到接收器的光)

     */

    @property(nonatomic,retain,nullable)SCNLight *light;

    /*!

     @property camera

     @abstract Determines the camera attached to the receiver.(确定附加到接收器的相机)

     */

    @property(nonatomic,retain,nullable)SCNCamera *camera;

    /*!

     @property geometry

     @abstract Returns the geometry attached to the receiver.(返回附加到接收器的几何体)

     */

    @property(nonatomic,retain,nullable)SCNGeometry *geometry;

    /*!

     @property skinner

     @abstract Returns the skinner attached to the receiver.(返回附加到接收器的skinner)

     */

    @property(nonatomic,retain,nullable)SCNSkinner *skinnerAPI_AVAILABLE(macosx(10.9));

    /*!

     @property morpher(形态结构贴图)

     @abstract Returns the morpher attached to the receiver.(返回附加到接收器的形态结构贴图)

     */

    @property(nonatomic,retain,nullable)SCNMorpher *morpherAPI_AVAILABLE(macosx(10.9));

    #pragma mark - Modifying the Node′s Transform(修饰节点的改变)

    /*! 

     @property transform(改变)

     @abstract Determines the receiver's transform. Animatable.(确定接收器的变化.动画)

     @discussion The transform is the combination of the position, rotation and scale defined below. So when the transform is set, the receiver's position, rotation and scale are changed to match the new transform.(变换是下面定义的位置,旋转和刻度的组合。 因此,当设置变换时,接收器的位置,旋转和缩放比例将更改为匹配新的变换)

     */

    @property(nonatomic)SCNMatrix4 transform;

    /*! 

     @property position(位置)

     @abstract Determines the receiver's position. Animatable.(确定接收器的位置.动画)

     */

    @property(nonatomic)SCNVector3 position;

    /*! 

     @property rotation(旋转)

     @abstract Determines the receiver's rotation. Animatable.(确定接收器的旋转.动画)

     @discussion The rotation is axis angle rotation. The three first components are the axis, the fourth one is the rotation (in radian).(旋转是轴角旋转。 三个第一分量是轴,第四分量是旋转(弧度))

     */

    @property(nonatomic)SCNVector4 rotation;

    /*!

     @property orientation(方向)

     @abstract Determines the receiver's orientation as a unit quaternion. Animatable.(将接收器的方向确认为方向四元数.动画)

     */

    @property(nonatomic)SCNQuaternion orientationAPI_AVAILABLE(macosx(10.10));

    /*!

     @property eulerAngles

     @abstract Determines the receiver's euler angles. Animatable.

     @dicussion The order of components in this vector matches the axes of rotation:

                     1. Pitch (the x component) is the rotation about the node's x-axis (in radians)

                     2. Yaw   (the y component) is the rotation about the node's y-axis (in radians)

                     3. Roll  (the z component) is the rotation about the node's z-axis (in radians)

                SceneKit applies these rotations in the reverse order of the components:

                   1. first roll

                   2. then yaw

                   3. then pitch

    -----------------------------------      小知识扩展分割线     ---------------------------------------------

    欧拉角Eulerian angles用来确定定点转动刚体位置的3个一组独立角参量,由章动角 θ、旋进角(即进动角)ψ和自转角j组成。

    -----------------------------------      小知识扩展分割线     ---------------------------------------------

     @property 欧拉角(更深层次了解点击)

     @abstract  确认接收器的欧拉角.动画

     @dicussion  此向量中组件的顺序与旋转轴相匹配:

             1.节距(x分量)是关于节点x轴的旋转(以弧度表示)                   2.Yaw(y分量)是围绕节点的y轴的旋转(以弧度表示)                   3.滚动(z分量)是关于节点的z轴的旋转(以弧度表示)

                    SceneKit以与组件相反的顺序应用这些旋转:                   1.首先滚动/转动                   2.然后偏航                   3.然后俯仰

     */

    @property(nonatomic)SCNVector3 eulerAnglesAPI_AVAILABLE(macosx(10.10));

    /*! 

     @property scale(规模/比例)

     @abstract Determines the receiver's scale. Animatable.(确定接收器比例.动画)

     */

    @property(nonatomic)SCNVector3 scale;

    /*! 

     @property pivot(枢轴/中心)

     @abstract Determines the receiver's pivot. Animatable.(确定接收器的中心.动画)

     */

    @property(nonatomic)SCNMatrix4 pivot;

    /*! 

     @property worldTransform

     @abstract Returns the receiver's world transform.(返回接收器的世界改变)

     @discussion A world transform is the transform relative to the scene. (一个世界变化是相对于场景变化的)

     */

    @property(nonatomic,readonly)SCNMatrix4 worldTransform;

    #pragma mark - Modifying the Node′s Visibility(修饰节点的可见性)

    /*! 

     @property hidden(隐藏)

     @abstract Determines whether the receiver is displayed. Defaults to NO. Animatable.(确认是否显示接收器.默认为NO.动画)

     */

    @property(nonatomic,getter=isHidden)BOOL hidden;

    /*! 

     @property opacity(不透明的/不透明度)

     @abstract Determines the opacity of the receiver. Default is 1. Animatable.(确认接收器的不透明度.默认为1.动画)

     */

    @property(nonatomic)CGFloat opacity;

    /*!

     @property renderingOrder(渲染顺序/渲染命令)

     @abstract Determines the rendering order of the receiver.(确定接收器的渲染顺序)

     @discussion Nodes with greater rendering orders are rendered last. Defaults to 0.(渲染顺序是最后渲染最大节点.默认为0)

     */

    @property(nonatomic)NSInteger renderingOrder;

    /*!

     @property castsShadow(投下阴影)

     @abstract Determines if the node is rendered in shadow maps. Defaults to YES.(确定节点是否在阴影贴图中呈现.默认为YES)

     */

    @property(nonatomic)BOOL castsShadowAPI_AVAILABLE(macosx(10.10));

    /*!

     @property movabilityHint(可移动的线索)

     @abstract Give hints oregarding the movability of the receiver. See enum above for details. Defaults to SCNMovabilityHintFixed.(提示忽略接收器的可移动性。 有关详细信息,请参阅上面的枚举。 默认为SCNMovabilityHintFixed。)

     */

    @property (nonatomic)SCNMovabilityHint movabilityHintAPI_AVAILABLE(macosx(10.12), ios(10.0), tvos(10.0));

    #pragma mark - Managing the Node Hierarchy(管理节点层次)

    /*! 

     @property parentNode(父节点)

     @abstract Returns the parent node of the receiver.(返回接收器的父节点)

     */

    @property(nonatomic,readonly,nullable)SCNNode *parentNode;

    /*! 

     @property childNodes(子节点)

     @abstract Returns the child node array of the receiver.(返回接收器的子节点数组)

     */

    @property(nonatomic,readonly)NSArray<SCNNode *> *childNodes;

    /*!

     @method addChildNode:(添加子节点)

     @abstract Appends the node to the receiver’s childNodes array.(将节点追加到接收器的子节点数组)

     @param child The node to be added to the receiver’s childNodes array.(要添加到接收器子节点数组的节点)

     */

    - (void)addChildNode:(SCNNode *)child;

    /*!

     @method insertChildNode:atIndex:

     @abstract Insert a node in the childNodes array at the specified index.(在指定索引处的子节点数组中插入节点)

     @param child The node to insert.(要插入的节点)

     @param index Index in the childNodes array to insert the node.(在子节点数组中插入节点的索引)

     */

    - (void)insertChildNode:(SCNNode *)child atIndex:(NSUInteger)index;

    /*!

     @method removeFromParentNode(从父节点删除)

     @abstract Removes the node from the childNodes array of the receiver’s parentNode.(删除的节点是来自于接收器父节点的子节点数组)

     */

    - (void)removeFromParentNode;

    /*!

     @method replaceChildNode:with:

     @abstract Remove `child' from the childNode array of the receiver and insert 'child2' if non-nil in its position.(从接收者的childNode数组中删除`child',如果非零,则插入'child2')

     @discussion If the parentNode of `child' is not the receiver, the behavior is undefined.(如果`child'的parentNode不是接收者,则行为是未定义的)

     @param oldChild The node to replace in the childNodes array.(要替换的节点在childNodes数组中)

     @param newChild The new node that will replace the previous one.(将替换前一个节点的新节点。)替换oldChild

     */

    - (void)replaceChildNode:(SCNNode *)oldChild with:(SCNNode *)newChild;

    #pragma mark - Searching the Node Hierarchy(搜索节点的层次结构)

    /*!

     @method childNodeWithName:recursively:

     @abstract Returns the first node found in the node tree with the specified name.(返回在指定的节点树中找到的第一个节点)

     @discussion The search uses a pre-order tree traversal.(用遍历去搜索预订的树)

     @param name The name of the node you are searching for.(要搜索的节点名称)

     @param recursively Set to YES if you want the search to look through the sub-nodes recursively.(如果你想搜索通过递归方式查看,请设置为YES)

     */

    - (nullableSCNNode *)childNodeWithName:(NSString *)name recursively:(BOOL)recursively;

    /*!

     @method childNodesPassingTest:(通过测试的子节点)

     @abstract Returns the child nodes of the receiver that passes a test in a given Block.(返回在给定的block中通过测试的接收器的子节点)

     @discussion The search is recursive and uses a pre-order tree traversal.(搜索是递归的,并且使用预定树遍历)

     @param predicate(谓语、断言)  The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block. The Block returns a Boolean value that indicates whether "child" passed the test.(应用于接收器的子节点的block。 该block有两个参数:“child”是子节点,“stop”是对布尔值的引用。 该block可以将值设置为YES以停止进一步处理节点层次结构。 stop参数是一个out-only参数。 您应该只在block内将此布尔设置为YES。 该block返回一个布尔值,指示“child”是否通过测试。)

     */

    - (NSArray<SCNNode *> *)childNodesPassingTest:(NS_NOESCAPEBOOL (^)(SCNNode *child,BOOL *stop))predicate;

    /*!

     @method enumerateChildNodesUsingBlock:(罗列使用block的子节点:)

     @abstract Executes a given block on each child node under the receiver.(在接收器下的每个子节点上执行给定的block)

     @discussio The search is recursive and uses a pre-order tree traversal.(搜索是递归的,并且使用预定树遍历)

     @param block The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.(应用于接收器子节点的block。 该block有两个参数:“child”是子节点,“stop”是对布尔值的引用。 该block可以将值设置为YES以停止进一步处理节点层次结构。 stop参数是一个out-only参数。 你应该只在block内将此布尔设置为YES。)

     */

    - (void)enumerateChildNodesUsingBlock:(NS_NOESCAPEvoid (^)(SCNNode *child,BOOL *stop))blockAPI_AVAILABLE(macosx(10.10));

    /*!

     @method enumerateHierarchyUsingBlock:(列举使用block的层级:)

     @abstract Executes a given block on the receiver and its child nodes.(执行在接收器和子节点上给定的block)

     @discussion The search is recursive and uses a pre-order tree traversal.(搜索是递归的,并且使用预定树遍历)

     @param block The block to apply to the receiver and its child nodes. The block takes two arguments: "node" is a node in the hierarchy of the receiver (including the receiver) and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.(应用于接收器及其子节点的block。 该block采用两个参数:“节点”是接收器(包括接收器)的层次结构中的节点,“停止”是对布尔值的引用。 该block可以将值设置为YES以停止进一步处理节点层次结构。 stop参数是一个out-only参数。 你应该只在block内将此布尔设置为YES。)

     */

    - (void)enumerateHierarchyUsingBlock:(NS_NOESCAPEvoid (^)(SCNNode *node,BOOL *stop))blockAPI_AVAILABLE(macosx(10.12), ios(10.0), tvos(10.0));

    #pragma mark - Converting Between Node Coordinate Systems(在节点坐标系之间转换)

    /*!

     @method convertPosition:toNode:(改变位置:到节点:)

     @abstract Converts a position from the receiver’s coordinate system to that of the specified node.(将接收器的坐标系统的位置转换为指定节点的位置)

     @param position(位置)  A position specified in the local coordinate system of the receiver.(在接收器的本地坐标系中指定的位置)

     @param node(节点)  The node into whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts to world coordinates.(要转换其坐标系“位置”的节点. 如果“node”为nil,此方法将转换为世界坐标.)

     */

    - (SCNVector3)convertPosition:(SCNVector3)position toNode:(nullableSCNNode *)node API_AVAILABLE(macosx(10.9));

    /*!

     @method convertPosition:fromNode:(改变位置: 从节点:)

     @abstract Converts a position from the coordinate system of a given node to that of the receiver.(将位置从给定节点的坐标系转换为接收器的坐标系)

     @param position A position specified in the local coordinate system of "node".(在"节点"的局部坐标系中指定位置)

     @param node The node from whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts from world coordinates.(要转换其坐标系“位置”的节点。 如果“node”为nil,则此方法将从世界坐标转换。)

     */

    - (SCNVector3)convertPosition:(SCNVector3)position fromNode:(nullableSCNNode *)node API_AVAILABLE(macosx(10.9));

    /*!

     @method convertTransform:toNode:

     @abstract Converts a transform from the receiver’s coordinate system to that of the specified node.(将接收器的坐标系统的变换转换为指定节点的坐标系)

     @param transform(变换,改变,使...变形)  A transform specified in the local coordinate system of the receiver.(在接收器的局部坐标系中指定的变换)

     @param node The node into whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts to world coordinates.(要转换其坐标系“变换”的节. 如果“node”为nil,此方法将转换为世界坐标)

     */

    - (SCNMatrix4)convertTransform:(SCNMatrix4)transform toNode:(nullableSCNNode *)node API_AVAILABLE(macosx(10.9));

    /*!

     @method convertTransform:fromNode:

     @abstract Converts a transform from the coordinate system of a given node to that of the receiver.(将从给定节点的坐标系变换到接收器的坐标系的变换)

     @param transform A transform specified in the local coordinate system of "node".(在“node”的局部坐标系中指定的变换)

     @param node The node from whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts from world coordinates.(要转换其坐标系“变换”的节点。 如果“node”为nil,则此方法将从世界坐标转换)

     */

    - (SCNMatrix4)convertTransform:(SCNMatrix4)transform fromNode:(nullableSCNNode *)node API_AVAILABLE(macosx(10.9));

    #pragma mark - Managing the SCNNode′s physics body(管理SCNNodel的物理体)

    /*!

     @property physicsBody

     @abstract The description of the physics body of the receiver.(接收器的物理体的描述)

     @discussion Default is nil.(默认为nil)

     */

    @property(nonatomic,retain,nullable)SCNPhysicsBody *physicsBodyAPI_AVAILABLE(macosx(10.10));

    #pragma mark - Managing the Node′s Physics Field(管理节点的物理场)

    /*!

     @property physicsField

     @abstract The description of the physics field of the receiver.(接收器的物理场的描述)

     @discussion Default is nil.(默认为nil)

     */

    @property(nonatomic,retain,nullable)SCNPhysicsField *physicsFieldAPI_AVAILABLE(macosx(10.10));

    #pragma mark - Managing the Node′s Constraints(管理节点的约束)

    /*!

     @property constraints(约束)

     @abstract An array of SCNConstraint that are applied to the receiver.(应用于接收器的SCNConstraint数组)

     @discussion Adding or removing a constraint can be implicitly animated based on the current transaction.(可以基于当前事务来隐式动画添加或删除约束)

     */

    @property(copy,nullable)NSArray<SCNConstraint *> *constraintsAPI_AVAILABLE(macosx(10.9));

    #pragma mark - Accessing the Node′s Filters(访问节点的过滤器)

    /*!

     @property filters(过滤器)

     @abstract An array of Core Image filters that are applied to the rendering of the receiver and its child nodes. Animatable.(应用于接收器及其子节点的渲染的Core Image过滤器数组。 动画)

     @discussion Defaults to nil. Filter properties should be modified by calling setValue:forKeyPath: on each node that the filter is attached to. If the inputs of the filter are modified directly after the filter is attached to a node, the behavior is undefined.(默认为nil。 应该通过在过滤器附加到的每个节点上调用setValue:forKeyPath:来修改过滤器属性。 如果在将过滤器附加到节点之后直接修改过滤器的输入,则行为是未定义的)

     */

    @property(nonatomic,copy,nullable)NSArray<CIFilter *> *filtersAPI_AVAILABLE(macosx(10.9))__WATCHOS_PROHIBITED;

    #pragma mark - Accessing the Presentation Node(访问描述节点)

    /*!

     @method presentationNode(描述节点)

     @abstract Returns the presentation node.(返回描述节点)

     @discussion Returns a copy of the node containing all the properties as they were at the start of the current transaction, with any active animations applied.(返回包含当前事务开始时所有属性的节点的副本,并应用任何活动动画)

                 This gives a close approximation to the version of the node that is currently displayed.(这给出了当前显示的节点的版本的近似)

                 The effect of attempting to modify the returned node in any way is undefined. The returned node has no parent and no child nodes.(尝试以任何方式修改返回的节点的效果未定义。 返回的节点不具有父节点和子节点) 

     */

    @property(nonatomic,readonly)SCNNode *presentationNode;

    #pragma mark - Pause(暂停)

    /*!

     @property paused(已暂停)

     @abstract Controls whether or not the node's actions and animations are updated or paused. Defaults to NO.(控制节点的动作和动画是否已更新或已暂停. 默认为NO)

     */

    @property(nonatomic,getter=isPaused)BOOL paused API_AVAILABLE(macosx(10.10));

    #pragma mark - Overriding the Rendering with Custom OpenGL Code(使用自定义OpenGL代码覆盖渲染)

    /*!

     @property rendererDelegate(渲染代理)

     @abstract Specifies the receiver's renderer delegate object.(指定接收器的渲染器委托对象)

     @discussion Setting a renderer delegate prevents the SceneKit renderer from drawing the node and lets you use custom OpenGL code instead.(设置渲染器委托可防止SceneKit渲染器绘制节点,并允许您使用自定义OpenGL代码)

                 The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL.(自定义渲染的首选方法是调整节点几何的不同材质的材质属性。 SCNMaterial符合SCNShadable协议,并允许使用GLSL进行更高级的渲染。)

                 You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code.(您通常使用具有没有几何节点,并且仅用作空间中位置的渲染代理。 例如将粒子系统附加到该节点,并用自定义的OpenGL代码渲染它。    

     */

    @property(nonatomic,assign,nullable)id <SCNNodeRendererDelegate> rendererDelegate;

    #pragma mark - Hit Testing in the Node

    /*!

     @method hitTestWithSegmentFromPoint:toPoint:options:(命中测试从段到点:到点:选项:)

     @abstract Returns an array of SCNHitTestResult for each node in the receiver's sub tree that intersects the specified segment.(返回接收器子树中与指定段相交的每个节点的SCNHitTestResult数组)

     @param pointA The first point of the segment relative to the receiver.(段相对于接收器的第一点)

     @param pointB The second point of the segment relative to the receiver.(段相对于接收器的第二点)

     @param options Optional parameters (see the "Hit test options" section in SCNSceneRenderer.h for the available options).(可选参数(有关可用选项,请参阅SCNSceneRenderer.h中的“命中测试选项”一节))

     @discussion See SCNSceneRenderer.h for a screen-space hit testing method.(有关屏幕空间命中测试方法,请参阅SCNSceneRenderer.h)

     */

    - (NSArray<SCNHitTestResult *> *)hitTestWithSegmentFromPoint:(SCNVector3)pointA toPoint:(SCNVector3)pointB options:(nullableNSDictionary<NSString *,id> *)options API_AVAILABLE(macosx(10.9));

    #pragma mark - Categories(分类)

    /*!

     @property categoryBitMask(位屏蔽/ 位掩码 分类)

     @abstract Defines what logical 'categories' the receiver belongs too. Defaults to 1.(定义接收器属于什么逻辑“类别”。 默认为1)

     @discussion Categories can be used to  (类别可用于)

                    1. exclude nodes from the influence of a given light (see SCNLight.categoryBitMask)  [1.从给定光的影响中排除节点(参见SCNLight.categoryBitMask)]

                    2. include/exclude nodes from render passes (see SCNTechnique.h)  [2.从渲染过程中包含/排除节点(参见SCNTechnique.h)]

                    3. specify which nodes to use when hit-testing (see SCNHitTestOptionCategoryBitMask)   [3.指定在命中测试时要使用的节点(请参阅SCNHitTestOptionCategoryBitMask)]              

     */

    @property(nonatomic)NSUInteger categoryBitMaskAPI_AVAILABLE(macosx(10.10));

    @end

    /*!

     @category NSObject (SCNNodeRendererDelegate)

     @abstract The SCNNodeRendererDelegate protocol declares the methods that an instance of SCNNode invokes to let a delegate customize its rendering.(SCNNodeRendererDelegate协议声明SCNNode的一个实例调用的方法,让代理定制其呈现)

     */

    @protocol SCNNodeRendererDelegate <NSObject>

    @optional

    /*! 

     @method renderNode:renderer:arguments:

     @abstract Invoked when a node is rendered.

     @discussion The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL.

                 You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code.

                 Only drawing calls and the means to achieve them are supposed to be performed during the renderer delegate callback, any changes in the model (nodes, geometry...) would involve unexpected results.

     @param node The node to render.

     @param renderer The scene renderer to render into.

     @param arguments A dictionary whose values are SCNMatrix4 matrices wrapped in NSValue objects.

      @method renderNode:renderer:arguments:   @abstract 当一个节点被渲染时调用。   @discussion 自定义渲染的首选方法是调整节点几何的不同材质的材质属性。 SCNMaterial符合SCNShadable协议,并允许使用GLSL进行更高级的渲染。             您通常使用具有没有几何的节点的渲染器代理,并且仅用作空间中的位置。 一个例子是将粒子系统附加到该节点,并用自定义的OpenGL代码渲染它。               只有绘图调用和实现它们的方法应该在渲染器委托回调期间执行,模型(节点,几何体...)中的任何更改都会导致意外的结果。   

      @param node 要渲染的节点   @param renderer 渲染到的场景渲染器   @param arguments(参数) 字典,其值是包装在NSValue对象中的SCNMatrix4矩阵

     */

    - (void)renderNode:(SCNNode *)node renderer:(SCNRenderer *)renderer arguments:(NSDictionary<NSString *, id> *)arguments;

    @end

    NS_ASSUME_NONNULL_END

    转载请注明原文地址: https://ju.6miu.com/read-899988.html

    最新回复(0)