Reputation: 2337
I am a newbie to Javascript. I am trying to understand the following lines of my main.js
file:
define([ 'shader!vertShader.vert',
'shader!compShader.frag',
'myJSLib/MyJSLib'
],
function( vertShader,
compShader,
MyJSLib
){
"use strict" ;
My understanding is that 'shader!vertShader.vert'
will be assigned to vertShader
and 'shader!compShader.frag'
to compShader
and 'myJSLib/MyJSLib'
to myJSLib
.
I would like to understand what the exclamation mark does in shader!vertShader.vert
. My Google search all shows !
is the negation operator, which does not seems to be the case here.
Upvotes: 0
Views: 142
Reputation: 1174
This is an example of AMD modules, which have their own format for organizing JS modules/libraries. You are correct in that each of the array arguments map to the corresponding function argument.
In this case this is using a shader language and the !
bang symbol refers to different sections of a shader file (used for graphics in things like WebGL) (specifically a vertex shader and a fragment shader, respectively).
Upvotes: 4