Package net.risingworld.api.assets
Klasse TextureAsset
java.lang.Object
net.risingworld.api.assets.Asset
net.risingworld.api.assets.TextureAsset
Represents a texture / image asset.
Important: Images get compressed to DXT format automatically, so it's recommendable to either use a power of two texture size (e.g 256, 512, 1024, 2048 etc), or at least a width/height which is a multiple of 4 - otherwise compression is not possible and the texture will consume 4-8 times more VRAM. Please bear in mind that the file size is not related to the actual memory consumption. But it's still a good idea to keep an eye on the file size to keep the download sizes low in multiplayer.
Supported file formats: jpg, jpeg, png, gif, tga, tiff, bmp
Important: Images get compressed to DXT format automatically, so it's recommendable to either use a power of two texture size (e.g 256, 512, 1024, 2048 etc), or at least a width/height which is a multiple of 4 - otherwise compression is not possible and the texture will consume 4-8 times more VRAM. Please bear in mind that the file size is not related to the actual memory consumption. But it's still a good idea to keep an eye on the file size to keep the download sizes low in multiplayer.
Supported file formats: jpg, jpeg, png, gif, tga, tiff, bmp
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen net.risingworld.api.assets.Asset
Asset.Source, Asset.Type
-
Feldübersicht
Von Klasse geerbte Felder net.risingworld.api.assets.Asset
DEFAULT_EXTENSION
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic TextureAsset
load
(byte[] data) Loads a texture from raw byte data.static TextureAsset
loadFromAssetBundle
(AssetBundle bundle, String path) static TextureAsset
loadFromFile
(String file) Creates a new texture asset instance and loads the texture / image from a file on the hard drive.static TextureAsset
loadFromGame
(String path) Loads a texture / image from the game assets.static TextureAsset
loadFromPlugin
(Plugin plugin, String resource) Creates a new texture asset instance and loads the texture / image from the plugin jar file.static TextureAsset
loadFromURL
(String url) Loads a texture from an URLVon Klasse geerbte Methoden net.risingworld.api.assets.Asset
dispose, equals, getChecksum, getDependency, getExtension, getHandle, getPath, getSource, getType, hashCode, isDisposed
-
Methodendetails
-
loadFromGame
Loads a texture / image from the game assets. This is quite efficient because the server doesn't have to send any data to the clients.- Parameter:
path
- the path to the game texture.- Gibt zurück:
- a new texture asset instance.
-
loadFromFile
Creates a new texture asset instance and loads the texture / image from a file on the hard drive.- Parameter:
file
- the path to the texture file on the harddrive.- Gibt zurück:
- a new texture asset instance.
- Example: Load image "Banner.jpg" from "assets" subfolder in plugin directory
-
loadFromPlugin
Creates a new texture asset instance and loads the texture / image from the plugin jar file.- Parameter:
plugin
- a reference to the plugin. This is required to make sure the game loads the resource from the correct plugin jar.resource
- the path to the resource (inside the jar file).- Gibt zurück:
- a new texture asset instance.
- Example: Load image "Banner.jpg" from jar file (in package rw.plugin.images)
-
loadFromAssetBundle
-
loadFromURL
Loads a texture from an URL- Parameter:
url
- the URL you want to download the image from.- Gibt zurück:
- a new texture asset instance.
- Example: Load image from an URL
-
load
Loads a texture from raw byte data.- Parameter:
data
- the raw byte data representing a PNG/JPG image (or any other supported format).- Gibt zurück:
- a new texture asset instance.
-