public abstract class MeshBase
extends java.lang.Object
If you want to render to a particular shape, extend from here, construct a float array containing per-vertex attributes, and call back setAttribs().
Modifier and Type | Field and Description |
---|---|
static int |
MAX_EFFECT_COMPONENTS |
Modifier and Type | Method and Description |
---|---|
void |
addEmptyTexComponent()
Adds an empty (no vertices) texture component to the end of the text component list.
|
void |
apply(MatrixEffect effect,
int andAssoc,
int equAssoc)
Apply a Matrix Effect to the components which match the (addAssoc,equAssoc) association.
|
void |
apply(VertexEffect effect)
Apply a Vertex Effect to the vertex mesh.
|
abstract MeshBase |
copy(boolean deep)
Copy the Mesh.
|
static int |
getMaxEffComponents() |
boolean |
getShowNormals()
When rendering this mesh, should we also draw the normal vectors?
|
Static4D |
getTextureMap(int component)
Return the texture map of one of the components.
|
static void |
getUniforms(int programH,
int variant) |
static boolean |
getUseCenters()
Are we using per-component centers?
|
void |
markForDeletion()
Release all internal resources.
|
void |
mergeEffComponents()
Merge all effect components of this Mesh into a single one.
|
void |
mergeTexComponents()
Merge all texture components of this Mesh into a single one.
|
int |
numEffComponents()
Return the number of 'effect' components, i.e.
|
int |
numTexComponents()
Return the number of texture components, i.e.
|
void |
setComponentCenter(int component,
float centerX,
float centerY,
float centerZ)
Set center of a Component.
|
void |
setEffectAssociation(int component,
int andAssociation,
int equAssociation)
Set Effect association.
|
void |
setShowNormals(boolean show)
When rendering this Mesh, do we want to render the Normal vectors as well?
|
void |
setTextureMap(Static4D[] maps,
int startComponent)
Sets texture maps for (some of) the components of this mesh.
|
static void |
setUseCenters()
Are we going to need per-component centers (needed for correct postprocessing of concave meshes)
Switching this on allocates 16*MAX_EFFECT_COMPONENTS bytes for uniforms in the vertex shader.
|
void |
write(java.io.DataOutputStream stream)
Write the Mesh to a File.
|
public static final int MAX_EFFECT_COMPONENTS
public static void setUseCenters()
public static boolean getUseCenters()
public static int getMaxEffComponents()
public static void getUniforms(int programH, int variant)
public void write(java.io.DataOutputStream stream)
public void setShowNormals(boolean show)
Will work only on OpenGL ES >= 3.0 devices.
show
- Controls if we render the Normal vectors or not.public boolean getShowNormals()
public void mergeTexComponents()
public void mergeEffComponents()
public void markForDeletion()
public void apply(MatrixEffect effect, int andAssoc, int equAssoc)
This is a static, permanent modification of the vertices contained in this Mesh. If the effect contains any Dynamics, they will be evaluated at 0.
effect
- List of Matrix Effects to apply to the Mesh.andAssoc
- 'Logical AND' association which defines which components will be affected.equAssoc
- 'equality' association which defines which components will be affected.public void apply(VertexEffect effect)
This is a static, permanent modification of the vertices contained in this Mesh. If the effects contain any Dynamics, the Dynamics will be evaluated at 0. We would call this several times building up a list of Effects to do. This list of effects gets lazily executed only when the Mesh is used for rendering for the first time.
effect
- Vertex Effect to apply to the Mesh.public void setTextureMap(Static4D[] maps, int startComponent)
Format: ( x of lower-left corner, y of lower-left corner, width, height ). For example maps[0] = new Static4D( 0.0, 0.5, 0.5, 0.5 ) sets the 0th component texture map to the upper-left quadrant of the texture.
Probably the most common user case would be sending as many maps as there are components in this Mesh. One can also send less, or more (the extraneous ones will be ignored) and set some of them to null (those will be ignored as well). So if there are 5 components, and we want to set the map of the 2nd and 4rd one, call this with maps = new Static4D[4] maps[0] = null maps[1] = the map for the 2nd component maps[2] = null maps[3] = the map for the 4th component A map's width and height have to be non-zero (but can be negative!)
maps
- List of texture maps to apply to the texture's components.startComponent
- the component the first of the maps refers to.public Static4D getTextureMap(int component)
component
- The component number whose texture map we want to retrieve.public void setEffectAssociation(int component, int andAssociation, int equAssociation)
public void setComponentCenter(int component, float centerX, float centerY, float centerZ)
public void addEmptyTexComponent()
public int numTexComponents()
public int numEffComponents()
public abstract MeshBase copy(boolean deep)
deep
- If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
and normals (the rest, in particular the mVertAttribs2 containing texture
coordinates and effect associations, is always deep copied)