r3-legacy/src/r3-d3-shader-fragment.js

60 lines
1.3 KiB
JavaScript

/**
* R3.D3.Shader.Fragment
* @param graphics R3.Runtime.Graphics
* @param apiFragmentShader
* @constructor
*/
R3.D3.Shader.Fragment = function(
graphics,
apiFragmentShader
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (R3.Utils.UndefinedOrNull(apiFragmentShader)) {
apiFragmentShader = {
shaderType : R3.D3.API.Shader.SHADER_TYPE_FRAGMENT
};
}
R3.D3.API.Shader.Fragment.call(
this,
apiFragmentShader
);
R3.D3.Shader.call(
this,
this.graphics,
apiFragmentShader
);
};
R3.D3.Shader.Fragment.prototype = Object.create(R3.D3.Shader.prototype);
R3.D3.Shader.Fragment.prototype.constructor = R3.D3.Shader.Fragment;
/**
* Creates a shader instance
* @returns {*}
*/
R3.D3.Shader.Fragment.prototype.createInstance = function() {
R3.D3.Shader.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
R3.D3.Shader.Fragment.prototype.updateInstance = function(property) {
R3.D3.Shader.prototype.updateInstance.call(this, property);
};
/**
* Converts a R3.D3.Shader to a R3.D3.API.Shader
* @returns {R3.D3.API.Shader}
*/
R3.D3.Shader.Fragment.prototype.toApiObject = function() {
var apiShader = R3.D3.Shader.prototype.toApiObject.call(this);
return apiShader;
};