aboutsummaryrefslogtreecommitdiff
path: root/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshContext.java
blob: de43db7c877e5750ee54bacce89ee96b8395eb08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.jme3.scene.plugins.blender.meshes;

import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.VertexBuffer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Class that holds information about the mesh.
 * 
 * @author Marcin Roguski (Kaelthas)
 */
public class MeshContext {
	/** The mesh stored here as a list of geometries. */
	private List<Geometry> mesh;
	/** Vertex list that is referenced by all the geometries. */
	private List<Vector3f> vertexList;
	/** The vertex reference map. */
	private Map<Integer, List<Integer>> vertexReferenceMap;
	/** The UV-coordinates for each of the geometries. */
	private Map<Geometry, VertexBuffer> uvCoordinates = new HashMap<Geometry, VertexBuffer>();

	/**
	 * This method returns the referenced mesh.
	 * 
	 * @return the referenced mesh
	 */
	public List<Geometry> getMesh() {
		return mesh;
	}

	/**
	 * This method sets the referenced mesh.
	 * 
	 * @param mesh
	 *            the referenced mesh
	 */
	public void setMesh(List<Geometry> mesh) {
		this.mesh = mesh;
	}

	/**
	 * This method returns the vertex list.
	 * 
	 * @return the vertex list
	 */
	public List<Vector3f> getVertexList() {
		return vertexList;
	}

	/**
	 * This method sets the vertex list.
	 * 
	 * @param vertexList
	 *            the vertex list
	 */
	public void setVertexList(List<Vector3f> vertexList) {
		this.vertexList = vertexList;
	}

	/**
	 * This method returns the vertex reference map.
	 * 
	 * @return the vertex reference map
	 */
	public Map<Integer, List<Integer>> getVertexReferenceMap() {
		return vertexReferenceMap;
	}

	/**
	 * This method sets the vertex reference map.
	 * 
	 * @param vertexReferenceMap
	 *            the vertex reference map
	 */
	public void setVertexReferenceMap(
			Map<Integer, List<Integer>> vertexReferenceMap) {
		this.vertexReferenceMap = vertexReferenceMap;
	}

	/**
	 * This method adds the mesh's UV-coordinates.
	 * 
	 * @param geometry
	 *            the mesh that has the UV-coordinates
	 * @param vertexBuffer
	 *            the mesh's UV-coordinates
	 */
	public void addUVCoordinates(Geometry geometry, VertexBuffer vertexBuffer) {
		uvCoordinates.put(geometry, vertexBuffer);
	}

	/**
	 * This method returns the mesh's UV-coordinates.
	 * 
	 * @param geometry
	 *            the mesh
	 * @return the mesh's UV-coordinates
	 */
	public VertexBuffer getUVCoordinates(Geometry geometry) {
		return uvCoordinates.get(geometry);
	}
}