use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Roof method init.
@Override
protected void init() {
super.init();
if (Util.isZero(uValue)) {
uValue = 0.15;
}
if (Util.isZero(overhangLength)) {
overhangLength = 2;
}
if (Util.isZero(volumetricHeatCapacity)) {
volumetricHeatCapacity = 0.5;
}
orgCenters = new HashMap<Node, ReadOnlyVector3>();
wallNormals = new ArrayList<ReadOnlyVector3>();
walls = new ArrayList<Wall>();
roofPartPrintVerticalMap = new HashMap<Spatial, Boolean>();
dashPointsCache = new HashMap<Mesh, List<ReadOnlyVector3>>();
roofPartsRoot = new Node("Roof Meshes Root");
root.attachChild(roofPartsRoot);
mesh = new Mesh("Roof");
mesh.setModelBound(null);
getEditPointShape(0).setDefaultColor(ColorRGBA.CYAN);
// cleanup
if (gableEditPointToWallMap != null) {
for (final List<Wall> wallList : gableEditPointToWallMap.values()) {
final Iterator<Wall> walls = wallList.iterator();
while (walls.hasNext()) {
if (Scene.getInstance().getParts().indexOf(walls.next()) == -1) {
walls.remove();
}
}
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Roof method addPrintMeshes.
@Override
public void addPrintMeshes(final List<Mesh> list) {
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Mesh mesh = (Mesh) ((Node) roofPart).getChild(REAL_MESH_INDEX);
addPrintMesh(list, mesh);
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Roof method updateDashLinesColor.
public void updateDashLinesColor() {
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Node roofPartNode = (Node) roofPart;
final Mesh dashLinesMesh = (Mesh) roofPartNode.getChild(5);
dashLinesMesh.setDefaultColor(ColorRGBA.RED);
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Roof method drawAnnotations.
@Override
public void drawAnnotations() {
if (container == null) {
return;
}
for (final Spatial roofPart : roofPartsRoot.getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
int annotCounter = 0, angleAnnotCounter = 0;
final Node roofPartNode = (Node) roofPart;
final FloatBuffer buf = ((Mesh) roofPartNode.getChild(0)).getMeshData().getVertexBuffer();
final ArrayList<ReadOnlyVector3> convexHull = MeshLib.computeOutline(buf);
final ReadOnlyVector3 normal = (ReadOnlyVector3) roofPart.getUserData();
final int n = convexHull.size();
for (int i = 0; i < n; i++) {
final ReadOnlyVector3 p1 = convexHull.get(i);
final ReadOnlyVector3 p2 = convexHull.get((i + 1) % n);
final ReadOnlyVector3 p3 = convexHull.get((i + 2) % n);
// Size annotation
final ReadOnlyVector3 center = p1.add(p2, null).addLocal(p3).multiplyLocal(1.0 / 3.0);
final SizeAnnotation sizeAnnot = fetchSizeAnnot(annotCounter++, (Node) roofPartNode.getChild(1));
final boolean drawAnnotationsInside = Scene.isDrawAnnotationsInside();
sizeAnnot.setRange(p2, p3, center, normal, false, Align.Center, true, true, drawAnnotationsInside);
sizeAnnot.setLineWidth(original == null ? 1f : 2f);
if (drawAnnotationsInside) {
sizeAnnot.setColor(ColorRGBA.WHITE);
} else {
sizeAnnot.setColor(ColorRGBA.BLACK);
}
// Angle annotations
final AngleAnnotation angleAnnot = fetchAngleAnnot(angleAnnotCounter++, (Node) roofPartNode.getChild(2));
angleAnnot.setLineWidth(original == null ? 1f : 2f);
angleAnnot.setRange(p2, p1, p3, normal);
}
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class ParabolicTrough method addPrintMeshes.
@Override
public void addPrintMeshes(final List<Mesh> list) {
addPrintMesh(list, reflectorBack);
addPrintMesh(list, absorber);
addPrintMesh(list, absorberCore);
addPrintMesh(list, absorberEnd1);
addPrintMesh(list, absorberEnd1Core);
addPrintMesh(list, absorberEnd2);
addPrintMesh(list, absorberEnd2Core);
for (final Spatial mesh : modulesRoot.getChildren()) {
addPrintMesh(list, (Mesh) mesh);
}
}
Aggregations