use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Wall method init.
@Override
protected void init() {
super.init();
if (Util.isZero(wallThickness)) {
wallThickness = defaultWallThickness;
}
if (Util.isZero(uValue)) {
uValue = 0.28;
}
if (Util.isZero(volumetricHeatCapacity)) {
volumetricHeatCapacity = 0.5;
}
if (Util.isZero(columnRadius)) {
columnRadius = 1;
}
if (Util.isZero(railRadius)) {
railRadius = 0.1;
}
neighbors = new Snap[2];
if (thicknessNormal != null) {
thicknessNormal.normalizeLocal().multiplyLocal(wallThickness);
}
mesh = new Mesh("Wall");
mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1));
// mesh.getSceneHints().setPickingHint(PickingHint.Pickable, false);
mesh.setRenderState(offsetState);
mesh.setModelBound(new BoundingBox());
root.attachChild(mesh);
backMesh = new Mesh("Wall (Back)");
backMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1));
backMesh.setDefaultColor(ColorRGBA.LIGHT_GRAY);
backMesh.getSceneHints().setPickingHint(PickingHint.Pickable, false);
backMesh.setRenderState(offsetState);
backMesh.setModelBound(new BoundingBox());
root.attachChild(backMesh);
surroundMesh = new Mesh("Wall (Surround)");
surroundMesh.getMeshData().setIndexMode(IndexMode.Quads);
surroundMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(12));
surroundMesh.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(12));
surroundMesh.setDefaultColor(ColorRGBA.GRAY);
surroundMesh.setRenderState(offsetState);
surroundMesh.setModelBound(new BoundingBox());
root.attachChild(surroundMesh);
invisibleMesh = new Mesh("Wall (Invisible)");
invisibleMesh.getMeshData().setIndexMode(IndexMode.Quads);
invisibleMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
invisibleMesh.getSceneHints().setCullHint(CullHint.Always);
invisibleMesh.setRenderState(offsetState);
invisibleMesh.setModelBound(new BoundingBox());
root.attachChild(invisibleMesh);
windowsSurroundMesh = new Mesh("Wall (Windows Surround)");
windowsSurroundMesh.getMeshData().setIndexMode(IndexMode.Quads);
windowsSurroundMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1));
windowsSurroundMesh.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(1));
windowsSurroundMesh.setDefaultColor(ColorRGBA.GRAY);
windowsSurroundMesh.getSceneHints().setPickingHint(PickingHint.Pickable, false);
windowsSurroundMesh.setRenderState(offsetState);
/* lets not use bounds for this mesh because when there are no windows its bounds is set to center 0,0,0 which shifts the overall bounds toward zero */
windowsSurroundMesh.setModelBound(null);
root.attachChild(windowsSurroundMesh);
outlineMesh = new Line("Wall (Outline)");
outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
outlineMesh.setDefaultColor(ColorRGBA.BLACK);
outlineMesh.setModelBound(null);
Util.disablePickShadowLight(outlineMesh);
root.attachChild(outlineMesh);
updateTextureAndColor();
final UserData userData = new UserData(this);
mesh.setUserData(userData);
backMesh.setUserData(userData);
surroundMesh.setUserData(userData);
invisibleMesh.setUserData(userData);
columns = new Mesh("Columns");
columns.getMeshData().setIndexMode(IndexMode.Quads);
columns.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(500));
columns.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(500));
columns.setRenderState(offsetState);
columns.setModelBound(new BoundingBox());
root.attachChild(columns);
rails = new Mesh("Railings");
rails.getMeshData().setIndexMode(IndexMode.Quads);
rails.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1000));
rails.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(1000));
rails.setRenderState(offsetState);
rails.setModelBound(new BoundingBox());
root.attachChild(rails);
steelFrame = new Mesh("Steel Frame");
steelFrame.getMeshData().setIndexMode(IndexMode.Quads);
steelFrame.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1000));
steelFrame.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(1000));
steelFrame.setRenderState(offsetState);
steelFrame.setModelBound(new BoundingBox());
root.attachChild(steelFrame);
}
use of com.ardor3d.scenegraph.Mesh in project energy3d by concord-consortium.
the class Rack method addPrintMesh.
@Override
protected void addPrintMesh(final List<Mesh> list, final Mesh mesh) {
if (mesh.getSceneHints().getCullHint() != CullHint.Always) {
final Mesh newMesh = mesh.makeCopy(false);
final MaterialState material = new MaterialState();
switch(sampleSolarPanel.getColorOption()) {
case SolarPanel.COLOR_OPTION_BLACK:
material.setDiffuse(ColorRGBA.BLACK);
break;
case SolarPanel.COLOR_OPTION_BLUE:
material.setDiffuse(ColorRGBA.BLUE);
break;
case SolarPanel.COLOR_OPTION_GRAY:
material.setDiffuse(ColorRGBA.GRAY);
break;
default:
material.setDiffuse(mesh.getDefaultColor());
}
newMesh.setRenderState(material);
newMesh.getMeshData().transformVertices((Transform) mesh.getWorldTransform());
newMesh.getMeshData().transformNormals((Transform) mesh.getWorldTransform(), true);
list.add(newMesh);
}
}
use of com.ardor3d.scenegraph.Mesh 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.Mesh 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.Mesh in project energy3d by concord-consortium.
the class Roof method setOriginal.
@Override
public void setOriginal(final HousePart original) {
final Roof originalRoof = (Roof) original;
this.original = original;
root.detachChild(pointsRoot);
root.detachChild(roofPartsRoot);
roofPartsRoot = originalRoof.roofPartsRoot.makeCopy(true);
root.attachChild(roofPartsRoot);
for (int i = 0; i < roofPartsRoot.getNumberOfChildren(); i++) {
final UserData orgUserData = (UserData) ((Node) originalRoof.roofPartsRoot.getChild(i)).getChild(0).getUserData();
final Mesh mesh = (Mesh) ((Node) roofPartsRoot.getChild(i)).getChild(0);
mesh.setUserData(new UserData(this, orgUserData.getEditPointIndex(), false));
roofPartsRoot.getChild(i).setUserData(originalRoof.roofPartsRoot.getChild(i).getUserData());
final Line outlineMesh = (Line) ((Node) roofPartsRoot.getChild(i)).getChild(4);
outlineMesh.setLineWidth(printOutlineThickness);
}
drawAnnotations();
root.updateWorldBound(true);
}
Aggregations