Feature: added an option to blender key that allows user to set the
width of edges unattached to any faces in the mesh.
This commit is contained in:
parent
dd7ea3d2a7
commit
6dc8ff521a
@ -126,6 +126,8 @@ public class BlenderKey extends ModelKey {
|
|||||||
protected AnimationMatchMethod animationMatchMethod = AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH;
|
protected AnimationMatchMethod animationMatchMethod = AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH;
|
||||||
/** The size of points that are loaded and do not belong to any edge of the mesh. */
|
/** The size of points that are loaded and do not belong to any edge of the mesh. */
|
||||||
protected float pointsSize = 1;
|
protected float pointsSize = 1;
|
||||||
|
/** The width of edges that are loaded from the mesh and do not belong to any face. */
|
||||||
|
protected float linesWidth = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor used by serialization mechanisms.
|
* Constructor used by serialization mechanisms.
|
||||||
@ -475,6 +477,22 @@ public class BlenderKey extends ModelKey {
|
|||||||
this.pointsSize = pointsSize;
|
this.pointsSize = pointsSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the width of edges that are loaded from the mesh and do not belong to any face
|
||||||
|
*/
|
||||||
|
public float getLinesWidth() {
|
||||||
|
return linesWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the width of edges that are loaded from the mesh and do not belong to any face.
|
||||||
|
* @param linesWidth
|
||||||
|
* the width of edges that are loaded from the mesh and do not belong to any face
|
||||||
|
*/
|
||||||
|
public void setLinesWidth(float linesWidth) {
|
||||||
|
this.linesWidth = linesWidth;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This mehtod sets the name of the WORLD data block taht should be used during file loading. By default the name is
|
* This mehtod sets the name of the WORLD data block taht should be used during file loading. By default the name is
|
||||||
* not set. If no name is set or the given name does not occur in the file - the first WORLD data block will be used
|
* not set. If no name is set or the given name does not occur in the file - the first WORLD data block will be used
|
||||||
@ -532,6 +550,7 @@ public class BlenderKey extends ModelKey {
|
|||||||
oc.write(optimiseTextures, "optimise-textures", false);
|
oc.write(optimiseTextures, "optimise-textures", false);
|
||||||
oc.write(animationMatchMethod, "animation-match-method", AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
|
oc.write(animationMatchMethod, "animation-match-method", AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
|
||||||
oc.write(pointsSize, "points-size", 1);
|
oc.write(pointsSize, "points-size", 1);
|
||||||
|
oc.write(linesWidth, "lines-width", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -555,6 +574,7 @@ public class BlenderKey extends ModelKey {
|
|||||||
optimiseTextures = ic.readBoolean("optimise-textures", false);
|
optimiseTextures = ic.readBoolean("optimise-textures", false);
|
||||||
animationMatchMethod = ic.readEnum("animation-match-method", AnimationMatchMethod.class, AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
|
animationMatchMethod = ic.readEnum("animation-match-method", AnimationMatchMethod.class, AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
|
||||||
pointsSize = ic.readFloat("points-size", 1);
|
pointsSize = ic.readFloat("points-size", 1);
|
||||||
|
linesWidth = ic.readFloat("lines-width", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -580,7 +600,8 @@ public class BlenderKey extends ModelKey {
|
|||||||
result = prime * result + (skyGeneratedTextureShape == null ? 0 : skyGeneratedTextureShape.hashCode());
|
result = prime * result + (skyGeneratedTextureShape == null ? 0 : skyGeneratedTextureShape.hashCode());
|
||||||
result = prime * result + skyGeneratedTextureSize;
|
result = prime * result + skyGeneratedTextureSize;
|
||||||
result = prime * result + (usedWorld == null ? 0 : usedWorld.hashCode());
|
result = prime * result + (usedWorld == null ? 0 : usedWorld.hashCode());
|
||||||
result = prime * result + (int)pointsSize;
|
result = prime * result + (int) pointsSize;
|
||||||
|
result = prime * result + (int) linesWidth;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,6 +683,9 @@ public class BlenderKey extends ModelKey {
|
|||||||
if (pointsSize != other.pointsSize) {
|
if (pointsSize != other.pointsSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (linesWidth != other.linesWidth) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,10 +101,11 @@ public class TemporalMesh extends Geometry {
|
|||||||
*/
|
*/
|
||||||
protected TemporalMesh(Structure meshStructure, BlenderContext blenderContext, boolean loadData) throws BlenderFileException {
|
protected TemporalMesh(Structure meshStructure, BlenderContext blenderContext, boolean loadData) throws BlenderFileException {
|
||||||
this.blenderContext = blenderContext;
|
this.blenderContext = blenderContext;
|
||||||
name = meshStructure.getName();
|
|
||||||
this.meshStructure = meshStructure;
|
this.meshStructure = meshStructure;
|
||||||
|
|
||||||
if (loadData) {
|
if (loadData) {
|
||||||
|
name = meshStructure.getName();
|
||||||
|
|
||||||
MeshHelper meshHelper = blenderContext.getHelper(MeshHelper.class);
|
MeshHelper meshHelper = blenderContext.getHelper(MeshHelper.class);
|
||||||
|
|
||||||
meshHelper.loadVerticesAndNormals(meshStructure, vertices, normals);
|
meshHelper.loadVerticesAndNormals(meshStructure, vertices, normals);
|
||||||
@ -178,6 +179,7 @@ public class TemporalMesh extends Geometry {
|
|||||||
public TemporalMesh clone() {
|
public TemporalMesh clone() {
|
||||||
try {
|
try {
|
||||||
TemporalMesh result = new TemporalMesh(meshStructure, blenderContext, false);
|
TemporalMesh result = new TemporalMesh(meshStructure, blenderContext, false);
|
||||||
|
result.name = name;
|
||||||
for (Vector3f v : vertices) {
|
for (Vector3f v : vertices) {
|
||||||
result.vertices.add(v.clone());
|
result.vertices.add(v.clone());
|
||||||
}
|
}
|
||||||
@ -534,7 +536,7 @@ public class TemporalMesh extends Geometry {
|
|||||||
meshBuffers.append(vertices.get(index), normals.get(index));
|
meshBuffers.append(vertices.get(index), normals.get(index));
|
||||||
}
|
}
|
||||||
Mesh mesh = new Mesh();
|
Mesh mesh = new Mesh();
|
||||||
mesh.setPointSize(2);
|
mesh.setLineWidth(blenderContext.getBlenderKey().getLinesWidth());
|
||||||
mesh.setMode(Mode.LineStrip);
|
mesh.setMode(Mode.LineStrip);
|
||||||
if (meshBuffers.isShortIndexBuffer()) {
|
if (meshBuffers.isShortIndexBuffer()) {
|
||||||
mesh.setBuffer(Type.Index, 1, (ShortBuffer) meshBuffers.getIndexBuffer());
|
mesh.setBuffer(Type.Index, 1, (ShortBuffer) meshBuffers.getIndexBuffer());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user