SpriteMaterial
A dedicated material of Sprite| Sprite.
A dedicated material of Sprite| Sprite.
Extends
Constructors
Constructor
new SpriteMaterial(
p?):SpriteMaterial
Parameters
p?
SpriteMaterialParameters
Returns
SpriteMaterial
Overrides
Material.constructor
Properties
isDynamicShape
isDynamicShape:
boolean
Mark this shape of this material is largely affect by shader. Hint the engine that pick, culling is disabled
Deprecated
Inherited from
isVolumeRendering
isVolumeRendering:
boolean
Mark this material uses volume like rendering technology. Hint the engine that some effect is disabled
Deprecated
Inherited from
MAX_TEXTURES
readonlystaticMAX_TEXTURES:6=6
max texture count, just in case some platform will take use of some channels by default, so set to 6 instead of 8
Inherited from
Material.MAX_TEXTURES
name
name:
string
Optional name of the object (doesn’t need to be unique). Default is an empty string.
Inherited from
id
id:
number
Unique number for this material instance.
Inherited from
transparent
transparent:
boolean
If use transparent effect, this value must be set to true to enable blending.
Default Value
false
Inherited from
visible
visible:
boolean
Defines whether this material is visible.
Default Value
true
Inherited from
programId
programId:
number
The id of shader program which this material shader belongs to.
Inherited from
side
side:
Side
Set which side of the object will be seen on screen.
Inherited from
blending
blending:
Blending
Which blending to use when displaying objects with this material. This must be set to CustomBlending to use custom blendSrc, blendDst or blendEquation. See the blending mode constants for all possible values. Default is NormalBlending.
Default Value
Inherited from
blendSrc
blendSrc:
BlendingFactor
Blending source. Default is SrcAlphaFactor. See the source factors constants for all possible values.
Default Value
Inherited from
blendDst
blendDst:
BlendingFactor
Blending destination. Default is OneMinusSrcAlphaFactor. See the destination factors constants for all possible values.
Default Value
Inherited from
blendEquation
blendEquation:
BlendingEquation
Blending equation to use when applying blending. Default is AddEquation. See the blending equation constants for all possible values.
Default Value
Inherited from
blendSrcAlpha
blendSrcAlpha:
Nullable<BlendingFactor>
The transparency of the blendSrc.
Inherited from
blendDstAlpha
blendDstAlpha:
Nullable<BlendingFactor>
The transparency of the blendDst.
Inherited from
blendEquationAlpha
blendEquationAlpha:
Nullable<BlendingEquation>
The transparency of the blendEquation.
Inherited from
stencilWrite
stencilWrite:
boolean
Whether rendering this material has any effect on the stencil buffer.
Default Value
false
Inherited from
stencilWriteMask
stencilWriteMask:
number
The bit mask to use when writing to the stencil buffer.
Default Value
0xFF
Inherited from
stencilFuncMask
stencilFuncMask:
number
The bit mask to use when comparing against the stencil buffer.
Default Value
0xFF
Inherited from
stencilFunc
stencilFunc:
StencilFunc
The stencil comparison function to use.
Default Value
Inherited from
stencilRef
stencilRef:
number
The value to use when performing stencil comparisons or stencil operations.
Default Value
0
Inherited from
stencilFail
stencilFail:
StencilOp
Which stencil operation to perform when the comparison function returns false.
Default Value
Inherited from
stencilZFail
stencilZFail:
StencilOp
Which stencil operation to perform when the comparison function returns true but the depth test fails.
Default Value
Inherited from
stencilZPass
stencilZPass:
StencilOp
Which stencil operation to perform when the comparison function returns true and the depth test passes.
Default Value
Inherited from
depthFunc
depthFunc:
DepthModes
Which depth function to use.
Default Value
Inherited from
depthTest
depthTest:
boolean
Whether to have depth test enabled when rendering this material. If this is set to false, this object’s occluding relationship will depend on Object3D.renderOrder| renderOrder.
Default Value
true
Inherited from
depthWrite
depthWrite:
boolean
Whether rendering this material has any effect on the depth buffer.
Default Value
true
Inherited from
colorWrite
colorWrite:
boolean
Whether to render the material’s color. This can be used in conjunction with a Object3D.renderOrder| renderOrder property to create invisible objects that occlude other objects.
Default Value
true
Inherited from
colorWriteMasks
colorWriteMasks: [
boolean,boolean,boolean,boolean]
Inherited from
polygonOffset
polygonOffset:
boolean
Whether to use polygon offset.
Default Value
false
Inherited from
polygonOffsetFactor
polygonOffsetFactor:
number
Sets the polygon offset factor.
Default Value
0
Inherited from
polygonOffsetUnits
polygonOffsetUnits:
number
Sets the polygon offset units.
Default Value
0
Inherited from
premultipliedAlpha
premultipliedAlpha:
boolean
Whether to premultiply the alpha (transparency) value.
Default Value
false
Inherited from
onBeforeRender?
optionalonBeforeRender?: (renderer) =>void
An optionally overriding method for extents to get data from renderer before update uniforms.
Parameters
renderer
Renderer
instance of renderer for engine.
Returns
void
Inherited from
colorWriteMask
colorWriteMask: [
boolean,boolean,boolean,boolean]
Inherited from
sizeAttenuation
sizeAttenuation:
boolean
Whether the size of the sprite is attenuated by the camera depth. (Perspective camera only.)
Default Value
false
rotation
rotation:
number
The rotation of the sprite in radians.
Default Value
0
color
color:
Readonly<Pick<ReadonlyMarked,"_readonly_mark"|"cloneReadonly"|"clone"|"g"|"r"|"b"|"isColor"|"equals"|"getHex"|"getSerializeData">>
Color of the material, by default set to white (0xffffff). The value of color multiply with the color of texture.
texture
texture:
Nullable<Texture2D>
A picture for sprite.
Default Value
null
opacity
opacity:
number
The Transparency of object.
Default Value
null
userData
readonlyuserData:Record<keyofany,any>
Inherited from
_uuid
_uuid:
any
Inherited from
uuid
uuid:
string
Inherited from
_listeners
_listeners:
Map<Symbol,Listener<never>[]>
Inherited from
Accessors
businessTag
Get Signature
get businessTag():
string
Returns
string
Set Signature
set businessTag(
v):void
Parameters
v
string
Returns
void
Inherited from
Methods
getComponents()
getComponents(): readonly
ShaderComponent[]
Returns
readonly ShaderComponent[]
Inherited from
deleteComponent()
deleteComponent(
index):void
Parameters
index
number
Returns
void
Inherited from
addComponent()
addComponent(
c,index?):void
Parameters
c
ShaderComponent
index?
number
Returns
void
Inherited from
refreshInstanceInBuilding()
refreshInstanceInBuilding(
enable):void
Parameters
enable
boolean
Returns
void
Inherited from
Material.refreshInstanceInBuilding
setColorWriteMasks()
setColorWriteMasks(
r,g,b,a):void
Parameters
r
boolean
g
boolean
b
boolean
a
boolean
Returns
void
Inherited from
notifyMaterialPropertyChanged()
notifyMaterialPropertyChanged():
void
When user change the material property manually, this method need to use to refresh data.
Returns
void
Inherited from
Material.notifyMaterialPropertyChanged
getUUID()
getUUID():
string
UUID of this material instance. This gets automatically assigned, so this shouldn’t be edited.
Returns
string
Inherited from
notifyRecompileShader()
notifyRecompileShader():
void
Reset the key of shader and force engine to compile shader again.
Returns
void
Inherited from
Material.notifyRecompileShader
copyBase()
copyBase(
other):void
Copy basic properties from other material.
Parameters
other
the source of copied data
Returns
void
Inherited from
freeGPU()
freeGPU():
void
Make engine clear the current material’s data in Ubo.
Returns
void
Inherited from
destroyAllResourcesOwned()
destroyAllResourcesOwned():
void
Returns
void
Inherited from
Material.destroyAllResourcesOwned
freeAllGpuResourceOwned()
freeAllGpuResourceOwned():
void
Returns
void
Inherited from
Material.freeAllGpuResourceOwned
className()
className():
string
The name of instance’s class.
Returns
string
Overrides
setValues()
setValues(
p):void
Change the corresponding attribute according to the values of given SpriteMaterialParameters| parameters.
Parameters
p
SpriteMaterialParameters
a object of specified type contains parameters.
Returns
void
Overrides
serialize()
serialize(
ctx):void
Store the attributes of this class into string as serializing format.
Parameters
ctx
Serializer
an instance used to store the data of scene objects.
Returns
void
Overrides
deserialize()
deserialize(
ctx):void
Parse the data for this class from string according to serializing format.
Parameters
ctx
Deserializer
an instance give the method to take the data for attribute.
Returns
void
Overrides
copy()
copy(
other):this
Copy the data to this instance from other instance.
Parameters
other
SpriteMaterial
the source of copied data
Returns
this
Overrides
clone()
clone():
SpriteMaterial
Return a cloned instance of this class.
Returns
SpriteMaterial
Overrides
markBusinessTag()
markBusinessTag(
v):this
Parameters
v
string
Returns
this
Inherited from
isDestroyed()
isDestroyed():
boolean
Returns
boolean
Inherited from
destroy()
destroy():
void
Returns
void
Inherited from
validate()
validate():
void
Returns
void
Inherited from
on()
on<
T>(_type,_listener):void
Adds a listener to an event type.
Type Parameters
T
T
Parameters
_type
EventType<T>
_listener
Listener<T>
Returns
void
Inherited from
once()
once<
T>(_type,_listener):void
Only active the listener one times and then off it| it.
Type Parameters
T
T
Parameters
_type
EventType<T>
_listener
Listener<T>
Returns
void
Inherited from
has()
has<
T>(_type,_listener):boolean
Checks if listener is added to an event type.
Type Parameters
T
T
Parameters
_type
EventType<T>
_listener
Listener<T>
Returns
boolean
Inherited from
off()
off<
T>(_type,_listener):void
Removes a listener from listening list.
Type Parameters
T
T
Parameters
_type
EventType<T>
_listener
Listener<T>
Returns
void
Inherited from
emit()
Call Signature
emit(
type):void
Active the event and call the registered listener.
Parameters
type
EventType<never>
Returns
void
Inherited from
Call Signature
emit<
T>(type,payload):void
Type Parameters
T
T
Parameters
type
EventType<T>
payload
T
Returns
void
Inherited from
clearAllListeners()
clearAllListeners():
void
Removes all listeners from listening list.
Returns
void