/*global define*/ define([ '../Core/defaultValue', '../Core/PrimitiveType' ], function( defaultValue, PrimitiveType) { "use strict"; /** * Represents a command to the renderer for drawing. * * @private */ var DrawCommand = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); /** * The bounding volume of the geometry in world space. This is used for culling and frustum selection. *
* For best rendering performance, use the tightest possible bounding volume. Although
* undefined
is allowed, always try to provide a bounding volume to
* allow the tightest possible near and far planes to be computed for the scene, and
* minimize the number of frustums needed.
*
true
, the renderer frustum and horizon culls the command based on its {@link DrawCommand#boundingVolume}.
* If the command was already culled, set this to false
for a performance improvement.
*
* @type {Boolean}
* @default true
*/
this.cull = defaultValue(options.cull, true);
/**
* The transformation from the geometry in model space to world space.
*
* When undefined
, the geometry is assumed to be defined in world space.
*
false
.
*
* @type {Boolean}
* @default false
*/
this.executeInClosestFrustum = defaultValue(options.executeInClosestFrustum, false);
/**
* The object who created this command. This is useful for debugging command
* execution; it allows us to see who created a command when we only have a
* reference to the command, and can be used to selectively execute commands
* with {@link Scene#debugCommandFilter}.
*
* @type {Object}
* @default undefined
*
* @see Scene#debugCommandFilter
*/
this.owner = options.owner;
/**
* This property is for debugging only; it is not for production use nor is it optimized.
* * Draws the {@link DrawCommand#boundingVolume} for this command, assuming it is a sphere, when the command executes. *
* * @type {Boolean} * @default false * * @see DrawCommand#boundingVolume */ this.debugShowBoundingVolume = defaultValue(options.debugShowBoundingVolume, false); /** * Used to implement Scene.debugShowFrustums. * @private */ this.debugOverlappingFrustums = 0; /** * @private */ this.oit = undefined; }; /** * Executes the draw command. * * @param {Context} context The renderer context in which to draw. * @param {PassState} [passState] The state for the current render pass. * @param {RenderState} [renderState] The render state that will override the render state of the command. * @param {ShaderProgram} [shaderProgram] The shader program that will override the shader program of the command. */ DrawCommand.prototype.execute = function(context, passState, renderState, shaderProgram) { context.draw(this, passState, renderState, shaderProgram); }; return DrawCommand; });