use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Rack method init.
@Override
protected void init() {
super.init();
if (Util.isZero(copyLayoutGap)) {
// FIXME: Why is a transient member evaluated to zero?
copyLayoutGap = 1;
}
if (Util.isZero(rackWidth)) {
rackWidth = 4.95;
}
if (Util.isZero(rackHeight)) {
rackHeight = 1.65;
}
if (monthlyTiltAngles == null) {
monthlyTiltAngles = new double[12];
Arrays.fill(monthlyTiltAngles, tiltAngle);
}
mesh = new Mesh("Rack");
mesh.setDefaultColor(ColorRGBA.LIGHT_GRAY);
mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6));
mesh.getMeshData().setTextureBuffer(BufferUtils.createVector2Buffer(6), 0);
mesh.setModelBound(new OrientedBoundingBox());
mesh.setUserData(new UserData(this));
root.attachChild(mesh);
surround = new Box("Rack (Surround)");
surround.setDefaultColor(ColorRGBA.LIGHT_GRAY);
surround.setModelBound(new OrientedBoundingBox());
final OffsetState offset = new OffsetState();
// set a smaller value than solar panel so that the texture doesn't show up on the underside
offset.setFactor(0.2f);
offset.setUnits(1);
surround.setRenderState(offset);
root.attachChild(surround);
outlineMesh = new Line("Rack (Outline)");
outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
outlineMesh.setDefaultColor(ColorRGBA.BLACK);
outlineMesh.setModelBound(new OrientedBoundingBox());
root.attachChild(outlineMesh);
sunBeam = new Line("Sun Beam");
sunBeam.setLineWidth(1f);
sunBeam.setStipplePattern((short) 0xffff);
sunBeam.setModelBound(null);
Util.disablePickShadowLight(sunBeam);
sunBeam.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
sunBeam.setDefaultColor(new ColorRGBA(1f, 1f, 1f, 1f));
root.attachChild(sunBeam);
normalVector = new Line("Normal Vector");
normalVector.setLineWidth(1f);
normalVector.setStipplePattern((short) 0xffff);
normalVector.setModelBound(null);
Util.disablePickShadowLight(normalVector);
normalVector.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6));
normalVector.setDefaultColor(new ColorRGBA(1f, 1f, 0f, 1f));
root.attachChild(normalVector);
angles = new Node("Angles");
angles.getSceneHints().setAllPickingHints(false);
Util.disablePickShadowLight(angles);
root.attachChild(angles);
// the angle between the sun beam and the normal vector
sunAngle = new AngleAnnotation();
sunAngle.setColor(ColorRGBA.WHITE);
sunAngle.setLineWidth(1);
sunAngle.setFontSize(1);
sunAngle.setCustomRadius(normalVectorLength * 0.8);
angles.attachChild(sunAngle);
solarPanelOutlines = new Line("Solar Panel Outlines");
solarPanelOutlines.setLineWidth(1f);
solarPanelOutlines.setStipplePattern((short) 0xffff);
solarPanelOutlines.setModelBound(null);
Util.disablePickShadowLight(solarPanelOutlines);
solarPanelOutlines.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1));
solarPanelOutlines.setDefaultColor(new ColorRGBA(0f, 0f, 0f, 1f));
root.attachChild(solarPanelOutlines);
label = new BMText("Label", "#" + id, FontManager.getInstance().getPartNumberFont(), Align.Center, Justify.Center);
Util.initHousePartLabel(label);
label.setFontScale(0.5);
label.setVisible(false);
root.attachChild(label);
polesRoot = new Node("Poles Root");
root.attachChild(polesRoot);
updateTextureAndColor();
if (sampleSolarPanel == null) {
sampleSolarPanel = new SolarPanel();
}
// ugly fixes for zero initial values when sampleSolarPanel is previously serialized without new variables
if (sampleSolarPanel.getPvModuleSpecs() == null) {
sampleSolarPanel.setPvModuleSpecs(new PvModuleSpecs());
}
if (Util.isZero(sampleSolarPanel.getNominalOperatingCellTemperature())) {
sampleSolarPanel.setNominalOperatingCellTemperature(48);
}
if (!points.isEmpty()) {
oldRackCenter = points.get(0).clone();
}
oldRackWidth = rackWidth;
oldRackHeight = rackHeight;
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Rack method drawMesh.
@Override
protected void drawMesh() {
if (container == null) {
return;
}
final double az = Math.toRadians(relativeAzimuth);
final double currentTilt = monthlyTiltAngles[Heliodon.getInstance().getCalendar().get(Calendar.MONTH)];
boolean onFlatSurface = onFlatSurface();
getEditPointShape(0).setDefaultColor(ColorRGBA.ORANGE);
// if this rack rests on an imported mesh or not?
final Mesh host = meshLocator == null ? null : meshLocator.find();
if (host == null) {
normal = pickedNormal != null ? pickedNormal : computeNormalAndKeepOnSurface();
} else {
final UserData ud = (UserData) host.getUserData();
normal = ud.getRotatedNormal() == null ? ud.getNormal() : ud.getRotatedNormal();
onFlatSurface = Util.isEqual(normal, Vector3.UNIT_Z);
}
final double dotE = 0.9999;
switch(trackerType) {
case ALTAZIMUTH_DUAL_AXIS_TRACKER:
normal = Heliodon.getInstance().computeSunLocation(Heliodon.getInstance().getCalendar()).normalizeLocal();
break;
case HORIZONTAL_SINGLE_AXIS_TRACKER:
final Vector3 sunDirection = Heliodon.getInstance().computeSunLocation(Heliodon.getInstance().getCalendar()).normalizeLocal();
// by default, the rotation axis is in the east-west direction, so az = 0 maps to (1, 0, 0)
final Vector3 rotationAxis = Util.isZero(az) ? new Vector3(1, 0, 0) : new Vector3(MathUtils.cos(az), MathUtils.sin(az), 0);
final double axisSunDot = sunDirection.dot(rotationAxis);
// avoid singularity when the direction of the sun is perpendicular to the rotation axis
rotationAxis.multiplyLocal(Util.isZero(axisSunDot) ? 0.001 : axisSunDot);
normal = sunDirection.subtractLocal(rotationAxis).normalizeLocal();
break;
case VERTICAL_SINGLE_AXIS_TRACKER:
final Vector3 a = Heliodon.getInstance().computeSunLocation(Heliodon.getInstance().getCalendar()).multiplyLocal(1, 1, 0).normalizeLocal();
final Vector3 b = Vector3.UNIT_Z.cross(a, null);
Matrix3 m = new Matrix3().applyRotation(Math.toRadians(90 - currentTilt), b.getX(), b.getY(), b.getZ());
normal = m.applyPost(a, null);
if (normal.getZ() < 0) {
normal = normal.negate(null);
}
break;
case // TODO: The following does not work
TILTED_SINGLE_AXIS_TRACKER:
final double sunAngleX = Heliodon.getInstance().computeSunLocation(Heliodon.getInstance().getCalendar()).normalizeLocal().dot(Vector3.UNIT_X);
System.out.println("*** sun cosx = " + sunAngleX + ", " + Math.toDegrees(Math.asin(sunAngleX)));
// rotate the normal according to the tilt angle, at this point, the axis is still north-south
// exactly 90 degrees will cause the solar panel to disappear
setNormal(Util.isZero(currentTilt) ? Math.PI / 2 * dotE : Math.toRadians(90 - currentTilt), az);
System.out.println("*** tilt normal = " + normal);
// the following vector should be the rack axis
final Vector3 rackAxis = Vector3.UNIT_X.cross(normal, null);
System.out.println("*** rack axis = " + rackAxis);
m = new Matrix3().fromAngleNormalAxis(Math.asin(sunAngleX), rackAxis);
normal = m.applyPost(normal, null);
System.out.println("*** final normal = " + normal);
if (normal.getZ() < 0) {
normal = normal.negate(null);
}
break;
default:
if (onFlatSurface) {
// exactly 90 degrees will cause the solar panel to disappear
setNormal(Util.isZero(currentTilt) ? Math.PI / 2 * dotE : Math.toRadians(90 - currentTilt), az);
}
}
if (Util.isEqual(normal, Vector3.UNIT_Z)) {
normal = new Vector3(-0.001, 0, 1).normalizeLocal();
}
if (previousNormal == null) {
previousNormal = normal;
}
if (previousNormal != null && normal.dot(previousNormal) < dotE) {
// azimuth rotation
Matrix3 matrix = null;
if (allowAzimuthLargeRotation && Util.isEqual(normal.multiply(1, 1, 0, null).normalizeLocal(), previousNormal.multiply(1, 1, 0, null).negateLocal().normalizeLocal())) {
matrix = new Matrix3().fromAngleAxis(Math.PI, Vector3.UNIT_Z);
} else if (normal.multiply(1, 1, 0, null).normalizeLocal().dot(previousNormal.multiply(1, 1, 0, null).normalizeLocal()) > -dotE) {
matrix = findRotationMatrix(previousNormal.multiply(1, 1, 0, null).normalizeLocal(), normal.multiply(1, 1, 0, null).normalizeLocal());
}
if (matrix != null) {
rotateSolarPanels(matrix);
previousNormal = matrix.applyPost(previousNormal, null);
}
// tilt rotation
rotateSolarPanels(findRotationMatrix(previousNormal, normal));
initSolarPanelsForMove();
previousNormal = normal;
}
allowAzimuthLargeRotation = false;
if (container instanceof Foundation) {
if (host != null && Util.isEqualFaster(normal, Vector3.UNIT_Z, 0.001)) {
// compute the height of the underlying mesh
final FloatBuffer buff = host.getMeshData().getVertexBuffer();
Vector3 v0 = new Vector3(buff.get(0), buff.get(1), buff.get(2));
v0 = host.getWorldTransform().applyForward(v0, null);
baseZ = v0.getZ();
} else {
baseZ = container.getHeight();
}
} else {
baseZ = container.getPoints().get(0).getZ();
}
// if (onFlatSurface && Util.isEqual(points.get(0).getZ(), baseZ)) {
if (onFlatSurface && host == null) {
points.get(0).setZ(baseZ + baseHeight);
}
final double annotationScale = Scene.getInstance().getAnnotationScale();
surround.setData(new Vector3(0, 0, 0), 0.5 * rackWidth / annotationScale, 0.5 * rackHeight / annotationScale, 0.15);
surround.updateModelBound();
final boolean heatMap = SceneManager.getInstance().getSolarHeatMap();
final FloatBuffer boxVertexBuffer = surround.getMeshData().getVertexBuffer();
final FloatBuffer vertexBuffer = mesh.getMeshData().getVertexBuffer();
final FloatBuffer textureBuffer = mesh.getMeshData().getTextureBuffer(0);
final FloatBuffer outlineBuffer = outlineMesh.getMeshData().getVertexBuffer();
vertexBuffer.rewind();
outlineBuffer.rewind();
textureBuffer.rewind();
// when the heat map is on, use a single texture from the radiation calculation, don't repeat
final double sampleSolarPanelX = sampleSolarPanel.isRotated() ? sampleSolarPanel.getPanelHeight() : sampleSolarPanel.getPanelWidth();
final double sampleSolarPanelY = sampleSolarPanel.isRotated() ? sampleSolarPanel.getPanelWidth() : sampleSolarPanel.getPanelHeight();
final float spw = heatMap ? 1 : (monolithic ? (float) (rackWidth / sampleSolarPanelX) : 1);
final float sph = heatMap ? 1 : (monolithic ? (float) (rackHeight / sampleSolarPanelY) : 1);
int i = 8 * 3;
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
textureBuffer.put(spw).put(0);
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
i += 3;
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
textureBuffer.put(0).put(0);
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
i += 3;
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
textureBuffer.put(0).put(sph);
textureBuffer.put(0).put(sph);
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
i += 3;
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
textureBuffer.put(spw).put(sph);
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
i = 8 * 3;
vertexBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
textureBuffer.put(spw).put(0);
outlineBuffer.put(boxVertexBuffer.get(i)).put(boxVertexBuffer.get(i + 1)).put(boxVertexBuffer.get(i + 2));
mesh.updateModelBound();
outlineMesh.updateModelBound();
mesh.setRotation(new Matrix3().lookAt(normal, normal.getX() > 0 ? Vector3.UNIT_Z : Vector3.NEG_UNIT_Z));
mesh.setTranslation(onFlatSurface && host != null ? getAbsPoint(0).addLocal(0, 0, baseHeight) : getAbsPoint(0));
surround.setTranslation(mesh.getTranslation());
surround.setRotation(mesh.getRotation());
outlineMesh.setTranslation(mesh.getTranslation());
outlineMesh.setRotation(mesh.getRotation());
polesRoot.detachAllChildren();
if (!poleInvisible) {
final Vector3 center = getAbsPoint(0);
final double halfRackWidth = rackWidth * 0.5;
switch(trackerType) {
case Trackable.NO_TRACKER:
HousePart container = getContainerRelative();
final Vector3 uDir = container.getPoints().get(2).subtract(container.getPoints().get(0), null).normalizeLocal();
final Vector3 vDir = container.getPoints().get(1).subtract(container.getPoints().get(0), null).normalizeLocal();
final Matrix3 matrix = new Matrix3().fromAngles(0, 0, az);
matrix.applyPost(uDir, uDir);
matrix.applyPost(vDir, vDir);
if (vDir.dot(normal) < 0) {
vDir.negateLocal();
}
final double tanTiltAngle = Math.abs(Math.tan(Math.toRadians(currentTilt)));
if (tanTiltAngle < 100) {
final double cosTiltAngle = Math.cos(Math.toRadians(currentTilt));
// project to the horizontal direction
final double poleDistanceYHorizontal = poleDistanceY * cosTiltAngle;
final double rackHeightHorizontal = rackHeight * cosTiltAngle;
final double halfRackHeightHorizontal = 0.5 * rackHeightHorizontal;
for (double u = halfRackWidth; u < rackWidth; u += poleDistanceX) {
for (double v = halfRackHeightHorizontal; v < rackHeightHorizontal; v += poleDistanceYHorizontal) {
final double vFactor = (v - halfRackHeightHorizontal) / annotationScale;
final Vector3 position = uDir.multiply((u - halfRackWidth) / annotationScale, null).addLocal(vDir.multiply(vFactor, null)).addLocal(center);
final double dz = tanTiltAngle * vFactor;
if (baseHeight > dz) {
addPole(position, baseHeight - dz, baseZ);
}
}
for (double v = halfRackHeightHorizontal - poleDistanceYHorizontal; v > 0; v -= poleDistanceYHorizontal) {
final double vFactor = (v - halfRackHeightHorizontal) / annotationScale;
final Vector3 position = uDir.multiply((u - halfRackWidth) / annotationScale, null).addLocal(vDir.multiply(vFactor, null)).addLocal(center);
final double dz = tanTiltAngle * vFactor;
if (baseHeight > dz) {
addPole(position, baseHeight - dz, baseZ);
}
}
}
for (double u = halfRackWidth - poleDistanceX; u > 0; u -= poleDistanceX) {
for (double v = halfRackHeightHorizontal; v < rackHeightHorizontal; v += poleDistanceYHorizontal) {
final double vFactor = (v - halfRackHeightHorizontal) / annotationScale;
final Vector3 position = uDir.multiply((u - halfRackWidth) / annotationScale, null).addLocal(vDir.multiply(vFactor, null)).addLocal(center);
final double dz = tanTiltAngle * vFactor;
if (baseHeight > dz) {
addPole(position, baseHeight - dz, baseZ);
}
}
for (double v = halfRackHeightHorizontal - poleDistanceYHorizontal; v > 0; v -= poleDistanceYHorizontal) {
final double vFactor = (v - halfRackHeightHorizontal) / annotationScale;
final Vector3 position = uDir.multiply((u - halfRackWidth) / annotationScale, null).addLocal(vDir.multiply(vFactor, null)).addLocal(center);
final double dz = tanTiltAngle * vFactor;
if (baseHeight > dz) {
addPole(position, baseHeight - dz, baseZ);
}
}
}
}
break;
case Trackable.HORIZONTAL_SINGLE_AXIS_TRACKER:
polesRoot.detachAllChildren();
container = getContainerRelative();
// (0, 0)
final Vector3 p0 = new Vector3(vertexBuffer.get(3), vertexBuffer.get(4), vertexBuffer.get(5));
// (1, 0)
final Vector3 p1 = new Vector3(vertexBuffer.get(0), vertexBuffer.get(1), vertexBuffer.get(2));
final Vector3 pd = p0.subtract(p1, null).normalizeLocal();
final int nPoles = Math.max(1, (int) (rackWidth / poleDistanceX));
if (nPoles > 1) {
final double halfLength = rackWidth * 0.5;
final Vector3 qd = new Matrix3().applyRotationZ(az).applyPost(pd, null);
for (double u = halfLength; u < rackWidth; u += poleDistanceX) {
addPole(qd.multiply((u - halfLength) / annotationScale, null).addLocal(center), baseHeight, baseZ);
}
for (double u = halfLength - poleDistanceX; u > 0; u -= poleDistanceX) {
addPole(qd.multiply((u - halfLength) / annotationScale, null).addLocal(center), baseHeight, baseZ);
}
} else {
addPole(center, baseHeight, baseZ);
}
polesRoot.getSceneHints().setCullHint(CullHint.Inherit);
break;
case Trackable.ALTAZIMUTH_DUAL_AXIS_TRACKER:
case Trackable.VERTICAL_SINGLE_AXIS_TRACKER:
addPole(getAbsPoint(0), baseHeight, baseZ);
break;
}
}
polesRoot.getSceneHints().setCullHint(onFlatSurface ? CullHint.Inherit : CullHint.Always);
if (drawSunBeam) {
drawSunBeam();
}
drawFloatingLabel(onFlatSurface);
if (heatMap && (rackWidth > sampleSolarPanelX || rackHeight > sampleSolarPanelY)) {
drawSolarPanelOutlines();
} else {
solarPanelOutlines.setVisible(false);
}
CollisionTreeManager.INSTANCE.removeCollisionTree(mesh);
CollisionTreeManager.INSTANCE.removeCollisionTree(surround);
root.updateGeometricState(0);
drawChildren();
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Roof method drawOutline.
protected void drawOutline() {
if (container == null) {
return;
}
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Node roofPartNode = (Node) roofPart;
final Mesh outlineMesh = (Mesh) roofPartNode.getChild(4);
final Mesh mesh = (Mesh) roofPartNode.getChild(0);
final ArrayList<ReadOnlyVector3> outlinePoints = MeshLib.computeOutline(mesh.getMeshData().getVertexBuffer());
int totalVertices = outlinePoints.size();
for (final HousePart part : children) {
if (part instanceof Window) {
totalVertices += 8;
}
}
final FloatBuffer buf;
if (outlineMesh.getMeshData().getVertexBuffer().capacity() >= totalVertices * 2 * 3) {
buf = outlineMesh.getMeshData().getVertexBuffer();
buf.limit(buf.capacity());
buf.rewind();
} else {
buf = BufferUtils.createVector3Buffer(totalVertices * 2);
outlineMesh.getMeshData().setVertexBuffer(buf);
}
// draw roof outline
for (int i = 0; i < outlinePoints.size(); i++) {
final ReadOnlyVector3 p1 = outlinePoints.get(i);
final ReadOnlyVector3 p2 = outlinePoints.get((i + 1) % outlinePoints.size());
buf.put(p1.getXf()).put(p1.getYf()).put(p1.getZf());
buf.put(p2.getXf()).put(p2.getYf()).put(p2.getZf());
}
// draw skylights outline
final int[] windowIndices = new int[] { 0, 2, 3, 1 };
for (final HousePart part : children) {
if (part instanceof Window && part.isDrawable() && ((Window) part).getRoofIndex() == ((UserData) mesh.getUserData()).getEditPointIndex()) {
for (int i = 0; i < part.getPoints().size(); i++) {
final ReadOnlyVector3 p1 = part.getAbsPoint(windowIndices[i]);
final ReadOnlyVector3 p2 = part.getAbsPoint(windowIndices[(i + 1) % part.getPoints().size()]);
buf.put(p1.getXf()).put(p1.getYf()).put(p1.getZf());
buf.put(p2.getXf()).put(p2.getYf()).put(p2.getZf());
}
}
}
buf.limit(buf.position());
outlineMesh.getMeshData().updateVertexCount();
outlineMesh.updateModelBound();
}
}
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Roof method fits.
@Override
protected boolean fits(final HousePart window) {
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Mesh mesh = (Mesh) ((Node) roofPart).getChild(0);
final ArrayList<ReadOnlyVector3> outlinePoints = MeshLib.computeOutline(mesh.getMeshData().getVertexBuffer());
boolean allInside = true;
boolean allOutside = true;
for (int i = 0; i < window.getPoints().size(); i++) {
final Vector3 p = window.getAbsPoint(i);
roofPart.getWorldTransform().applyInverse(p);
if (Util.insidePolygon(p, outlinePoints)) {
allOutside = false;
} else {
allInside = false;
}
}
if (!allInside && !allOutside) {
return false;
}
}
}
return true;
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Roof method drawMesh.
@Override
protected void drawMesh() {
// undo the effect of wall stretch on all walls if roof is moved to new walls
if (previousContainer != container) {
previousContainer = container;
for (final Wall wall : walls) {
wall.setRoof(null);
wall.draw();
}
}
dashPointsCache.clear();
if (wallUpperPoints == null) {
wallUpperPoints = new ArrayList<ReadOnlyVector3>();
} else {
wallUpperPoints.clear();
}
if (container != null) {
initWallUpperPoints((Wall) container, walls, wallUpperPoints, wallNormals);
}
if (!isDrawable()) {
roofPartsRoot.getSceneHints().setCullHint(CullHint.Always);
setEditPointsVisible(false);
return;
}
roofPartsRoot.getSceneHints().setCullHint(CullHint.Inherit);
final ArrayList<Vector3> orgPoints = new ArrayList<Vector3>(points.size());
for (final ReadOnlyVector3 p : points) {
orgPoints.add(p.clone());
}
wallUpperPointsWithoutOverhang = new ArrayList<ReadOnlyVector3>(wallUpperPoints);
drawRoof();
switch(type) {
case TRANSPARENT:
for (final Spatial child : roofPartsRoot.getChildren()) {
((Mesh) ((Node) child).getChild(0)).getSceneHints().setCullHint(CullHint.Always);
((Mesh) ((Node) child).getChild(REAL_MESH_INDEX)).getSceneHints().setCullHint(CullHint.Always);
}
break;
default:
for (final Spatial child : roofPartsRoot.getChildren()) {
((Mesh) ((Node) child).getChild(0)).getSceneHints().setCullHint(CullHint.Inherit);
((Mesh) ((Node) child).getChild(REAL_MESH_INDEX)).getSceneHints().setCullHint(CullHint.Inherit);
}
}
roofPartsRoot.updateWorldBound(true);
drawOutline();
if (Scene.getInstance().areDashedLinesOnRoofShown()) {
drawDashLines();
} else {
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Mesh dashLinesMesh = (Mesh) ((Node) roofPart).getChild(5);
dashLinesMesh.setVisible(false);
}
}
}
}
Aggregations