Methods
(private) _addMap(propName, chunkName, options, chunks, samplerFormat) → {String}
Add chunk for Map Types (used for all maps except Normal)
Parameters:
Name | Type | Description |
---|---|---|
propName |
String | The base name of the map: diffuse | emissive | opacity | light | height | metalness | specular | gloss | ao |
chunkName |
String | The name of the chunk to use. Usually "basenamePS" |
options |
Object | The options passed into to createShaderDefinition |
chunks |
Object | The set of shader chunks to choose from |
samplerFormat |
String | Format of texture sampler to use - 0: "texture2DSRGB", 1: "texture2DRGBM", 2: "texture2D" |
- Source:
Returns:
The shader code to support this map
- Type
- String
(private) _createSource()
Creates the source for the instance
- Source:
(private) _fsAddBaseCode(code, device, chunks, options) → {String}
Add "Base" Code section to fragment shader
Parameters:
Name | Type | Description |
---|---|---|
code |
String | Current fragment shader code |
device |
pc.GraphicsDevice | The graphics device |
chunks |
Object | All available shader chunks |
options |
Object | The Shader Definition options |
- Source:
Returns:
The new fragment shader code (old+new)
- Type
- String
(private) _fsAddStartCode(code, device, chunks, options) → {String}
Add "Start" Code section to fragment shader
Parameters:
Name | Type | Description |
---|---|---|
code |
String | Current fragment shader code |
device |
pc.GraphicsDevice | The graphics device |
chunks |
Object | All available shader chunks |
options |
Object | The Shader Definition options |
- Source:
Returns:
The new fragment shader code (old+new)
- Type
- String
(private) _getUvSourceExpression(transformPropName, uVPropName, options) → {String}
Get the code with which to to replace '$UV' in the map shader functions
Parameters:
Name | Type | Description |
---|---|---|
transformPropName |
String | Name of the transform id in the options block. Usually "basenameTransform" |
uVPropName |
String | Name of the UV channel in the options block. Usually "basenameUv" |
options |
Object | The options passed into createShaderDefinition |
- Source:
Returns:
The code used to replace "$UV" in the shader code
- Type
- String
(private) _insertScriptInstance(scriptInstance, index, scriptsLength)
Parameters:
Name | Type | Description |
---|---|---|
scriptInstance |
Object | The script instance |
index |
Number | The index where to insert the script at. If -1 then append it at the end. |
scriptsLength |
Number | The length of the scripts array. |
(private) _typeLookup()
Create look up table for types
- Source:
hasComponent(componentName) → {Boolean}
Convenience method indicating whether the entity exists and has a component of the provided type.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
String | Name of the component. |
Returns:
True if the entity exists and has a component of the provided type.
- Type
- Boolean
onParentComponentEnable()
Must be called from the parent component's onEnable() method in order for entity
references to be correctly resolved when pc.Entity#clone is called.