Class GreasedLinePluginMaterial
Hierarchy (View Summary)
- MaterialPluginBase
- GreasedLinePluginMaterial
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new GreasedLinePluginMaterial(
material: Material,
scene?: Scene,
options?: GreasedLineMaterialOptions,
): GreasedLinePluginMaterialCreates a new instance of the GreasedLinePluginMaterial
Parameters
- material: Material
Base material for the plugin
Optionalscene: SceneThe scene
Optionaloptions: GreasedLineMaterialOptionsPlugin options
Returns GreasedLinePluginMaterial
- material: Material
Properties
color Mode
The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET
colors Sampling
The type of sampling of the colors texture. The values are the same when using with textures.
colors Texture
You can provide a colorsTexture to use instead of one generated from the 'colors' option
dash Offset
Dash offset
dash Ratio
Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
do Not Serialize
Specifies if the material plugin should be serialized, true to skip serialization
Readonlymark All Defines As Dirty
Helper function to mark defines as being dirty.
name
Defines the name of the plugin
priority
Defines the priority of the plugin. Lower numbers run first.
register For Extra Events
Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)
resolve Includes
Indicates that any #include directive in the plugin code must be replaced by the corresponding code.
use Colors
Whether to use the colors option to colorize the line
use Dash
Turns on/off dash mode
visibility
Normalized value of how much of the line will be visible 0 - 0% of the line will be visible 1 - 100% of the line will be visible
width
Line base width. At each point the line width is calculated by widths[pointIndex] * width
StaticForce GLSL
Force all the greased lines to compile to glsl even on WebGPU engines. False by default. This is mostly meant for backward compatibility.
Static ReadonlyGREASED_ LINE_ MATERIAL_ NAME
Plugin name
Accessors
color
colors
colors Distribution Type
-
Gets the color distributiopn type
Returns GreasedLineMeshColorDistributionType
-
Sets the color distribution type
Parameters
- value: GreasedLineMeshColorDistributionType
color distribution type
Returns void
- value: GreasedLineMeshColorDistributionType
dash Count
-
get dashCount(): number
Gets the number of dashes in the line
Returns number
-
set dashCount(value: number): void
Sets the number of dashes in the line
Parameters
- value: number
dash
Returns void
- value: number
is Enabled
-
get isEnabled(): boolean
Returns boolean
resolution
-
Gets the resolution
Returns Vector2
size Attenuation
-
get sizeAttenuation(): boolean
If set to true the line will be rendered always with the same width regardless how far it is located from the camera. Not supported for non camera facing lines.
Returns boolean
-
set sizeAttenuation(value: boolean): void
Turn on/off size attenuation of the width option and widths array. Not supported for non camera facing lines.
Parameters
- value: boolean
If set to true the line will be rendered always with the same width regardless how far it is located from the camera.
Returns void
- value: boolean
Methods
add Fallbacks
-
Add fallbacks to the effect fallbacks list.
Parameters
- defines: MaterialDefines
defines the Base texture to use.
- fallbacks: EffectFallbacks
defines the current fallback list.
- currentRank: number
defines the current fallback rank.
Returns number
the new fallback rank.
- defines: MaterialDefines
bind For Sub Mesh
collect Defines
-
Collects all defines.
Parameters
- defines: { [name: string]: { default: any; type: string } }
The object to append to.
Returns void
- defines: { [name: string]: { default: any; type: string } }
copy To
-
Makes a duplicate of the current configuration into another one.
Parameters
- plugin: MaterialPluginBase
define the config where to copy the info
Returns void
- plugin: MaterialPluginBase
dispose
-
Disposes the plugin material.
Returns void
fill Render Target Textures
-
Fills the list of render target textures.
Parameters
- _renderTargets: SmartArray<RenderTargetTexture>
the list of render targets to update
Returns void
- _renderTargets: SmartArray<RenderTargetTexture>
get Active Textures
-
Get the shader textures
Parameters
- activeTextures: BaseTexture[]
array which will be filled with the textures
Returns void
- activeTextures: BaseTexture[]
get Animatables
-
Returns the animatable textures.
Parameters
- _animatables: IAnimatable[]
Array of animatable textures.
Returns void
- _animatables: IAnimatable[]
get Attributes
-
Get the shader attributes
Parameters
- attributes: string[]
array which will be filled with the attributes
Returns void
- attributes: string[]
get Class Name
-
Get the class name
Returns string
class name
get Custom Code
-
getCustomCode(
shaderType: string,
shaderLanguage?: ShaderLanguage,
): Nullable<{ [pointName: string]: string }>Get shader code
Parameters
- shaderType: string
vertex/fragment
- shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
GLSL or WGSL
Returns Nullable<{ [pointName: string]: string }>
shader code
- shaderType: string
get Samplers
-
Get the shader samplers
Parameters
- samplers: string[]
Returns void
get Uniform Buffers Names
-
Gets the uniform buffers names added by the plugin.
Parameters
- _ubos: string[]
list that the ubo names should be added to.
Returns void
- _ubos: string[]
get Uniforms
-
getUniforms(
shaderLanguage?: ShaderLanguage,
): {
fragment: string;
ubo: { name: string; size: number; type: string }[];
vertex: string;
}Get the shader uniforms
Parameters
- shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
The shader language to use
Returns {
fragment: string;
ubo: { name: string; size: number; type: string }[];
vertex: string;
}uniforms
- shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
hard Bind For Sub Mesh
-
hardBindForSubMesh(
_uniformBuffer: UniformBuffer,
_scene: Scene,
_engine: AbstractEngine,
_subMesh: SubMesh,
): voidBinds the material data (this function is called even if mustRebind() returns false)
Parameters
- _uniformBuffer: UniformBuffer
defines the Uniform buffer to fill in.
- _scene: Scene
defines the scene the material belongs to.
- _engine: AbstractEngine
defines the engine the material belongs to.
- _subMesh: SubMesh
the submesh to bind data for
Returns void
- _uniformBuffer: UniformBuffer
has Render Target Textures
-
Gets a boolean indicating that current material needs to register RTT
Returns boolean
true if this uses a render target otherwise false.
has Texture
-
Checks to see if a texture is used in the material.
Parameters
- _texture: BaseTexture
Base texture to use.
Returns boolean
- Boolean specifying if a texture is used in the material.
- _texture: BaseTexture
is Compatible
-
Gets a boolean indicating that the plugin is compatible with a given shader language
Parameters
- _shaderLanguage: ShaderLanguage
The shader language to use
Returns boolean
true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported
- _shaderLanguage: ShaderLanguage
is Ready For Sub Mesh
-
isReadyForSubMesh(
_defines: MaterialDefines,
_scene: Scene,
_engine: AbstractEngine,
_subMesh: SubMesh,
): booleanSpecifies that the submesh is ready to be used.
Parameters
- _defines: MaterialDefines
the list of "defines" to update.
- _scene: Scene
defines the scene the material belongs to.
- _engine: AbstractEngine
the engine this scene belongs to.
- _subMesh: SubMesh
the submesh to check for readiness
Returns boolean
- boolean indicating that the submesh is ready or not.
- _defines: MaterialDefines
parse
-
Parses a serialized objects
Parameters
- source: any
serialized object
- scene: Scene
scene
- rootUrl: string
root url for textures
Returns void
- source: any
prepare Defines
-
Prepare the defines
Parameters
- defines: MaterialGreasedLineDefines
- _scene: Scene
- mesh: AbstractMesh
Returns void
prepare Defines Before Attributes
-
prepareDefinesBeforeAttributes(
_defines: MaterialDefines,
_scene: Scene,
_mesh: AbstractMesh,
): voidSets the defines for the next rendering. Called before PrepareDefinesForAttributes is called.
Parameters
- _defines: MaterialDefines
the list of "defines" to update.
- _scene: Scene
defines the scene to the material belongs to.
- _mesh: AbstractMesh
the mesh being rendered
Returns void
- _defines: MaterialDefines
serialize
-
Serializes this plugin material
Returns any
serializationObjec
set Color
set Colors
update Lazy
-
Updates the material. Use when material created in lazy mode.
Returns void
GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh. Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.