use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Door method init.
@Override
protected void init() {
super.init();
if (Util.isZero(uValue)) {
uValue = 2;
}
if (Util.isZero(volumetricHeatCapacity)) {
volumetricHeatCapacity = 0.5;
}
mesh = new Mesh("Door");
mesh.getMeshData().setIndexMode(IndexMode.TriangleStrip);
mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
mesh.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(4));
mesh.getMeshData().setTextureBuffer(BufferUtils.createVector2Buffer(4), 0);
updateTextureAndColor();
mesh.setModelBound(new BoundingBox());
mesh.setUserData(new UserData(this));
root.attachChild(mesh);
outlineMesh = new Line("Door (Outline)");
outlineMesh.setLineWidth(2);
outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6 + 2 * 4));
outlineMesh.setDefaultColor(ColorRGBA.BLACK);
outlineMesh.setModelBound(new BoundingBox());
Util.disablePickShadowLight(outlineMesh);
root.attachChild(outlineMesh);
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Floor method init.
@Override
protected void init() {
super.init();
mesh = new Mesh("Floor");
root.attachChild(mesh);
mesh.getMeshData().setIndexMode(IndexMode.TriangleStrip);
mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
mesh.setModelBound(new BoundingBox());
mesh.setRenderState(offsetState);
outlineMesh = new Line("Floor (Outline)");
outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
outlineMesh.setDefaultColor(ColorRGBA.BLACK);
outlineMesh.setModelBound(new BoundingBox());
Util.disablePickShadowLight(outlineMesh);
/* no need to attach because floor outline is only need in print preview */
updateTextureAndColor();
mesh.setUserData(new UserData(this));
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Foundation method pickMesh.
public void pickMesh(final int x, final int y) {
selectedMesh = null;
if (importedNodes != null) {
final PickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
final Ray3 pickRay = SceneManager.getInstance().getCamera().getPickRay(new Vector2(x, y), false, null);
for (final Node node : importedNodes) {
for (final Spatial s : node.getChildren()) {
if (s instanceof Mesh) {
PickingUtil.findPick(s, pickRay, pickResults, false);
}
}
}
if (pickResults.getNumber() > 0) {
final Pickable pickable = pickResults.getPickData(0).getTarget();
if (pickable instanceof Mesh) {
selectedMesh = (Mesh) pickable;
drawMeshSelection(selectedMesh);
}
} else {
setMeshSelectionVisible(false);
}
}
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Foundation method setMovePointsVisible.
public void setMovePointsVisible(final boolean visible) {
final int n = points.size();
for (int i = n - 4; i < n; i++) {
final Spatial editPoint = pointsRoot.getChild(i);
((Mesh) editPoint).setVisible(visible);
final SceneHints sceneHints = editPoint.getSceneHints();
sceneHints.setAllPickingHints(visible);
}
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Foundation method drawImportedNodes.
public void drawImportedNodes() {
if (importedNodes != null) {
final int n = importedNodes.size();
if (n > 0) {
Node ni;
final Vector3 c = getAbsCenter();
// the absolute center is lifted to the center of the bounding box that includes walls when there are
c.setZ(height);
// FIXME: Why negate?
final Matrix3 matrix = new Matrix3().fromAngles(0, 0, -Math.toRadians(getAzimuth()));
for (int i = 0; i < n; i++) {
ni = importedNodes.get(i);
if (root.getChildren().contains(ni)) {
final Vector3 relativePosition = importedNodeStates.get(i).getRelativePosition();
if (relativePosition != null) {
final Vector3 vi = matrix.applyPost(relativePosition, null);
ni.setTranslation(c.add(vi, null));
ni.setRotation(matrix);
for (final Spatial s : ni.getChildren()) {
if (s instanceof Mesh) {
final Mesh m = (Mesh) s;
m.updateModelBound();
}
}
}
}
}
}
}
}
Aggregations