import { Material } from "https://deno.land/x/threejs_4_deno@v121/src/materials/Material.js";
Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
Properties
Blending destination. It's one of the blending mode constants defined in Three.js. Default is OneMinusSrcAlphaFactor.
Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation.
Which blending to use when displaying objects with this material. Default is NormalBlending.
Blending source. It's one of the blending mode constants defined in Three.js. Default is SrcAlphaFactor.
Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). See the WebGL / clipping /intersection example. Default is null.
Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true.
Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }. The pairs are defined in both vertex and fragment shaders. Default is undefined.
Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.
Whether rendering this material has any effect on the depth buffer. Default is true. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
Used to check whether this or derived classes are materials. Default is true. You should not change this, as it used internally for optimisation.
Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. This property is automatically set to true when instancing a new material.
Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null.
Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false.
Defines which of the face sides will cast shadows. Default is null. If null, the value is opposite that of side, above.
Defines which of the face sides will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.
Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operation constants for all possible values.
The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil operation constants for all possible values.
Which stencil operation to perform when the comparison function returns true but the depth test fails. Default is KeepStencilOp. See the stencil operation constants for all possible values.
Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is KeepStencilOp. See the stencil operation constants for all possible values.
Defines whether this material is tone mapped according to the renderer's toneMapping setting. Default is true.
Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. When set to true, the extent to which the material is transparent is controlled by setting it's .opacity property. Default is false.
Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a scene.
An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.
Methods
In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader as needed.
This disposes the material. Textures of a material don't get disposed. These needs to be disposed by Texture.
An optional callback that is executed immediately before the shader program is compiled. This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.