/
DrawCommand.js
119 lines (105 loc) · 3.05 KB
/
DrawCommand.js
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*global define*/
define(function() {
"use strict";
/**
* Represents a command to the renderer for drawing.
*
* @alias DrawCommand
* @constructor
*
* @see ClearCommand
* @see PassState
*/
var DrawCommand = function() {
/**
* The bounding volume of the geometry.
* @type DOC_TBA
* @default undefined
*/
this.boundingVolume = undefined;
/**
* When <code>true</code>, the renderer frustum and horizon culls the command based on its {@link DrawCommand#boundingVolume}.
* If the command was already culled, set this to <code>false</code> for a performance improvement.
*
* @type {Boolean}
* @default true
*/
this.cull = true;
/**
* The transformation from the geometry in model space to world space.
* @type {Matrix4}
* @default undefined
*/
this.modelMatrix = undefined;
/**
* The type of geometry in the vertex array.
* @type {PrimitiveType}
* @default undefined
*/
this.primitiveType = undefined;
/**
* The vertex array.
* @type {VertexArray}
* @default undefined
*/
this.vertexArray = undefined;
/**
* The number of vertices to draw in the vertex array.
* @type {Number}
* @default undefined
*/
this.count = undefined;
/**
* The offset to start drawing in the vertex array.
* @type {Number}
* @default undefined
*/
this.offset = undefined;
/**
* The shader program to apply.
* @type {ShaderProgram}
* @default undefined
*/
this.shaderProgram = undefined;
/**
* An object with functions whose names match the uniforms in the shader program
* and return values to set those uniforms.
* @type {Object}
* @default undefined
*/
this.uniformMap = undefined;
/**
* The render state.
* @type {Object}
* @default undefined
*
* @see Context#createRenderState
*/
this.renderState = undefined;
/**
* The framebuffer to draw to.
* @type {Framebuffer}
* @default undefined
*/
this.framebuffer = undefined;
/**
* Specifies if this command is only to be executed in the frustum closest
* to the eye containing the bounding volume. Defaults to <code>false</code>.
* @type {Boolean}
* @default false
*/
this.executeInClosestFrustum = false;
};
/**
* Executes the draw command.
*
* @memberof DrawCommand
*
* @param {Context} context The renderer context in which to draw.
* @param {PassState} [passState] TBA.
*/
DrawCommand.prototype.execute = function(context, passState) {
context.draw(this, passState);
};
return DrawCommand;
});