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
Modifier and TypeClassDescriptionstatic enum
static enum
Nested 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 TypeMethodDescriptionvoid
Applies all changes done to the material, i.e syncs the material with all players.static MaterialAsset
Creates a new material instance.void
setAlphaThreshold
(float threshold) void
setColor
(float r, float g, float b, float a) void
setColor
(int rgba) void
setFlags
(MaterialAsset.Flags... flags) void
setMetallic
(float metallic) void
setNormalMap
(TextureAsset normalMap) void
setNormalMapStrength
(float strength) void
setSmoothness
(float smoothness) void
setTexture
(TextureAsset texture) void
setTextureScale
(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.
-