Class MaterialComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, IObserver, IUpdatable<MaterialComponent>, IComponent, IMaterialProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.badlogic.gdx.graphics.TextureAO texture.booleanAdd also color even if texture is presentfloat[]float[]float[]Height scale in internal units.com.badlogic.gdx.math.Vector2Biome lookup texture name.floatfloatfloat[]booleanOcclusion clouds: ambient occlusion uses the cloud texture.float[]floatstatic final CubemapComponentReflection cubemap for all materials.float[]com.badlogic.gdx.utils.Array<VirtualTextureComponent> booleanbooleandouble[]Per-slot minimum density for a volume to act as an occluder, indexed like the volume slots (volume0..volume3).Fields inherited from class NamedComponent
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VirtualTextureComponentconvertToComponent(Map<Object, Object> map) voidcopyFrom(MaterialComponent other) voiddispose()voiddisposeCubemap(com.badlogic.gdx.assets.AssetManager manager, Material mat, int attributeIndex, CubemapComponent cubemap) voidvoiddisposeTexture(com.badlogic.gdx.assets.AssetManager manager, Material material, String name, String nameUnpacked, int attributeIndex, com.badlogic.gdx.graphics.Texture tex) voiddisposeTextures(com.badlogic.gdx.assets.AssetManager manager) Disposes and unloads all currently loaded textures immediatelystatic BiomeLUTManagerbooleanbooleanhasSVT()voidinitialize(String name) voidinitialize(String name, com.badlogic.gdx.assets.AssetManager manager) voidinitMaterial(com.badlogic.gdx.assets.AssetManager manager, IntModelInstance instance, float[] diffuseCol, boolean culling) voidinitMaterial(com.badlogic.gdx.assets.AssetManager manager, Material mat, Material ring, float[] diffuseCol, boolean culling) booleanisFinishedLoading(com.badlogic.gdx.assets.AssetManager manager) voidEvent notification call.voidprint(Logger.Log log) voidrandomizeAlien(long seed) voidrandomizeAll(long seed) voidrandomizeDesert(long seed) voidrandomizeEarthLike(long seed) voidrandomizeFrozenPlanet(long seed) voidrandomizeGasGiant(long seed) voidrandomizeLava(long seed) voidrandomizeRockyPlanet(long seed) voidrandomizeTropical(long seed) voidvoidsetAmbientOcclusionCubemap(String cubemap) voidvoidsetAoSVT(VirtualTextureComponent virtualTextureComponent) voidvoidDeprecated.voidsetBiomehueshift(Double hueShift) voidsetBiomeHueShift(Double hueShift) voidsetBiomelut(String biomeLookupTex) voidsetBiomeLUT(String biomeLookupTex) voidsetBiomeSaturation(Double saturation) voidsetColorIfTexture(Boolean colorIfTexture) voidsetDiffuse(String diffuse) voidsetDiffuseCubemap(String cubemap) voidsetDiffuseScattering(double[] diffuseScattering) voidsetDiffuseScattering(Double diffuseScattering) voidsetDiffuseSVT(VirtualTextureComponent virtualTextureComponent) voidsetDiffuseSVT(Map<Object, Object> virtualTexture) voidsetEmissive(double[] emissive) voidsetEmissive(Double emissive) voidsetEmissive(String emissive) voidsetEmissiveCubemap(String cubemap) voidsetEmissiveSVT(VirtualTextureComponent virtualTextureComponent) voidsetEmissiveSVT(Map<Object, Object> virtualTexture) voidsetGenerated(boolean generated) voidvoidsetHeightCubemap(String cubemap) voidsetHeightMapTopKm(Double heightMapTopKm) voidsetHeightMapTopM(Double heightMapTopM) voidsetHeightScale(Double heightScale) voidsetHeightScaleKm(Double heightScale) voidsetHeightScaleM(Double heightScale) voidsetHeightSVT(VirtualTextureComponent virtualTextureComponent) voidsetHeightSVT(Map<Object, Object> virtualTexture) voidvoidsetLUTHueShift(Double hueShift) voidsetLUTSaturation(Double saturation) voidsetMetallic(Double metallicColor) voidsetMetallic(String metallic) voidsetMetallicCubemap(String cubemap) voidsetMetallicSVT(VirtualTextureComponent virtualTextureComponent) voidsetMetallicSVT(Map<Object, Object> virtualTexture) voidDeprecated.usesetEmissive(String)insteadvoidsetNightCubemap(String cubemap) voidsetNoise(NoiseComponent noise) voidvoidsetNormalCubemap(String cubemap) voidsetNormalSVT(VirtualTextureComponent virtualTextureComponent) voidsetNormalSVT(Map<Object, Object> virtualTexture) voidsetOcclusionClouds(boolean state) voidsetOcclusionMetallicRoughness(String texture) voidsetReflection(double[] metallic) voidsetReflection(Double metallicColor) Deprecated.usesetMetallic(String)insteadvoidsetReflectionCubemap(String reflectionCubemap) voidvoidsetRingDiffuse(String ringDiffuse) voidsetRingDiffuseScattering(double[] ringDiffuseScattering) voidsetRingDiffuseScattering(Double ringDiffuseScattering) voidsetRingnormal(String ringNormal) voidsetRingNormal(String ringNormal) voidsetRoughness(Double roughness) voidsetRoughness(String roughness) voidsetRoughnessCubemap(String cubemap) voidsetRoughnessSVT(VirtualTextureComponent virtualTextureComponent) voidsetRoughnessSVT(Map<Object, Object> virtualTexture) voidvoidsetSpecular(double[] specular) voidsetSpecular(Double specular) voidsetSpecular(String specular) voidsetSpecularCubemap(String cubemap) voidsetSpecularSVT(VirtualTextureComponent virtualTextureComponent) voidsetSpecularSVT(Map<Object, Object> virtualTexture) voidsetSpecularValue(Double specular) voidsetSpecularValues(double[] specular) voidsetTexture0(String texture0) voidsetTexture1(String texture1) voidsetVolume0(String tex) voidsetVolume1(String tex) voidsetVolume2(String tex) voidsetVolume3(String tex) voidsetVolumeDepthThreshold(double[] thresholds) voidsetVolumeDepthThreshold(int[] thresholds) Overload for a scene that writes its thresholds without a decimal point, e.g.toString()voidupdateWith(MaterialComponent object) Methods inherited from class NamedComponent
createCubeSphereParameters, createIcoSphereParameters, createOctahedronSphereParameters, createUVSphereParameters, gaussian, gaussian, gaussian, uniformModifier and TypeMethodDescriptioncreateCubeSphereParameters(long divisions, double diameter, boolean flip) createIcoSphereParameters(long recursion, double diameter, boolean flip) createOctahedronSphereParameters(long divisions, double diameter, boolean flip) createUVSphereParameters(long quality, double diameter, boolean flip) protected doubleprotected doubleprotected doubleprotected double
-
Field Details
-
texInitialised
public boolean texInitialised -
texLoading
public boolean texLoading -
diffuse
-
specular
-
normal
-
emissive
-
ring
-
height
-
ringnormal
-
roughness
-
metallic
-
ao
-
occlusionMetallicRoughness
-
texture0
-
texture1
-
volume0
-
volume1
-
volume2
-
volume3
-
diffuseUnpacked
-
specularUnpacked
-
normalUnpacked
-
emissiveUnpacked
-
ringUnpacked
-
heightUnpacked
-
ringnormalUnpacked
-
roughnessUnapcked
-
metallicUnpacked
-
aoUnpacked
-
occlusionMetallicRoughnessUnpacked
-
texture0Unpacked
-
texture1Unpacked
-
volume0Unpacked
-
volume1Unpacked
-
volume2Unpacked
-
volume3Unpacked
-
volumeDepthThreshold
public double[] volumeDepthThresholdPer-slot minimum density for a volume to act as an occluder, indexed like the volume slots (volume0..volume3). Entryiis the smallest density of volumeithat is allowed to write to the depth buffer, so anything drawn later (stars, labels, points, lines) is hidden behind it.A missing entry, or one that is zero or negative, means that slot never occludes: it is drawn, but nothing is hidden behind it. That is the right setting for an emissive volume such as gas, whose faint outer haze must not cut an opaque hole in the star field. Only an absorbing volume (dust) should carry a threshold.
The value is a fraction of the volume's own normalisation (the same one the shader samples as density, i.e. the alpha channel of an RGBA volume), so it is independent of the texture resolution. Compare it against the file's density histogram: for the shipped ArmDust volume the median occupied voxel is 0.024 and a third of them sit above 0.05, so
[0.0, 0.02]keeps roughly half the dust mass as an occluder and discards the blur tail.Example, in the
materialnode of a scene:"material": { "volume0": "$data/.../galaxy_Gas_rgba.raw.gz", // gas: emits only "volume1": "$data/.../galaxy_ArmDust_rgba.raw.gz", // dust: absorbs "volumeDepthThreshold": [0.0, 0.02] // slot 0 never occludes, slot 1 does }Note that the array elements must be written with a decimal point: the scene loader types a JSON array from its first element, so[0, 0.02]would be read as an int array. -
diffuseColor
public float[] diffuseColor -
specularColor
public float[] specularColor -
metallicColor
public float[] metallicColor -
emissiveColor
public float[] emissiveColor -
diffuseScatteringColor
public float[] diffuseScatteringColor -
ringDiffuseScatteringColor
public float[] ringDiffuseScatteringColor -
roughnessColor
public float roughnessColor -
heightScale
Height scale in internal units. The mapping value of white in the height map (maximum height value in this body). Black is mapped to 0. -
heightSize
public com.badlogic.gdx.math.Vector2 heightSize -
heightData
-
nc
-
diffuseSvt
-
specularSvt
-
heightSvt
-
normalSvt
-
emissiveSvt
-
roughnessSvt
-
metallicSvt
-
aoSvt
-
svts
-
diffuseCubemap
-
specularCubemap
-
normalCubemap
-
emissiveCubemap
-
heightCubemap
-
roughnessCubemap
-
metallicCubemap
-
aoCubemap
-
aoTexture
public com.badlogic.gdx.graphics.Texture aoTextureAO texture. -
occlusionClouds
public boolean occlusionCloudsOcclusion clouds: ambient occlusion uses the cloud texture. -
lut
Biome lookup texture name. This is the name stripped of suffixes and prefixes. Examples:biome_lut_earthlike_00.jpg -> earthlike
biome_lut_desert_03.jpg -> desert
-
lutHueShift
public float lutHueShift -
lutSaturation
public float lutSaturation -
colorIfTexture
public boolean colorIfTextureAdd also color even if texture is present
-
Constructor Details
-
MaterialComponent
public MaterialComponent()
-
-
Method Details
-
getLUTManager
-
initialize
-
initialize
- Specified by:
initializein interfaceIComponent- Overrides:
initializein classNamedComponent
-
isFinishedLoading
public boolean isFinishedLoading(com.badlogic.gdx.assets.AssetManager manager) -
hasSVT
public boolean hasSVT() -
initMaterial
public void initMaterial(com.badlogic.gdx.assets.AssetManager manager, IntModelInstance instance, float[] diffuseCol, boolean culling) -
initMaterial
-
setGenerated
public void setGenerated(boolean generated) -
getMaterial
- Specified by:
getMaterialin interfaceIMaterialProvider
-
getRingMaterial
-
setBase
Deprecated.usesetDiffuse(String)instead -
setDiffuse
-
setSpecular
-
setSpecularValue
-
setSpecular
-
setSpecularValues
public void setSpecularValues(double[] specular) -
setSpecular
public void setSpecular(double[] specular) -
setNormal
-
setNight
Deprecated.usesetEmissive(String)instead -
setEmissive
-
setEmissive
-
setEmissive
public void setEmissive(double[] emissive) -
setDiffuseScattering
-
setDiffuseScattering
public void setDiffuseScattering(double[] diffuseScattering) -
setRing
-
setRingDiffuse
-
setRingnormal
-
setRingNormal
-
setRingDiffuseScattering
-
setRingDiffuseScattering
public void setRingDiffuseScattering(double[] ringDiffuseScattering) -
setHeight
-
setHeightScaleKm
-
setHeightScaleM
-
setHeightScale
-
setHeightMapTopKm
-
setHeightMapTopM
-
setColorIfTexture
-
setNoise
-
setLUT
-
setBiomelut
-
setBiomeLUT
-
setLUTHueShift
-
setBiomehueshift
-
setBiomeHueShift
-
setLUTSaturation
-
setBiomeSaturation
-
setReflection
Deprecated.usesetMetallic(String)instead -
setMetallic
-
setMetallic
-
setReflection
public void setReflection(double[] metallic) -
setRoughness
-
setRoughness
-
setAo
-
setOcclusionMetallicRoughness
-
setTexture0
-
setTexture1
-
setVolume0
-
setVolume1
-
setVolume2
-
setVolume3
-
setVolumeDepthThreshold
public void setVolumeDepthThreshold(double[] thresholds) -
setVolumeDepthThreshold
public void setVolumeDepthThreshold(int[] thresholds) Overload for a scene that writes its thresholds without a decimal point, e.g.[0, 1]. The scene loader types a JSON array from the type of its first element, so[0, 0.02]arrives as adouble[]and[0, 1]as anint[]; without this the load would fail with a reflection error rather than silently using the wrong values. -
setDiffuseCubemap
-
setNormalCubemap
-
setSpecularCubemap
-
setEmissiveCubemap
-
setNightCubemap
-
setHeightCubemap
-
setMetallicCubemap
-
setRoughnessCubemap
-
setReflectionCubemap
-
setAmbientOcclusionCubemap
-
setOcclusionClouds
public void setOcclusionClouds(boolean state) -
setAmbientOcclusionCubemap
-
setSkybox
-
setDiffuseSVT
-
setDiffuseSVT
-
setSpecularSVT
-
setSpecularSVT
-
setNormalSVT
-
setNormalSVT
-
setHeightSVT
-
setHeightSVT
-
setEmissiveSVT
-
setEmissiveSVT
-
setMetallicSVT
-
setMetallicSVT
-
setRoughnessSVT
-
setRoughnessSVT
-
setAoSVT
-
setAoSVT
-
convertToComponent
-
hasHeight
public boolean hasHeight() -
disposeTexture
-
disposeCubemap
public void disposeCubemap(com.badlogic.gdx.assets.AssetManager manager, Material mat, int attributeIndex, CubemapComponent cubemap) -
disposeTextures
public void disposeTextures(com.badlogic.gdx.assets.AssetManager manager) Disposes and unloads all currently loaded textures immediately- Parameters:
manager- The asset manager
-
disposeNoiseBuffers
public void disposeNoiseBuffers() -
notify
-
getTexturesString
-
toString
-
copyFrom
-
randomizeAll
public void randomizeAll(long seed) -
randomizeRockyPlanet
public void randomizeRockyPlanet(long seed) -
randomizeEarthLike
public void randomizeEarthLike(long seed) -
randomizeDesert
public void randomizeDesert(long seed) -
randomizeTropical
public void randomizeTropical(long seed) -
randomizeLava
public void randomizeLava(long seed) -
randomizeAlien
public void randomizeAlien(long seed) -
randomizeFrozenPlanet
public void randomizeFrozenPlanet(long seed) -
randomizeGasGiant
public void randomizeGasGiant(long seed) -
print
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
updateWith
- Specified by:
updateWithin interfaceIUpdatable<MaterialComponent>
-
setDiffuse(String)instead