Lines Matching refs:geometry
39 import com.jme3.scene.Geometry;
73 * <p>The helper methods that work with <code>Geometry</code> objects handle the <em>DiffuseMap</em> or <em>ColorMap</em> as the master map and
78 * to the atlas. You can access the information for each texture or geometry texture via helper methods.</p>
80 * <p>The TextureAtlas also allows you to change the texture coordinates of a mesh or geometry
93 * Create one geometry out of several geometries that are loaded from a j3o file:
96 * Geometry geom = TextureAtlas.makeAtlasBatch(scene);
99 * Create a texture atlas and change the texture coordinates of one geometry:
111 * //change one geometry to use atlas, apply texture coordinates and replace material.
112 * Geometry geom = scene.getChild("MyGeometry");
140 * @param geometry
143 public boolean addGeometry(Geometry geometry) {
144 Texture diffuse = getMaterialTexture(geometry, "DiffuseMap");
145 Texture normal = getMaterialTexture(geometry, "NormalMap");
146 Texture specular = getMaterialTexture(geometry, "SpecularMap");
148 diffuse = getMaterialTexture(geometry, "ColorMap");
411 * Applies the texture coordinates to the given geometry
413 * @param geom The geometry to change the texture coordinate buffer on.
416 public boolean applyCoords(Geometry geom) {
422 * if the DiffuseMap or ColorMap of the input geometry exist in the atlas.
423 * @param geom The geometry to change the texture coordinate buffer on.
428 public boolean applyCoords(Geometry geom, int offset, Mesh outMesh) {
436 throw new IllegalStateException("Geometry mesh has no texture coordinate buffer.");
455 throw new IllegalStateException("Geometry has no proper texture.");
466 List<Geometry> geometries = new ArrayList<Geometry>();
469 for (Geometry geometry : geometries) {
470 if (!atlas.addGeometry(geometry)) {
479 * Creates one geometry out of the given root spatial and merges all single
484 * @return A new geometry that uses the generated texture atlas and merges all meshes of the root spatial, null if the atlas cannot be created because not all textures fit.
486 public static Geometry makeAtlasBatch(Spatial spat, AssetManager mgr, int atlasSize) {
487 List<Geometry> geometries = new ArrayList<Geometry>();
493 Geometry geom = new Geometry();
521 private static void applyAtlasCoords(List<Geometry> geometries, Mesh outMesh, TextureAtlas atlas) {
524 for (Geometry geom : geometries) {
543 private static Texture getMaterialTexture(Geometry geometry, String mapName) {
544 Material mat = geometry.getMaterial();