use of com.ardor3d.scenegraph.Line 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.Line 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.Line in project energy3d by concord-consortium.
the class FresnelReflector method init.
@Override
protected void init() {
super.init();
if (Util.isZero(copyLayoutGap)) {
// FIXME: Why is a transient member evaluated to zero?
copyLayoutGap = 0.2;
}
if (Util.isZero(moduleLength)) {
moduleLength = 3;
}
if (Util.isZero(length)) {
length = 2 * moduleLength;
}
if (Util.isZero(moduleWidth)) {
moduleWidth = 2;
}
if (Util.isZero(reflectance)) {
reflectance = 0.9;
}
if (Util.isZero(opticalEfficiency)) {
opticalEfficiency = 0.99;
}
if (Util.isZero(nSectionLength)) {
nSectionLength = 16;
}
if (Util.isZero(nSectionWidth)) {
nSectionWidth = 4;
}
detailed = Scene.getInstance().countParts(this.getClass()) < 50;
if (absorber != null) {
// FIXME: Somehow the absorber foundation, when copied, doesn't point to the right object. This is not a prefect solution, but it fixes the problem.
absorber = (Foundation) Scene.getInstance().getPart(absorber.getId());
}
mesh = new Mesh("Fresnel Reflector Face");
mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6));
mesh.getMeshData().setTextureBuffer(BufferUtils.createVector2Buffer(6), 0);
mesh.setDefaultColor(SKY_BLUE);
mesh.setModelBound(new OrientedBoundingBox());
mesh.setUserData(new UserData(this));
root.attachChild(mesh);
reflector = new Box("Fresnel Reflector Box");
reflector.setModelBound(new OrientedBoundingBox());
final OffsetState offset = new OffsetState();
offset.setFactor(1);
offset.setUnits(1);
reflector.setRenderState(offset);
root.attachChild(reflector);
final int nModules = Math.max(1, getNumberOfModules());
outlines = new Line("Fresnel Reflector (Outline)");
outlines.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8 + (nModules - 1) * 2));
outlines.setDefaultColor(ColorRGBA.BLACK);
outlines.setModelBound(new OrientedBoundingBox());
outlines.setLineWidth(1f);
outlines.setStipplePattern((short) 0xffff);
Util.disablePickShadowLight(outlines);
root.attachChild(outlines);
lightBeams = new Line("Light Beams");
lightBeams.setLineWidth(1f);
lightBeams.setStipplePattern((short) 0xffff);
lightBeams.setModelBound(null);
Util.disablePickShadowLight(lightBeams);
lightBeams.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
lightBeams.setDefaultColor(new ColorRGBA(1f, 1f, 1f, 1f));
root.attachChild(lightBeams);
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);
modulesRoot = new Node("Modules Root");
root.attachChild(modulesRoot);
updateTextureAndColor();
if (!points.isEmpty()) {
oldReflectorCenter = points.get(0).clone();
}
oldLength = length;
oldModuleWidth = moduleWidth;
}
use of com.ardor3d.scenegraph.Line in project energy3d by concord-consortium.
the class SceneManager method createAxes.
private Spatial createAxes() {
final int axisLen = SKY_RADIUS;
final Node axisRoot = new Node();
FloatBuffer buf;
Line line;
// X-Axis
buf = BufferUtils.createVector3Buffer(2);
buf.put(-axisLen).put(0).put(0);
buf.put(axisLen).put(0).put(0);
line = new Line("X-Axis", buf, null, null, null);
line.setDefaultColor(ColorRGBA.RED);
Util.disablePickShadowLight(line);
line.setModelBound(new BoundingBox());
line.updateModelBound();
axisRoot.attachChild(line);
// Y-Axis
buf = BufferUtils.createVector3Buffer(2);
buf.put(0).put(-axisLen).put(0);
buf.put(0).put(axisLen).put(0);
line = new Line("Y-Axis", buf, null, null, null);
line.setDefaultColor(ColorRGBA.GREEN);
Util.disablePickShadowLight(line);
line.setModelBound(new BoundingBox());
line.updateModelBound();
axisRoot.attachChild(line);
// Z-Axis
buf = BufferUtils.createVector3Buffer(2);
buf.put(0).put(0).put(-axisLen);
buf.put(0).put(0).put(axisLen);
line = new Line("Z-Axis", buf, null, null, null);
Util.disablePickShadowLight(line);
line.setDefaultColor(ColorRGBA.BLUE);
line.setModelBound(new BoundingBox());
line.updateModelBound();
axisRoot.attachChild(line);
axisRoot.updateWorldBound(true);
return axisRoot;
}
use of com.ardor3d.scenegraph.Line 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;
}
Aggregations