public final class Utils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Utils.BoxPosition |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsMesh(Array<Mesh> list,
Mesh mesh) |
static Motion |
extractMotion(Model model,
Animation animation)
|
static Animation[] |
getAnimations(Model model) |
static Array<Animation> |
getAnimations(Model model,
JointMotion jointMotion) |
static float |
getDistanceToViewAlongForwardAxis(IViewable camera,
Vec3 point) |
static float |
getDistanceToViewAlongForwardAxis(Mat4x4 lookAt,
Vec3 point) |
static int |
getMaterialIndex(Model model,
java.lang.Object materialKey) |
static Mesh |
getMesh(Mesh mesh,
java.lang.String meshName)
Search a mesh from his name
|
static Mesh |
getMesh(Model model,
java.lang.String meshName,
int meshLod)
Search a mesh from his name
|
static Mesh |
getMeshParent(Model model,
GeometryData geometry)
Search the parent mesh.
|
static Mesh |
getMeshParent(Model model,
Mesh mesh)
Search the parent mesh.
|
static Model |
getModel(Model model,
java.lang.String modelName)
Search a model from his name
|
static Model |
getModelParent(Model model,
Mesh mesh) |
static int |
getNumTextureWithDiffuseAlphaChannel(Model model) |
static int |
getNumTotalChilds(Mesh mesh) |
static int |
getNumTotalFaces(Mesh mesh) |
static int |
getNumTotalFaces(Model model,
int lod) |
static int |
getNumTotalGeometries(Mesh mesh) |
static int |
getNumTotalMeshes(Model model,
int lod) |
static int |
getNumTotalVertices(Mesh mesh) |
static int |
getNumTotalVertices(Model model,
int lod) |
static boolean |
isMaterialsReceiveLighting(Model model) |
static boolean |
isMaterialsTwoSided(Model model) |
static java.util.HashSet<Map> |
listDiffuseMaps(java.lang.Iterable<? extends IMaterial> materials) |
static java.util.HashSet<java.lang.String> |
listDiffuseTextures(java.lang.Iterable<? extends IMaterial> materials) |
static java.util.HashSet<Map> |
listExceptDiffuseMaps(java.lang.Iterable<MaterialStandard> materials) |
static java.util.HashSet<java.lang.String> |
listExceptDiffuseTextures(java.lang.Iterable<MaterialStandard> materials) |
static java.util.HashSet<GeometryData> |
listGeometryDatas(java.lang.Iterable<Mesh> meshes) |
static java.util.HashSet<Map> |
listMaps(java.lang.Iterable<? extends IMaterial> materials) |
static java.util.HashSet<MaterialStandard> |
listMaterials(Model model,
boolean rec) |
static java.util.HashSet<MaterialStandard> |
listMaterialsUsing(Model model,
Texture texture) |
static java.util.HashSet<Mesh> |
listMeshes(Mesh mesh) |
static java.util.HashSet<Mesh> |
listMeshes(Model model,
int lod,
boolean rec) |
static java.util.HashSet<Mesh> |
listMeshesUsing(java.util.HashSet<Mesh> meshes,
IMaterial material) |
static java.util.HashSet<Model> |
listModels(Model model) |
static void |
listNodes(AnimGraph graph,
java.util.HashSet<GraphNode> list) |
static java.util.HashSet<java.lang.String> |
listTextures(java.lang.Iterable<? extends IMaterial> materials)
List material maps names.
|
static java.util.HashSet<VertexData> |
listVertexDatas(java.lang.Iterable<GeometryData> geometries) |
static long |
memoryUsage(Model m)
Calculate the approximative memory usage of the model.
|
static int |
mergeDuplicatedMaterials(Model model) |
static void |
mergeLods(Model base,
Model lod1,
Model lod2,
Model lod3)
Merge up to 3 lod levels in the base
Model |
static <T extends ITransformable & IBoundable> |
moveToOrigin(T object,
Utils.BoxPosition boxPosition,
boolean zUp)
An utility to move the model to the origin, using as reference a bounding box position.
|
static int |
removeAdvancedMaps(Model model)
Remove all
Map used by shaders:
Normal
Height
Reflect
Refract
Opacity
Specular
Shininess
Glossiness
|
static boolean |
removeAndReplaceMaterial(Model model,
MaterialStandard remove,
MaterialStandard replaceWith) |
static int |
removeAnimations(Model model,
Animation[] animToRemove)
Remove the specified list of animations
|
static Array<Animation> |
removeAnimations(Model model,
JointMotion jointMotion)
Remove the specified
JointMotion from this Model.skeleton and
all Animation using the specified JointMotion. |
static int |
removeMaps(Model model,
Map.MapType type)
Remove all material map of
type specified. |
static int |
removeMapsNotLoaded(Model model) |
static boolean |
removeMaterial(Model model,
MaterialStandard remove)
Remove a material and update references
|
static Mesh |
removeMesh(Model model,
Mesh toRemove)
Remove the first occurrence of the mesh to remove
|
static Model |
removeModel(Model model,
Model remove) |
static void |
removeMotions(Model model)
|
static Transform |
removeTransform(Model model,
int index) |
static Transform |
removeTransform(Model model,
Mesh mesh,
int index) |
static int |
removeUnusedMaterials(Model model) |
static void |
renameMaterial(Model model,
MaterialStandard material,
java.lang.String newName)
Rename a material and update references
|
static void |
setMaterialKey(Model model,
java.lang.Object materialKey) |
static void |
setMaterialsForceAlphaTest(Model model,
boolean forceAlphaTest)
For all the
MaterialStandard in the specified Model, set the forceAlphaTest property |
static void |
setMaterialsReceiveLight(Model model,
boolean useLight)
For all the
MaterialStandard in the specified Model, set the useLight property |
static void |
setMaterialsTwoSided(Model model,
boolean twoSided)
For all the
MaterialStandard in the specified Model, set the twoSided property |
static void |
setMaterialsUseDiffuseAlpha(Model model,
boolean useDiffuseChannel)
For all the
MaterialStandard in the specified Model, set the useDiffuseChannel property |
static AssetManager |
simpleAssets() |
static long |
sizeOfArray(java.lang.Object[] array) |
static long |
sizeOfBoundingVolume(IVolume<?> bv) |
static void |
unassignAllMaterials(Model model) |
static void |
useMaterialStringReference(Model model)
Ensure Material name are unique and not null/empty (or set default name).
|
public static AssetManager simpleAssets()
AssetManager with a TextureList and a null TextureLoaderpublic static final java.util.HashSet<Model> listModels(Model model)
Model objects retained in the Model object (including it).public static final java.util.HashSet<MaterialStandard> listMaterials(Model model, boolean rec)
model - Model to search materialsrec - true to search in Model#getChilds()MaterialStandardpublic static final java.util.HashSet<java.lang.String> listTextures(java.lang.Iterable<? extends IMaterial> materials)
public static final java.util.HashSet<Map> listMaps(java.lang.Iterable<? extends IMaterial> materials)
public static final java.util.HashSet<java.lang.String> listDiffuseTextures(java.lang.Iterable<? extends IMaterial> materials)
public static final java.util.HashSet<Map> listDiffuseMaps(java.lang.Iterable<? extends IMaterial> materials)
public static final java.util.HashSet<java.lang.String> listExceptDiffuseTextures(java.lang.Iterable<MaterialStandard> materials)
public static final java.util.HashSet<Map> listExceptDiffuseMaps(java.lang.Iterable<MaterialStandard> materials)
public static final java.util.HashSet<Mesh> listMeshes(Model model, int lod, boolean rec)
lod - Mesh objects retained
in the Model object and in sub models if rec is true.public static java.util.HashSet<Mesh> listMeshesUsing(java.util.HashSet<Mesh> meshes, IMaterial material)
public static final java.util.HashSet<GeometryData> listGeometryDatas(java.lang.Iterable<Mesh> meshes)
Mesh objects retained in the Model object.public static final java.util.HashSet<VertexData> listVertexDatas(java.lang.Iterable<GeometryData> geometries)
public static final java.util.HashSet<MaterialStandard> listMaterialsUsing(Model model, Texture texture)
public static final Mesh removeMesh(Model model, Mesh toRemove)
model - toRemove - mesh to removepublic static final Model getModel(Model model, java.lang.String modelName)
model - modelName - model name to searchpublic static final Mesh getMesh(Model model, java.lang.String meshName, int meshLod)
model - meshName - mesh name to searchpublic static final Mesh getMesh(Mesh mesh, java.lang.String meshName)
mesh - root mesh to search from (included)meshName - mesh name to searchpublic static final Mesh getMeshParent(Model model, Mesh mesh)
model - mesh - meshpublic static final Mesh getMeshParent(Model model, GeometryData geometry)
model - mesh - meshpublic static int getNumTotalMeshes(Model model, int lod)
public static int getNumTotalFaces(Model model, int lod)
public static int getNumTotalVertices(Model model, int lod)
public static int getNumTotalChilds(Mesh mesh)
this mesh.public static int getNumTotalFaces(Mesh mesh)
this mesh and all its childs and sub-childs.public static int getNumTotalVertices(Mesh mesh)
this mesh. This is equivalent to vertices.positions.lengthpublic static int getNumTotalGeometries(Mesh mesh)
public static final void setMaterialKey(Model model, java.lang.Object materialKey)
model - a ModelmaterialKey - a material key to set to all meshes of the specified modelpublic static final int getMaterialIndex(Model model, java.lang.Object materialKey)
model - a ModelmaterialName - name of the MaterialStandard to get it's idModel.materials list, -1 if not found.public static final void setMaterialsUseDiffuseAlpha(Model model, boolean useDiffuseChannel)
MaterialStandard in the specified Model, set the useDiffuseChannel propertypublic static final void setMaterialsForceAlphaTest(Model model, boolean forceAlphaTest)
MaterialStandard in the specified Model, set the forceAlphaTest propertypublic static final void setMaterialsReceiveLight(Model model, boolean useLight)
MaterialStandard in the specified Model, set the useLight propertypublic static final void setMaterialsTwoSided(Model model, boolean twoSided)
MaterialStandard in the specified Model, set the twoSided propertypublic static final boolean isMaterialsReceiveLighting(Model model)
public static final boolean isMaterialsTwoSided(Model model)
public static final int getNumTextureWithDiffuseAlphaChannel(Model model)
public static final void unassignAllMaterials(Model model)
public static final int removeMapsNotLoaded(Model model)
public static final int removeMaps(Model model, Map.MapType type)
type specified.removeAdvancedMapsmodel - type - type of map to removeremoveAdvancedMaps(Model)public static final int removeAdvancedMaps(Model model)
Map used by shaders:
Map removedpublic static final void renameMaterial(Model model, MaterialStandard material, java.lang.String newName)
public static final boolean removeMaterial(Model model, MaterialStandard remove)
model - remove - material to removepublic static final boolean removeAndReplaceMaterial(Model model, MaterialStandard remove, MaterialStandard replaceWith)
public static final int removeUnusedMaterials(Model model)
public static final int mergeDuplicatedMaterials(Model model)
public static final void useMaterialStringReference(Model model)
MaterialStandard references by name (String), instead of index (Integer)model - model to do operation onpublic static final void mergeLods(Model base, Model lod1, Model lod2, Model lod3)
Modelpublic static <T extends ITransformable & IBoundable> Vec3 moveToOrigin(T object, Utils.BoxPosition boxPosition, boolean zUp)
boxPosition - Utils.BoxPositionpublic static final float getDistanceToViewAlongForwardAxis(IViewable camera, Vec3 point)
public static final float getDistanceToViewAlongForwardAxis(Mat4x4 lookAt, Vec3 point)
public static final Array<Animation> getAnimations(Model model, JointMotion jointMotion)
model - jointMotion - Animation which uses the specified JointMotionpublic static final Array<Animation> removeAnimations(Model model, JointMotion jointMotion)
JointMotion from this Model.skeleton and
all Animation using the specified JointMotion.jointMotion - JointMotion to removejava.lang.IllegalStateException - if Model.skeleton is nullpublic static final Motion extractMotion(Model model, Animation animation)
model - animation - public static final void removeMotions(Model model)
public static final int removeAnimations(Model model, Animation[] animToRemove)
model - animToRemove - list of animation to removepublic static long memoryUsage(Model m)
public static long sizeOfBoundingVolume(IVolume<?> bv)
public static final long sizeOfArray(java.lang.Object[] array)
Bonzai Engine 1.4.1-20200831 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2019 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com