yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import Check from "../../Core/Check.js";
import defaultValue from "../../Core/defaultValue.js";
import defined from "../../Core/defined.js";
import InstancingPipelineStage from "./InstancingPipelineStage.js";
/**
 * An in-memory representation of a node as part of
 * the {@link ModelExperimentalSceneGraph}
 *
 * @param {Object} options An object containing the following options:
 * @param {ModelComponents.Node} options.node The corresponding node components from the 3D model
 * @param {Matrix4} options.modelMatrix The model matrix associated with this node.
 *
 * @alias ModelExperimentalNode
 * @constructor
 *
 * @private
 */
export default function ModelExperimentalNode(options) {
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("options.node", options.node);
  Check.typeOf.object("options.modelMatrix", options.modelMatrix);
  //>>includeEnd('debug');
 
  /**
   * The model components node associated with this scene graph node.
   *
   * @type {ModelComponents.Node}
   * @readonly
   *
   * @private
   */
  this.node = options.node;
 
  /**
   * The model matrix associated with this node.
   *
   * @type {Matrix4}
   * @readonly
   *
   * @private
   */
  this.modelMatrix = options.modelMatrix;
 
  /**
   * Pipeline stages to apply across all the mesh primitives of this node. This
   * is an array of classes, each with a static method called
   * <code>process()</code>
   *
   * @type {Object[]}
   * @readonly
   *
   * @private
   */
  this.pipelineStages = [];
 
  /**
   * The mesh primitives that belong to this node
   *
   * @type {ModelExperimentalPrimitive[]}
   * @readonly
   *
   * @private
   */
  this.runtimePrimitives = [];
 
  initialize(this);
}
 
function initialize(runtimeNode) {
  var node = runtimeNode.node;
  var pipelineStages = runtimeNode.pipelineStages;
 
  if (defined(node.instances)) {
    pipelineStages.push(InstancingPipelineStage);
  }
 
  return;
}