use of com.ardor3d.renderer.state.OffsetState in project energy3d by concord-consortium.
the class SolarPanel method init.
@Override
protected void init() {
super.init();
if (Util.isZero(panelWidth)) {
panelWidth = 0.99;
}
if (Util.isZero(panelHeight)) {
panelHeight = 1.65;
}
if (Util.isZero(efficiency)) {
// make it the same as the default one in PvModuleSpecs
efficiency = 0.1833;
}
if (Util.isZero(temperatureCoefficientPmax)) {
temperatureCoefficientPmax = -0.005;
}
if (Util.isZero(nominalOperatingCellTemperature)) {
nominalOperatingCellTemperature = 48;
}
if (Util.isZero(inverterEfficiency)) {
inverterEfficiency = 0.95;
}
if (Util.isZero(baseHeight)) {
baseHeight = 5;
}
if (Util.isZero(numberOfCellsInX)) {
numberOfCellsInX = 6;
}
if (Util.isZero(numberOfCellsInY)) {
numberOfCellsInY = 10;
}
if (pvModuleSpecs == null) {
// backward compatibility
pvModuleSpecs = new PvModuleSpecs("Custom");
pvModuleSpecs.setCellEfficiency(efficiency);
pvModuleSpecs.setWidth(panelWidth);
pvModuleSpecs.setLength(panelHeight);
pvModuleSpecs.setNoct(nominalOperatingCellTemperature);
pvModuleSpecs.setPmaxTc(temperatureCoefficientPmax);
pvModuleSpecs.setLayout(numberOfCellsInX, numberOfCellsInY);
switch(cellType) {
case POLYCRYSTALLINE:
pvModuleSpecs.setCellType("Polycrystalline");
colorOption = COLOR_OPTION_BLUE;
break;
case MONOCRYSTALLINE:
pvModuleSpecs.setCellType("Monocrystalline");
colorOption = COLOR_OPTION_BLACK;
break;
case THIN_FILM:
pvModuleSpecs.setCellType("Thin Film");
colorOption = COLOR_OPTION_BLACK;
break;
}
} else {
convertStringPropertiesToIntegerProperties();
}
mesh = new Mesh("SolarPanel");
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("SolarPanel (Surround)");
surround.setModelBound(new OrientedBoundingBox());
final OffsetState offset = new OffsetState();
offset.setFactor(1);
offset.setUnits(1);
surround.setRenderState(offset);
root.attachChild(surround);
outlineMesh = new Line("SolarPanel (Outline)");
outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
outlineMesh.setDefaultColor(ColorRGBA.BLACK);
outlineMesh.setModelBound(new OrientedBoundingBox());
root.attachChild(outlineMesh);
supportFrame = new Mesh("Supporting Frame");
supportFrame.getMeshData().setIndexMode(IndexMode.Quads);
supportFrame.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(12));
supportFrame.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(12));
supportFrame.setRenderState(offsetState);
supportFrame.setModelBound(new BoundingBox());
root.attachChild(supportFrame);
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);
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);
solarCellOutlines = new Line("Solar Cell Outlines");
solarCellOutlines.setLineWidth(1f);
solarCellOutlines.setStipplePattern((short) 0xffff);
solarCellOutlines.setModelBound(null);
Util.disablePickShadowLight(solarCellOutlines);
solarCellOutlines.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(1));
solarCellOutlines.setDefaultColor(new ColorRGBA(0f, 0f, 0f, 1f));
root.attachChild(solarCellOutlines);
updateTextureAndColor();
}
use of com.ardor3d.renderer.state.OffsetState in project energy3d by concord-consortium.
the class SceneManager method createLand.
private Mesh createLand() {
final Quad land = new Quad("Land", SKY_RADIUS * 2, SKY_RADIUS * 2);
land.setDefaultColor(new ColorRGBA(0, 1.0f, 0.75f, 0.5f));
final OffsetState offsetState = new OffsetState();
offsetState.setTypeEnabled(OffsetType.Fill, true);
offsetState.setFactor(10);
offsetState.setUnits(10);
land.setRenderState(offsetState);
final BlendState blendState = new BlendState();
blendState.setBlendEnabled(true);
land.setRenderState(blendState);
land.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
land.setRenderState(ms);
land.updateModelBound();
land.updateWorldBound(true);
return land;
}
use of com.ardor3d.renderer.state.OffsetState in project energy3d by concord-consortium.
the class SceneManager method initGroundImageLand.
private void initGroundImageLand(final double scale) {
// 0.2 is the obsolete annotation scale by default, can't call Scene.getAnnotationScale() yet
final double d = BOSTON_MAP_SCALE_FACTOR / 0.2 * scale;
groundImageLand.resize(d, d);
final OffsetState offsetState = new OffsetState();
offsetState.setTypeEnabled(OffsetType.Fill, true);
offsetState.setFactor(2);
offsetState.setUnits(2);
groundImageLand.setRenderState(offsetState);
groundImageLand.updateModelBound();
groundImageLand.updateWorldBound(true);
}
Aggregations