use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Foundation method updateTextureAndColor.
@Override
public void updateTextureAndColor() {
for (final Mesh mesh : sideMesh) {
mesh.setDefaultColor(Scene.getInstance().getTextureMode() == TextureMode.Full ? ColorRGBA.GRAY : (getColor() == null ? Scene.getInstance().getFoundationColor() : getColor()));
updateTextureAndColor(mesh, getColor() == null ? Scene.getInstance().getFoundationColor() : getColor());
}
updateTextureAndColor(mesh, getColor() == null ? Scene.getInstance().getFoundationColor() : getColor());
if (!SceneManager.getInstance().getSolarHeatMap() && importedNodes != null) {
final int n = importedNodes.size();
if (n > 0) {
Node ni;
for (int i = 0; i < n; i++) {
ni = importedNodes.get(i);
if (root.getChildren().contains(ni)) {
for (final Spatial s : ni.getChildren()) {
if (s instanceof Mesh) {
if (s instanceof Line) {
continue;
}
final Mesh m = (Mesh) s;
final UserData ud = (UserData) m.getUserData();
final TextureState ts = (TextureState) m.getLocalRenderState(StateType.Texture);
if (ts == null || ts.getTexture() == null) {
m.clearRenderState(StateType.Texture);
// m.setDefaultColor(nis.getDefaultColor());
} else {
if (ud.getTextureBuffer() == null || Util.isZero(ud.getTextureBuffer())) {
m.clearRenderState(StateType.Texture);
// m.setDefaultColor(nis.getDefaultColor());
} else {
m.getMeshData().setTextureBuffer(ud.getTextureBuffer(), 0);
m.setRenderState(ud.getRenderState());
}
}
}
}
}
}
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Foundation method setMeshThickness.
public void setMeshThickness(final Node node, final double thickness) {
final NodeState ns = getNodeState(node);
if (!Util.isEqual(thickness, ns.getMeshThickness())) {
final double delta = thickness - ns.getMeshThickness();
for (final Spatial s : node.getChildren()) {
final Mesh m = (Mesh) s;
final UserData u = (UserData) m.getUserData();
// do not use u.getRotateNormal() because in this case rotation would be applied to node, not mesh
m.addTranslation(u.getNormal().multiply(delta, null));
}
ns.setMeshThickness(thickness);
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Foundation method setRotatedNormalsForImportedMeshes.
private void setRotatedNormalsForImportedMeshes() {
if (importedNodes != null) {
drawImportedNodes();
// DO NOT skip zero azimuth case -- final boolean nonZeroAz = !Util.isZero(getAzimuth());
for (final Node node : importedNodes) {
for (final Spatial s : node.getChildren()) {
final Mesh m = (Mesh) s;
final UserData ud = (UserData) m.getUserData();
ud.setRotatedNormal(node.getRotation().applyPost(ud.getNormal(), null));
}
}
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Foundation method createMeshThickness.
private void createMeshThickness(final Node node) {
final NodeState ns = getNodeState(node);
double thickness = ns.getMeshThickness();
if (Util.isZero(thickness)) {
thickness = 0.05;
ns.setMeshThickness(thickness);
}
for (final Spatial s : node.getChildren()) {
final Mesh m = (Mesh) s;
final UserData u = (UserData) m.getUserData();
// do not use u.getRotateNormal() because in this case rotation would be applied to node, not mesh
m.addTranslation(u.getNormal().multiply(thickness, null));
}
}
use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.
the class Roof method drawLabels.
@Override
public int drawLabels(int printSequence) {
for (final Spatial roofPartNode : roofPartsRoot.getChildren()) {
if (roofPartNode.getSceneHints().getCullHint() != CullHint.Always) {
final String text = "(" + (printSequence++ + 1) + ")";
final BMText label = (BMText) ((Node) roofPartNode).getChild(3);
label.getSceneHints().setCullHint(CullHint.Inherit);
label.setText(text);
}
}
return printSequence;
}
Aggregations