Capítulo 60 de 859

Chapter 60: Line2NodeMaterial

Core Idea

This node material can be used to render lines with a size larger than one by representing them as instanced meshes.

Key Concepts

  • alphaToCoverage : boolean: Whether alpha to coverage should be used or not.
  • blending : number: Blending is set to NoBlending since transparency is not supported, yet.
  • dashOffset : number: The dash offset.
  • dashScaleNode : Node.<float>: Defines the dash scale.
  • dashSizeNode : Node.<float>: Defines the dash size.
  • dashed : boolean: Whether the lines should be dashed or not.
  • gapSizeNode : Node.<float>: Defines the gap size.
  • isLine2NodeMaterial : boolean (readonly): This flag can be used for type testing.
  • lineColorNode : Node.<vec3>: Defines the lines color.
  • offsetNode : Node.<float>: Defines the offset.

Reference Tables

Constructor

Signature
new Line2NodeMaterial( parameters : Object )

Properties

PropertyDescription
.alphaToCoverage : booleanWhether alpha to coverage should be used or not.
.blending : numberBlending is set to NoBlending since transparency is not supported, yet.
.dashOffset : numberThe dash offset.
.dashScaleNode : Node.<float>Defines the dash scale.
.dashSizeNode : Node.<float>Defines the dash size.
.dashed : booleanWhether the lines should be dashed or not.
.gapSizeNode : Node.<float>Defines the gap size.
.isLine2NodeMaterial : boolean (readonly)This flag can be used for type testing.
.lineColorNode : Node.<vec3>Defines the lines color.
.offsetNode : Node.<float>Defines the offset.
.vertexColors : booleanWhether vertex colors should be used or not.
.worldUnits : booleanWhether the lines should sized in world units or not. When set to false the unit is pixel.

Methods

MethodDescription
.setupDiffuseColor( builder : NodeBuilder )Setups the diffuse color of the line material in the fragment stage. Overrides the base setup to incorporate line/dash rendering and blending.
.setupModelViewProjection( builder : NodeBuilder ) : Node.<vec4>Setups the position in clip space for the vertex stage of the fat line. Overrides the default model-view-projection to return the expanded fat line vertex coordinates.

Key Takeaways

  1. Line2NodeMaterial extends: EventDispatcher → Material → NodeMaterial
  2. Most relevant properties: alphaToCoverage, blending, dashOffset, dashScaleNode.
  3. Key methods: setupDiffuseColor, setupModelViewProjection.

Connects To