Package net.risingworld.api.assets
Class MaterialAsset
java.lang.Object
net.risingworld.api.assets.Asset
net.risingworld.api.assets.MaterialAsset
Represents a material, which descibes the visual appearance of a game object.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumNested classes/interfaces inherited from class net.risingworld.api.assets.Asset
Asset.Source, Asset.Type -
Field Summary
Fields inherited from class net.risingworld.api.assets.Asset
DEFAULT_EXTENSION -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies all changes done to the material, i.e syncs the material with all players.static MaterialAssetCreates a new material instance.voidsetAlphaThreshold(float threshold) voidsetColor(float r, float g, float b, float a) voidsetColor(int rgba) voidsetFlags(MaterialAsset.Flags... flags) voidsetMetallic(float metallic) voidsetNormalMap(TextureAsset normalMap) voidsetNormalMapStrength(float strength) voidsetSmoothness(float smoothness) voidsetTexture(TextureAsset texture) voidsetTextureScale(float sx, float sy) Methods inherited from class net.risingworld.api.assets.Asset
dispose, equals, getChecksum, getDependency, getExtension, getHandle, getPath, getSource, getType, hashCode, isDisposed
-
Method Details
-
create
Creates a new material instance. You can change individual properties and assign textures (represented by the TextureAsset class) to it.- Parameters:
name- a custom name for the material.- Returns:
- a new material asset instance.
-
setTexture
-
setNormalMap
-
setNormalMapStrength
public void setNormalMapStrength(float strength) -
setTextureScale
public void setTextureScale(float sx, float sy) -
getTextureScale
-
setColor
public void setColor(float r, float g, float b, float a) -
setColor
public void setColor(int rgba) -
setSmoothness
public void setSmoothness(float smoothness) -
setMetallic
public void setMetallic(float metallic) -
setAlphaThreshold
public void setAlphaThreshold(float threshold) -
setFlags
-
applyChanges
public void applyChanges()Applies all changes done to the material, i.e syncs the material with all players. Note: When assigning the material to an object, this happens automatically.
-