Skip to content

Instantly share code, notes, and snippets.

@cedricpinson
Last active August 29, 2015 14:10
Show Gist options
  • Save cedricpinson/ae1d2d17f9cc95c1af59 to your computer and use it in GitHub Desktop.
Save cedricpinson/ae1d2d17f9cc95c1af59 to your computer and use it in GitHub Desktop.
shader node api tests
var inputVariables = [ a, b, c];
var outputVariable = factory.getVariable('vec4','outputResult');
factory.getNodeAdd().inputs(inputsVariables).output(outputVariable);
var normal = this.getOrCreateNormal();
var lightingInputs = {
lights: lights
normal: normal,
view: eyeVector,
ambient: materialAmbient,
diffuse: materialDiffuse,
specular: materialSpecular,
shininess: materialShininess,
};
var outputLighting = factory.getVariable('vec4','outputResult');
factory.getNodeLighting().inputs( lightingInputs ).output( outputLighting );
factory.getAddNode().inputs( [ outputLighting, materialEmission ] ).output( outputLighting );
var alpha = factory.getVariable('float);
var inputsAlpha = {
rgb: outputLighting
};
var alphaOutput = {
alpha: alpha
};
factory.getNode('InlineCode').code( '%alpha = %rgb.a * %rgb.a', ).inputs(inputsAlpha).outputs(alphaOutput);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment